Traits and Types
Entity
A unit struct that implements EntityTrait representing a table in the database.
This trait contains the properties of an entity including
- Table Name (implemented EntityName)
- Column (implemented ColumnTrait)
- Relation (implemented RelationTrait)
- Primary Key (implemented PrimaryKeyTraitandPrimaryKeyToColumn)
This trait also provides an API for CRUD actions
- Select: find,find_*
- Insert: insert,insert_*
- Update: update,update_*
- Delete: delete,delete_*
Column
An enum that implements ColumnTrait representing all columns of the table and the column types and attributes.
It also implements
- IdenStaticprovides mapping to column identifier with static lifetime
- Iterableallows SeaORM core to iterate over all column variants
Primary Key
An enum that implements PrimaryKeyTrait representing the primary key. Each primary key variant must have a corresponding column variant.
It also implements
- IdenStaticprovides mapping to primary key identifier with static lifetime
- Iterableallows SeaORM core to iterate over all primary key variants
Model
A struct that implements ModelTrait storing the query result in memory. This is intended for readonly purposes, and it is stateless.
It also implements
- FromQueryResultconverts raw query result into corresponding model
Active Model
A struct that implements ActiveModelTrait representing insert/update actions. This is intended to be edited and saved into database.
It also implements
- ActiveModelBehaviordefines handlers for different actions on an active model
Active Enum
A enum that implements ActiveEnum representing value stored in database as a Rust enum variant.
Relation
An enum that implements RelationTrait defined relations with other entities.
It also implements
- Iterableallows SeaORM core to iterate over all relation variants
Related
A generic trait, Related, defines join paths to help you query related entities together, especially helpful in many-to-many relations.
Linked
A trait, Linked, defines complex join paths including chained relation, self referencing relation and multiple relations between two entities.