Edit docs
This commit is contained in:
parent
2413c9e0f2
commit
5f2fa55253
@ -4,7 +4,7 @@ use crate::{
|
||||
use futures::Stream;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
/// Creates constraints for any structure that wants to create a database connection
|
||||
/// Creates constraints for any structure that can create a database connection
|
||||
/// and execute SQL statements
|
||||
#[async_trait::async_trait]
|
||||
pub trait ConnectionTrait<'a>: Sync {
|
||||
|
@ -23,7 +23,7 @@ pub struct MockDatabaseConnection {
|
||||
mocker: Mutex<Box<dyn MockDatabaseTrait>>,
|
||||
}
|
||||
|
||||
/// A set of constraints for any type wanting to perform operations on the [MockDatabase]
|
||||
/// A Trait for any type wanting to perform operations on the [MockDatabase]
|
||||
pub trait MockDatabaseTrait: Send + Debug {
|
||||
/// Execute a statement in the [MockDatabase]
|
||||
fn execute(&mut self, counter: usize, stmt: Statement) -> Result<ExecResult, DbErr>;
|
||||
|
@ -76,12 +76,12 @@ where
|
||||
ActiveValue::unchanged(value)
|
||||
}
|
||||
|
||||
/// Enforces a set of constraints on any type performing an Create, Update or Delete operation.
|
||||
/// A Trait for ActiveModel to perform Create, Update or Delete operation.
|
||||
/// The type must also implement the [EntityTrait].
|
||||
/// See module level docs [crate::entity] for a full example
|
||||
#[async_trait]
|
||||
pub trait ActiveModelTrait: Clone + Debug {
|
||||
/// Enforce the type to the constraints of the [EntityTrait]
|
||||
/// The Entity this ActiveModel belongs to
|
||||
type Entity: EntityTrait;
|
||||
|
||||
/// Get a mutable [ActiveValue] from an ActiveModel
|
||||
@ -208,9 +208,7 @@ pub trait ActiveModelTrait: Clone + Debug {
|
||||
}
|
||||
}
|
||||
|
||||
/// Enforce a set of constraints to a override the ActiveModel behavior
|
||||
/// Behaviors for users to override.
|
||||
/// The type must also implement the [ActiveModelTrait]
|
||||
/// A Trait for overriding the ActiveModel behavior
|
||||
///
|
||||
/// ### Example
|
||||
/// ```ignore
|
||||
@ -265,7 +263,7 @@ pub trait ActiveModelBehavior: ActiveModelTrait {
|
||||
}
|
||||
}
|
||||
|
||||
/// Enforce constraints for conversion to an ActiveModel
|
||||
/// A Trait for any type that can be converted into an ActiveModel
|
||||
pub trait IntoActiveModel<A>
|
||||
where
|
||||
A: ActiveModelTrait,
|
||||
|
@ -13,7 +13,7 @@ pub trait IdenStatic: Iden + Copy + Debug + 'static {
|
||||
fn as_str(&self) -> &str;
|
||||
}
|
||||
|
||||
/// Enforces the naming of an entity to a set of constraints
|
||||
/// A Trait for mapping an Entity to a database table
|
||||
pub trait EntityName: IdenStatic + Default {
|
||||
/// Method to get the name for the schema, defaults to [Option::None] if not set
|
||||
fn schema_name(&self) -> Option<&str> {
|
||||
|
@ -6,7 +6,7 @@ use sea_query::{Alias, IntoIden, JoinType, SeaRc};
|
||||
/// Same as [RelationDef]
|
||||
pub type LinkDef = RelationDef;
|
||||
|
||||
/// A set of constraints for links between Entities
|
||||
/// A Trait for links between Entities
|
||||
pub trait Linked {
|
||||
#[allow(missing_docs)]
|
||||
type FromEntity: EntityTrait;
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
pub use sea_query::Value;
|
||||
use std::fmt::Debug;
|
||||
|
||||
/// A set of constraints for a Model
|
||||
/// A Trait for a Model
|
||||
pub trait ModelTrait: Clone + Send + Debug {
|
||||
#[allow(missing_docs)]
|
||||
type Entity: EntityTrait;
|
||||
@ -35,7 +35,7 @@ pub trait ModelTrait: Clone + Send + Debug {
|
||||
}
|
||||
}
|
||||
|
||||
/// A set of constraints for implementing a [QueryResult]
|
||||
/// A Trait for implementing a [QueryResult]
|
||||
pub trait FromQueryResult: Sized {
|
||||
/// Instantiate a Model from a [QueryResult]
|
||||
fn from_query_result(res: &QueryResult, pre: &str) -> Result<Self, DbErr>;
|
||||
|
@ -4,7 +4,7 @@ use sea_query::{FromValueTuple, IntoValueTuple};
|
||||
use std::fmt::Debug;
|
||||
|
||||
//LINT: composite primary key cannot auto increment
|
||||
/// A set of constraints to be used to define a Primary Key.
|
||||
/// A Trait for to be used to define a Primary Key.
|
||||
///
|
||||
/// A primary key can be derived manually
|
||||
///
|
||||
|
@ -159,7 +159,7 @@ where
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
/// Used to enforce constraints on any type that wants to paginate results
|
||||
/// A Trait for any type that can paginate results
|
||||
pub trait PaginatorTrait<'db, C>
|
||||
where
|
||||
C: ConnectionTrait<'db>,
|
||||
|
@ -31,7 +31,7 @@ where
|
||||
selector: S,
|
||||
}
|
||||
|
||||
/// Used to enforce constraints on any type that wants to perform SELECT queries
|
||||
/// A Trait for any type that can perform SELECT queries
|
||||
pub trait SelectorTrait {
|
||||
#[allow(missing_docs)]
|
||||
type Item: Sized;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{DbBackend, Statement};
|
||||
use sea_query::QueryStatementBuilder;
|
||||
|
||||
/// Enforces a set of constraints to any type performing queries on a Model or ActiveModel
|
||||
/// A Trait for any type performing queries on a Model or ActiveModel
|
||||
pub trait QueryTrait {
|
||||
/// Constrain the QueryStatement to [QueryStatementBuilder] trait
|
||||
type QueryStatement: QueryStatementBuilder;
|
||||
|
Loading…
x
Reference in New Issue
Block a user