MnemosyneEcto.NodeSerializer (mnemosyne_ecto v0.2.0)

Copy Markdown View Source

Round-trip conversion between Mnemosyne node structs and DB-friendly maps.

to_row/4 produces maps suitable for Repo.insert_all. from_row/2 converts DB rows (schema structs or plain maps) back to Mnemosyne node structs.

Embedding encoding/decoding is delegated to the active MnemosyneEcto.Adapter so the same serializer works for pgvector and sqlite-vec.

Summary

Functions

Converts a DB row back into its corresponding Mnemosyne node struct.

Converts a Mnemosyne node struct into a map suitable for Repo.insert_all.

Functions

from_row(row, adapter)

@spec from_row(map(), module()) :: struct()

Converts a DB row back into its corresponding Mnemosyne node struct.

to_row(node, tenant_id, repo_id, adapter)

@spec to_row(struct(), String.t(), String.t(), module()) :: map()

Converts a Mnemosyne node struct into a map suitable for Repo.insert_all.