Skip to main content

Crate searepo

Crate searepo 

Source
Expand description

§Repository Pattern for SeaORM

通过派生宏自动为 Repository 结构体生成 CRUD 方法。

§基本用法

use searepo::{Repository, FindFilter, SearchFilter};

#[derive(Repository)]
#[repository(entity = "entities::user", domain = "User")]
pub struct UserRepository {
    db: Arc<DatabaseConnection>,
}

§功能选择

  • 默认:只生成 find + search 相关方法
  • all = true:生成所有方法
  • include = ["find", "insert"]:只生成指定功能
  • exclude = ["delete"]:排除指定功能

Re-exports§

pub use sea_orm::NotSet;
pub use sea_orm::Set;

Structs§

DatabaseConnection
Handle a database connection depending on the backend enabled by the feature flags. This creates a connection pool internally (for SQLx connections), and so is cheap to clone.
OnConflict
SearchResult
搜索结果封装
Select
Defines a structure to perform select operations

Enums§

ActiveValue
The state of a field in an [ActiveModel][ActiveModelTrait].
DbErr
An error from unsuccessful database operations
Pagination
分页策略

Traits§

ActiveModelTrait
ActiveModel is a type for constructing INSERT and UPDATE statements for a particular table.
ColumnTrait
API for working with a Column. Mostly a wrapper of the identically named methods in sea_query::Expr
DeleteFilter
删除过滤器 Trait
EntityTrait
An abstract base class for defining Entities.
FindFilter
单条查询过滤器 Trait
ModelTrait
The interface for Model, implemented by data structs
PaginatorTrait
A Trait for any type that can paginate results
QueryFilter
Perform a FILTER opertation on a statement
QueryOrder
Performs ORDER BY operations
QuerySelect
Abstract API for performing queries
SearchFilter
列表搜索过滤器 Trait
TransactionTrait
Spawn database transaction
Upsertable
Upsert 冲突处理策略 Trait

Derive Macros§

Repository
派生宏:为 Repository 结构体自动生成 CRUD 方法