11 releases

0.1.10 Mar 25, 2025
0.1.9 Jan 13, 2025

#1219 in Database interfaces

Download history 666/week @ 2025-01-01 425/week @ 2025-01-08 49/week @ 2025-01-15 14/week @ 2025-02-05 24/week @ 2025-02-19 10/week @ 2025-02-26 1/week @ 2025-03-12 89/week @ 2025-03-19 49/week @ 2025-03-26

143 downloads per month
Used in taitan-orm

MIT/Apache

215KB
4.5K SLoC

作为Input的trait Entity特征用于insert操作

pub trait Entity<DB: Database> {
    // sql generation
    fn gen_insert_sql<'a>(&self)-> Cow<'a, str>;
    fn gen_upsert_sql<'a>(&self)-> Cow<'a, str>;
    fn gen_create_sql<'a>(&self)-> Cow<'a, str>;
    
    // sqlx arguments generation, create is same as insert
    fn add_insert_args(&self, args: &mut DB::Arguments<'_>);
    fn add_upsert_args(&self, args: &mut DB::Arguments<'_>);
    
    fn gen_insert_args(&self) -> DB::Arguments<'_>;
    fn gen_upsert_args(&self) -> DB::Arguments<'_>;
}

Mutation特征用于update操作

trait Mutation {
    fn update_sql();
    fn update_args();
}



trait Location {
    fn where_sql();
    fn where_args();
}
trait Unique {
    fn where_sql();
    fn where_args();
}
trait TemplateRecord {
    fn template_sql();
    fn template_args();
}

作为output的trait

trait Selected {}
trait Location {
    
}

Dependencies

~54MB
~1M SLoC