Skip to main content

Crate sntl

Crate sntl 

Source
Expand description

§Sentinel ORM

Compile-time guarded ORM for PostgreSQL.

[dependencies]
sntl = "0.1"
use sntl::prelude::*;

Re-exports§

pub use core::error::Error;
pub use core::error::Result;
pub use core::observability;
pub use driver;

Modules§

core
Core — Model trait, QueryBuilder, types, and connection abstraction. Sentinel Core — Model trait, QueryBuilder, types, and connection abstraction.
migrate
Migration tools — schema diff and migration generation. Sentinel Migrate — Schema diff and migration generation. Phase 1: Stub module, implementation in later phase.
prelude
Prelude — common imports for quick setup.
types
PostgreSQL extension types re-exported from the driver.

Macros§

query
Compile-time-validated query!() family. sntl::query!("SQL", params…) — compile-time-validated query that returns an anonymous record (a private struct with one field per output column).
query_as
Compile-time-validated query!() family. sntl::query_as!(Target, "SQL", params…) — like query! but loads each row into the user-supplied Target: FromRow.
query_as_unchecked
Compile-time-validated query!() family. sntl::query_as_unchecked!(Target, "SQL", params…).
query_file
Compile-time-validated query!() family. sntl::query_file!("queries/foo.sql", params…) — load SQL from disk.
query_file_as
Compile-time-validated query!() family. sntl::query_file_as!(Target, "queries/foo.sql", params…).
query_pipeline
Compile-time-validated query!() family. sntl::query_pipeline!(conn, name1: "SQL"; name2: "SQL" using Target, p1, p2; …).
query_scalar
Compile-time-validated query!() family. sntl::query_scalar!("SQL", params…) — single-column projection.
query_unchecked
Compile-time-validated query!() family. sntl::query_unchecked!("SQL", params…) — escape hatch that skips the .sentinel/ cache and runs through the driver’s untyped query path.

Structs§

Config
Connection configuration for sentinel-driver.
Oid
Well-known PostgreSQL type OIDs.
Pool
A connection pool for PostgreSQL.
PooledConnection
A connection checked out from the pool.

Traits§

FromSql
Decode a Rust value from PostgreSQL binary format.
ToSql
Encode a Rust value into PostgreSQL binary format.

Attribute Macros§

sentinel
Attribute macro — #[sentinel(relations)]. Declare relations on a model.

Derive Macros§

FromRow
Derive macros — #[derive(Model)], #[derive(Partial)], #[derive(FromRow)]. Derive FromRow for ad-hoc structs returned by sntl::query_as!.
FromSql
Derive FromSql for a newtype wrapper.
Model
Derive the Model trait for a struct.
Partial
Derive a partial select type.
ToSql
Derive ToSql for a newtype wrapper.