Skip to main content

Crate mentat

Crate mentat 

Source

Re-exports§

pub use crate::auto_index::AutoIndex;
pub use crate::auto_index::IndexAction;
pub use query_builder::QueryBuilder;
pub use conn::Conn;
pub use store::Store;
pub use edn;

Modules§

auto_index
Automatic index management for the embedded store.
conn
entity_builder
errors
options
The JSON query options ({"inputs": [...], "asOf": T, "since": T}) live in mentat_transaction::options, shared with the DuckDB backend; re-exported here as mentat::options_from_json.
query
query_builder
store
vocabulary
This module exposes an interface for programmatic management of vocabularies.

Macros§

kw
Produce the appropriate Keyword for the provided namespace and name. This lives here because we can’t re-export macros: https://github.com/rust-lang/rust/issues/29638.
var
Produce the appropriate Variable for the provided valid ?-prefixed name. This lives here because we can’t re-export macros: https://github.com/rust-lang/rust/issues/29638.

Structs§

Attribute
A Mentat schema attribute has a value type and several other flags determining how assertions with the attribute are interpreted.
DateTime
ISO 8601 combined date and time with time zone.
InProgress
Represents an in-progress, not yet committed, set of changes to the store. Call commit to commit your changes, or rollback to discard them. A transaction is held open until you do so. Your changes will be implicitly dropped along with this struct.
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.
KnownEntid
An entid that’s either already in the store, or newly allocated to a tempid. TODO: we’d like to link this in some way to the lifetime of a particular PartitionMap.
Metadata
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:
Schema
Represents a Mentat schema.
StructuredMap
A pull expression expands a binding into a structure. The returned structure associates attributes named in the input or retrieved from the store with values. This association is a StructuredMap.
TxObserver
TxReport
A transaction report summarizes an applied transaction.
Utc
The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
Uuid
A Universally Unique Identifier (UUID).
Variable

Enums§

AlgebrizerError
Binding
The values bound in a query specification can be:
CacheAction
CacheDirection
FindSpec
A definition of the first part of a find query: the [:find ?foo ?bar…] bit.
MentatError
ProjectorError
PullError
QueryExplanation
A struct describing information about how Mentat would execute a query.
QueryResults
SQLError
TemporalBound
A whole-query temporal bound (as-of / since). See ConjoiningClauses::temporal.
TypedValue
Represents a value that can be stored in a Mentat store.
ValueType
The attribute of each Mentat assertion has a :db/valueType constraining the value to a particular set. Mentat recognizes the following :db/valueType values.

Constants§

CORE_SCHEMA_VERSION
DB_SCHEMA_CORE

Traits§

BindingTuple
A BindingTuple is any type that can accommodate a Mentat tuple query result of fixed length.
FromMicros
FromMillis
HasSchema
IntoResult
Pullable
Queryable
ToMicros
ToMillis

Functions§

new_connection
now
Return the current time as a UTC DateTime instance with microsecond precision.
options_from_json
Parse options for query: the :in values and an optional temporal bound. null, {} and a missing inputs mean none.
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.

Type Aliases§

AttributeSet
Entid
Represents one entid in the entid space.
ParseError
QueryExecutionResult
Result