Module mentat_transaction::query [] [src]

Structs

Keyword

A keyword is a symbol, optionally with a namespace, that prints with a leading colon. This concept is imported from Clojure, as it features in EDN and the query syntax that we use.

Known

A convenience wrapper around things known in memory: the schema and caches. We use a trait object here to avoid making dozens of functions generic over the type of the cache. If performance becomes a concern, we should hard-code specific kinds of cache right here, and/or eliminate the Option.

PlainSymbol

A simplification of Clojure's Symbol.

QueryInputs

Define the inputs to a query. This is in two parts: a set of values known now, and a set of types known now. The separate map of types is to allow queries to be algebrized without full knowledge of the bindings that will be used at execution time. When built correctly, types is guaranteed to contain the types of values -- use QueryInputs::new or QueryInputs::with_values to construct an instance.

QueryOutput
QueryPlanStep

A single row in the output of SQLite's EXPLAIN QUERY PLAN. See https://www.sqlite.org/eqp.html for an explanation of each field.

RelResult

The result you get from a 'rel' query, like:

Variable

Enums

PreparedQuery
QueryExplanation

A struct describing information about how Mentat would execute a query.

QueryResults

Traits

IntoResult

Functions

lookup_value

Return a single value for the provided entity and attribute. If the attribute is multi-valued, an arbitrary value is returned. If no value is present for that entity, None is returned. If attribute isn't an attribute, None is returned.

lookup_value_for_attribute

Return a single value for the provided entity and attribute. If the attribute is multi-valued, an arbitrary value is returned. If no value is present for that entity, None is returned. If attribute doesn't name an attribute, an error is returned.

lookup_values
lookup_values_for_attribute
q_explain
q_once

Take an EDN query string, a reference to an open SQLite connection, a Mentat schema, and an optional collection of input bindings (which should be keyed by "?varname"), and execute the query immediately, blocking the current thread. Returns a structure that corresponds to the kind of input query, populated with TypedValue instances. The caller is responsible for ensuring that the SQLite connection has an open transaction if isolation is required.

q_prepare
q_uncached

Just like q_once, but doesn't use any cached values.

Type Definitions

PreparedResult
QueryExecutionResult