MnemosyneEcto.Queries.NodeQueries (mnemosyne_ecto v0.2.0)

Copy Markdown View Source

Engine-agnostic Ecto query builders for the nodes table.

The {table, schema} source is resolved from the active MnemosyneEcto.Adapter carried in the state, so the same builders work for both PostgreSQL and SQLite. Vector similarity search lives on the adapter (MnemosyneEcto.Adapter.vector_search/4) because its expression differs per engine.

Summary

Functions

Base query scoped to the current tenant.

Filters the query to only include nodes with the given IDs.

Filters the query to only include nodes of the given types.

Base query scoped to the current tenant and repo.

Returns the {table_name, schema} source tuple for the nodes table.

Functions

base(state)

@spec base(map()) :: Ecto.Query.t()

Base query scoped to the current tenant.

by_ids(query, ids)

@spec by_ids(Ecto.Query.t(), [String.t()]) :: Ecto.Query.t()

Filters the query to only include nodes with the given IDs.

by_types(query, types)

@spec by_types(Ecto.Query.t(), [atom()]) :: Ecto.Query.t()

Filters the query to only include nodes of the given types.

scoped(state)

@spec scoped(map()) :: Ecto.Query.t()

Base query scoped to the current tenant and repo.

source(map)

@spec source(map()) :: {String.t(), module()}

Returns the {table_name, schema} source tuple for the nodes table.