pub enum Db {
None,
}
Variants§
None
Implementations§
Source§impl Db
impl Db
pub fn load(path: &str) -> Result<Db, String>
pub fn new(config: Config) -> Result<Db, String>
pub fn get_config_default(&mut self) -> String
pub fn get_config_list(&mut self) -> Vec<String>
pub fn connection(&mut self, name: &str) -> Db
Sourcepub fn connection_add(
&mut self,
config_name: &str,
connection: Connection,
) -> Db
pub fn connection_add( &mut self, config_name: &str, connection: Connection, ) -> Db
增加配置
Sourcepub fn table_create(&mut self, options: TableOptions) -> JsonValue
pub fn table_create(&mut self, options: TableOptions) -> JsonValue
具体功能
pub fn table_update(&mut self, options: TableOptions) -> JsonValue
pub fn table_info(&mut self, table: &str) -> JsonValue
pub fn table_is_exist(&mut self, name: &str) -> bool
pub fn table(&mut self, name: &str) -> &mut Self
pub fn change_table(&mut self, name: &str) -> &mut Self
pub fn autoinc(&mut self) -> &mut Self
pub fn fetch_sql(&mut self) -> &mut Self
Sourcepub fn order(&mut self, field: &str, by: bool) -> &mut Self
pub fn order(&mut self, field: &str, by: bool) -> &mut Self
排序
- field 排序字段
- by 排序方法 true 降序 false 升序
pub fn group(&mut self, field: &str) -> &mut Self
pub fn distinct(&mut self) -> &mut Self
pub fn json(&mut self, field: &str) -> &mut Self
pub fn column(&mut self, field: &str) -> JsonValue
pub fn where_and( &mut self, field: &str, compare: &str, value: JsonValue, ) -> &mut Self
pub fn where_or( &mut self, field: &str, compare: &str, value: JsonValue, ) -> &mut Self
pub fn where_column( &mut self, field_a: &str, compare: &str, field_b: &str, ) -> &mut Self
pub fn count(&mut self) -> JsonValue
pub fn max(&mut self, field: &str) -> JsonValue
pub fn min(&mut self, field: &str) -> JsonValue
pub fn sum(&mut self, field: &str) -> JsonValue
pub fn avg(&mut self, field: &str) -> JsonValue
pub fn select(&mut self) -> JsonValue
pub fn find(&mut self) -> JsonValue
pub fn value(&mut self, field: &str) -> JsonValue
pub fn insert(&mut self, data: JsonValue) -> JsonValue
pub fn insert_all(&mut self, data: JsonValue) -> JsonValue
pub fn page(&mut self, page: i32, limit: i32) -> &mut Self
pub fn update(&mut self, data: JsonValue) -> JsonValue
pub fn update_all(&mut self, data: JsonValue) -> JsonValue
pub fn get_connection(&mut self) -> Connection
pub fn database_tables(&mut self) -> JsonValue
pub fn database_create(&mut self, name: &str) -> bool
pub fn backups(&mut self, filename: &str) -> bool
pub fn delete(&mut self) -> JsonValue
pub fn field(&mut self, name: &str) -> &mut Self
pub fn transaction(&mut self) -> bool
pub fn commit(&mut self) -> bool
pub fn rollback(&mut self) -> bool
pub fn sql(&mut self, sql: &str) -> Result<JsonValue, String>
pub fn sql_execute(&mut self, sql: &str) -> Result<JsonValue, String>
pub fn buildsql(&mut self) -> String
Sourcepub fn join(
&mut self,
table: &str,
main_fields: &str,
right_fields: &str,
) -> &mut Self
pub fn join( &mut self, table: &str, main_fields: &str, right_fields: &str, ) -> &mut Self
连接
- table 表名
- field 本表关联字段名
Sourcepub fn join_inner(
&mut self,
table: &str,
main_fields: &str,
second_fields: &str,
) -> &mut Self
pub fn join_inner( &mut self, table: &str, main_fields: &str, second_fields: &str, ) -> &mut Self
内连接–用来取交集
- table 链表表名
- main_fields 主表字段
- second_fields 附表关联字段
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Db
impl RefUnwindSafe for Db
impl Send for Db
impl Sync for Db
impl Unpin for Db
impl UnwindSafe for Db
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more