MnemosyneZvex.Encoding (mnemosyne_zvex v0.1.0)

Copy Markdown

Encodes Mnemosyne.Graph.Node.* structs into Zvex.Document values for Zvex storage, and decodes them back. The :links field is stripped on encode and re-attached by the caller (from the sidecar). The :embedding field is encoded into the dedicated vector column.

Summary

Functions

Decodes a Zvex document fields map back into the original Mnemosyne node struct. The returned struct has :links set to empty — the caller must merge in the sidecar links before returning to Mnemosyne.

Encodes a Mnemosyne node into a Zvex.Document ready for upsert.

Encodes a list of nodes.

Recognises the seven supported Mnemosyne node-struct modules.

Functions

decode(fields)

@spec decode(map()) :: struct()

Decodes a Zvex document fields map back into the original Mnemosyne node struct. The returned struct has :links set to empty — the caller must merge in the sidecar links before returning to Mnemosyne.

encode(node, dimension)

@spec encode(
  struct(),
  pos_integer()
) :: Zvex.Document.t()

Encodes a Mnemosyne node into a Zvex.Document ready for upsert.

encode_many(nodes, dimension)

@spec encode_many([struct()], pos_integer()) :: [Zvex.Document.t()]

Encodes a list of nodes.

node_module?(mod)

@spec node_module?(module()) :: boolean()

Recognises the seven supported Mnemosyne node-struct modules.