Skip to main content

Crate rustlavel_db

Crate rustlavel_db 

Source
Expand description

rustlavel-db: the database package.

A PostgreSQL driver written directly on the version 3 wire protocol, a connection pool, a query builder, schema migrations, and seeding. Enabled with cargo add rustlavel-db — an application that never adds it never compiles a line of this.

Re-exports§

pub use builder::Direction;
pub use builder::QueryBuilder;
pub use config::DatabaseConfig;
pub use dialect::ColumnType;
pub use dialect::Dialect;
pub use dialect::ReturningStyle;
pub use driver::Driver;
pub use driver::DriverConnection;
pub use driver::QueryResult;
pub use connections::Connections;
pub use connections::DEFAULT_BUDGET;
pub use migration::Faker;
pub use migration::Migration;
pub use migration::Migrator;
pub use migration::Seeder;
pub use model::Model;
pub use model::ModelExt;
pub use model::belongs_to;
pub use model::has_many;
pub use mysql::MySqlConnection;
pub use mysql::MySqlDriver;
pub use pagination::CursorPage;
pub use pagination::Page;
pub use postgres::connection::log_bindings;
pub use postgres::connection::set_log_bindings;
pub use pool::Pool;
pub use pool::PooledConnection;
pub use schema::Schema;
pub use schema::Table;
pub use sqlserver::SqlServerConnection;
pub use sqlserver::SqlServerDriver;
pub use row::Row;
pub use row::rows_to_json;
pub use value::FromValue;
pub use value::Value;

Modules§

base64
Base64, needed by SCRAM authentication.
builder
The query builder — DB::table("users").where(...).get() in Rust.
config
Connection settings, from a URL or from the application’s configuration.
connections
Named database connections, and one budget across all of them.
credentials
Credentials that change while the process is running.
dialect
What differs between one SQL database and another.
driver
The contract every database driver implements.
migration
Migrations and seeding.
model
The ORM: #[derive(Model)] plus the active-record methods it unlocks.
mysql
The MySQL driver, implemented directly on the client/server wire protocol.
pagination
Pagination.
pool
The connection pool.
postgres
The PostgreSQL driver, implemented directly on the version 3 wire protocol.
prelude
What a migration, seeder, or model file imports.
random
Random bytes, for SCRAM nonces.
row
A result row.
schema
The schema builder — what a migration writes.
sqlserver
The SQL Server driver, implemented directly on TDS 7.4.
tls
TLS for the drivers that negotiate it over a plain socket.
value
The values that cross the database boundary.

Macros§

migration
Define a migration without writing the pinned-future boilerplate.

Structs§

Database
The application’s handle on the database.
Transaction
An open transaction, holding its connection until it ends.

Enums§

Error
Every failure the framework itself can produce.

Functions§

quote_identifier
Quote an identifier after validating it.
validate_identifier
Reject anything that is not a plain identifier.

Type Aliases§

Result
The framework-wide result type.

Derive Macros§

Model
#[derive(Model)]. Derive Model for a struct with named fields.