Module db

Module db 

Source
Available on crate feature db only.
Expand description

Database support along with migration engine and ORM.

This module contains the database connection structure, the model trait, and the error types that can occur when interacting with the database.

Modules§

impl_mysqlmysql
Database interface implementation – MySQL backend.
impl_postgrespostgres
Database interface implementation – PostgreSQL backend.
impl_sqlitesqlite
Database interface implementation – SQLite backend.
migrations
Database migrations.
query
Database query builder.

Macros§

query

Structs§

Column
A column structure that holds the name of the column and some additional schema information.
Database
A database connection structure that holds the connection to the database.
Identifier
An identifier structure that holds table or column name as a string.
LimitedString
A wrapper over a string that has a limited length.
NewLimitedStringError
An error returned by LimitedString::new when the string is longer than the specified limit.
RowsNum
A structure that holds the number of rows.
StatementResult
Result of a statement execution.

Enums§

Auto
A wrapper over a value that can be either a fixed value or be automatically generated by the database.
ColumnType
A type that represents a column type in the database.
DatabaseError
An error that can occur when interacting with the database.
DbFieldValue
Represents a value for a field in the database.
ForeignKey
A foreign key to another model.
ForeignKeyOnDeletePolicy
A foreign key on delete constraint.
ForeignKeyOnUpdatePolicy
A foreign key on update constraint.
Row
A row structure that holds the data of a single row retrieved from the database.

Traits§

DatabaseBackend
A trait that provides a backend for the database.
DatabaseField
A trait denoting that some type can be used as a field in a database.
FromDbValue
A trait for converting a database value to a Rust value.
Model
A model trait for database models.
PrimaryKey
A marker trait that denotes that a type can be used as a primary key in a database.
SqlxValueRef
A trait for accessing raw database values from a specific database backend. This provides low-level access to database-specific value references.
ToDbFieldValue
A generalization of ToDbValue that can also return a marker that means a value should be automatically generated by the database.
ToDbValue
A trait for converting a Rust value to a database value.

Type Aliases§

DbValue
An alias for the value type internally used by the sea_query crate.
Result
An alias for Result that uses DatabaseError as the error type.

Attribute Macros§

model
Implement the Model trait for a struct.