Skip to main content

Crate statiq

Crate statiq 

Source
Expand description

§SqlService

Zero-overhead, compile-time MSSQL service for Rust.

§Quick start

use sqlservice::{SqlServiceFactory, SqlEntity, params};

#[derive(SqlEntity)]
#[sql_table("Users", schema = "dbo")]
pub struct User {
    #[sql_primary_key(identity)]
    pub id: i32,
    #[sql_column("UserName")]
    pub name: String,
    pub active: bool,
}

let svc = SqlServiceFactory::new()
    .config_path("config.json")
    .build::<User>()
    .await?;

let token = tokio_util::sync::CancellationToken::new();
let user = svc.get_by_id(1, &token).await?;

Re-exports§

pub use cache::CacheLayer;
pub use cache::NoCache;
pub use cache::RedisCache;
pub use config::AppConfig;
pub use entity::SqlEntity;
pub use error::SqlError;
pub use factory::SqlServiceFactory;
pub use params::OdbcParam;
pub use params::ParamValue;
pub use params::PkValue;
pub use pool::Pool;
pub use repository::SqlRepository;
pub use row::OdbcRow;
pub use service::SqlService;
pub use sproc::FromResultSet;
pub use sproc::MultiReader;
pub use sproc::Required;
pub use sproc::Scalar;
pub use sproc::Single;
pub use sproc::SprocPagedResult;
pub use sproc::SprocParams;
pub use sproc::SprocResult;
pub use sproc::SprocService;
pub use transaction::Transaction;

Modules§

cache
config
entity
error
factory
logging
params
pool
query
repository
row
service
sproc
SprocService — Stored Procedure Execution Layer
transaction

Macros§

params
Tip-güvenli parametre slice’ı oluşturur — heap allocation yok.

Derive Macros§

SqlEntity
Derive macro that implements sqlservice::entity::SqlEntity for a struct.