Expand description
Database schema and ORM for zino.
§Supported database drivers
The following optional features are available:
| Feature flag | Description | Default? |
|---|---|---|
orm-mariadb | Enables the MariaDB database driver. | No |
orm-mysql | Enables the MySQL database driver. | No |
orm-postgres | Enables the PostgreSQL database driver. | No |
orm-sqlite | Enables the SQLite database driver. | No |
orm-tidb | Enables the TiDB database driver. | No |
§Mappings of Rust data types
| Rust type | MySQL datatype | PostgreSQL datatype | SQLite datatype |
|---|---|---|---|
bool | BOOLEAN | BOOLEAN | BOOLEAN |
i8 | TINYINT | SMALLINT | INTEGER |
u8 | TINYINT UNSIGNED | SMALLINT | INTEGER |
i16 | SMALLINT | SMALLINT | INTEGER |
u16 | SMALLINT UNSIGNED | SMALLINT | INTEGER |
i32, Option<i32> | INT | INT, SERIAL | INTEGER |
u32, Option<u32> | INT UNSIGNED | INT, SERIAL | INTEGER |
i64, Option<i64>, isize | BIGINT | BIGINT, BIGSERIAL | INTEGER |
u64, Option<u64>, usize | BIGINT UNSIGNED | BIGINT, BIGSERIAL | INTEGER |
f32 | FLOAT | REAL | REAL |
f64 | DOUBLE | DOUBLE PRECISION | REAL |
Decimal | NUMERIC | NUMERIC | TEXT |
String, Option<String> | TEXT, VARCHAR(255) | TEXT | TEXT |
Date, NaiveDate | DATE | DATE | DATE |
Time, NaiveTime | TIME | TIME | TIME |
DateTime | TIMESTAMP(6) | TIMESTAMPTZ | DATETIME |
NaiveDateTime | DATETIME(6) | TIMESTAMP | DATETIME |
Uuid, Option<Uuid> | CHAR(36), UUID | UUID | TEXT |
Vec<u8> | BLOB | BYTEA | BLOB |
Vec<i32>, Vec<u32> | JSON | INT[] | TEXT |
Vec<i64>, Vec<u64> | JSON | BIGINT[] | TEXT |
Vec<f32> | JSON | REAL[] | TEXT |
Vec<f64> | JSON | DOUBLE PRECISION[] | TEXT |
Vec<String> | JSON | TEXT[] | TEXT |
Vec<UUID> | JSON | UUID[] | TEXT |
Map | JSON | JSONB | TEXT |
Structs§
- Connection
Pool - A database connection pool with metadata.
- Derived
Column - A column computed dynamically based on other columns or expressions.
- Global
Pool - Global access to the shared connection pools.
- JoinOn
- SQL joins on two tables.
- Mutation
Builder - A mutation builder for the model entity.
- Query
Builder - A query builder for the model entity.
- Window
- SQL window functions.
Enums§
- Aggregation
- SQL aggregate expressions.
Traits§
- Decode
Row - A collection of values that can be decoded from a single row.
- Encode
Column - Encoding a column to be sent to the database.
- Entity
- An interface for the model entity.
- Executor
- Executing queries against the database.
- Into
SqlValue - A generic interface for converting into SQL values.
- Model
Accessor - Access model fields.
- Model
Column - An interface for the model column.
- Model
Helper - Helper utilities for models.
- Pool
Manager - A manager of the connection pool.
- Primary
Key - An interface for the primary key.
- Scalar
Query orm-sqlx - Query on scalar values.
- Schema
- Database schema.
- Transaction
- An in-progress database transaction.
Functions§
- decode
orm-sqlx - Decodes a single value as
Tfor the field in a row. - decode_
array orm-sqlx - Decodes a single value as
Vec<T>for the field in a row. - decode_
decimal orm-sqlx - Decodes a single value as
Decimalfor the field in a row. - decode_
optional orm-sqlx - Decodes a single value as
Tfor the field in a row, returningNoneif it was not found. - decode_
uuid orm-sqlx - Decodes a single value as
Uuidfor the field in a row.
Type Aliases§
- Database
Connection - SQLite database connection.
- Database
Driver - SQLite database driver.
- Database
Pool - SQLite database pool.
- Database
Row - A single row from the SQLite database.