One Model struct yields Entity, Column, PrimaryKey and ActiveModel; composite keys of up to six columns.
Typed columns
bool, integers, floats, String, Vec<u8>, chrono dates and times, Uuid, JSON and Decimal, with Option<T> for nullable columns, and your own enums through DeriveActiveEnum.
Active values
Set, Unchanged and NotSet decide what each write touches; insert, update, save and delete return the stored row; try_into_model goes back to the model.
Request structs
DeriveIntoActiveModel turns a request body into an active model; from_json does the same from a JSON object.
Hooks
before_save, after_save, before_delete, after_delete on the active model.
Schema generation
CREATE TABLE and CREATE INDEX from the entities, STRICT-compatible, with foreign keys from the relations.
belongs_to, has_many and has_one, with ON DELETE and ON UPDATE actions in the generated DDL; via for many-to-many through a junction.
Navigation
find_related in both directions, inner_join and left_join, a two-model select in a single query, grouped with find_with_related; self-references and several relations to one table through aliased joins.
Chains
Linked paths across any number of tables, with find_linked, find_also_linked and find_with_linked.
Loaders
load_one, load_many and load_many_to_many fetch the related rows of a whole slice with one query, in input order.
DEFERRED, IMMEDIATE, EXCLUSIVE and Turso's CONCURRENT mode, nested through savepoints, with a closure form that commits or rolls back for you.
Pool
A small pool over the engine that enforces one task per connection, with acquire and busy timeouts and per-connection pragmas.
Connection options
In-memory or file databases, embedded replicas of Turso Cloud, or Turso Cloud over HTTP; read-only mode, encryption at rest, experimental engine flags.
Errors
One structured error type; constraint and busy conditions are classified by the driver.