Skip to main content

Crate sentinel_driver

Crate sentinel_driver 

Source
Expand description

§sentinel-driver

High-performance PostgreSQL wire protocol driver for Rust. Foundation layer for Sentinel ORM.

§Features

  • PG-only — every PostgreSQL feature is first-class
  • Single-task architecture — no channel overhead
  • Pipeline mode — automatic query batching (PG 14+)
  • COPY protocol — bulk insert 10-50x faster than INSERT
  • LISTEN/NOTIFY — first-class realtime notifications
  • SCRAM-SHA-256 with correct SASLprep
  • Zero-copy parsing for large column values
  • Two-tier prepared statement cache
  • Connection pool with <0.5μs checkout

§Quick Start

use sentinel_driver::{Config, Connection};

let config = Config::parse("postgres://user:pass@localhost/mydb")?;
let mut conn = Connection::connect(config).await?;

let rows = conn.query("SELECT id, name FROM users WHERE active = $1", &[&true]).await?;
for row in &rows {
    let id: i32 = row.get(0);
    let name: String = row.get(1);
}

Re-exports§

pub use advisory_lock::PgAdvisoryLock;
pub use advisory_lock::PgAdvisoryLockGuard;
pub use cache::CacheMetrics;
pub use cache::StatementCache;
pub use cancel::CancelToken;
pub use config::ChannelBinding;
pub use config::Config;
pub use config::LoadBalanceHosts;
pub use config::SslMode;
pub use config::TargetSessionAttrs;
pub use connection::Connection;
pub use copy::binary::BinaryCopyDecoder;
pub use copy::binary::BinaryCopyEncoder;
pub use copy::text::TextCopyDecoder;
pub use copy::text::TextCopyEncoder;
pub use error::Error;
pub use error::Result;
pub use generic_client::GenericClient;
pub use notify::Notification;
pub use observability::ObservabilityConfig;
pub use observability::QueryMetrics;
pub use observability::QueryMetricsCallback;
pub use pool::Pool;
pub use pool::PoolMetrics;
pub use pool::PooledConnection;
pub use portal::Portal;
pub use row::CommandResult;
pub use row::Row;
pub use row::RowDescription;
pub use row::SimpleQueryMessage;
pub use row::SimpleQueryRow;
pub use statement::Statement;
pub use stream::RowStream;
pub use transaction::IsolationLevel;
pub use transaction::TransactionConfig;
pub use types::FromSql;
pub use types::Oid;
pub use types::ToSql;

Modules§

advisory_lock
auth
cache
cancel
config
connection
copy
error
generic_client
notify
observability
pipeline
pool
portal
protocol
row
statement
stream
tls
transaction
types

Derive Macros§

FromRow
Derive FromRow for a struct — automatically decode a Row into the struct.
FromSql
Derive FromSql for a newtype wrapper.
ToSql
Derive ToSql for a newtype wrapper.