pub trait DatabaseAdapter: Send + Sync {
Show 14 methods
// Required methods
fn create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
data: &'life3 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<DataValue>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn find_by_id<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Option<DataValue>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn find<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
options: &'life4 QueryOptions,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Vec<DataValue>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn find_with_groups<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
condition_groups: &'life3 [QueryConditionGroup],
options: &'life4 QueryOptions,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Vec<DataValue>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn update<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
data: &'life4 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn update_by_id<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
data: &'life4 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn delete_by_id<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn count<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn exists<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn create_table<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
fields: &'life3 HashMap<String, FieldType>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn create_index<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
index_name: &'life3 str,
fields: &'life4 [String],
unique: bool,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
fn table_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn drop_table<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}
Expand description
数据库适配器trait,定义统一的数据库操作接口
Required Methods§
Sourcefn create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
data: &'life3 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<DataValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
data: &'life3 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<DataValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
创建记录
Sourcefn find_by_id<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Option<DataValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn find_by_id<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Option<DataValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
根据ID查找记录
Sourcefn find<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
options: &'life4 QueryOptions,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Vec<DataValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn find<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
options: &'life4 QueryOptions,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Vec<DataValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
查找记录
Sourcefn find_with_groups<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
condition_groups: &'life3 [QueryConditionGroup],
options: &'life4 QueryOptions,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Vec<DataValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn find_with_groups<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
condition_groups: &'life3 [QueryConditionGroup],
options: &'life4 QueryOptions,
) -> Pin<Box<dyn Future<Output = QuickDbResult<Vec<DataValue>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
使用条件组合查找记录(支持OR逻辑)
Sourcefn update<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
data: &'life4 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn update<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
data: &'life4 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
更新记录
Sourcefn update_by_id<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
data: &'life4 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn update_by_id<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
data: &'life4 HashMap<String, DataValue>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
根据ID更新记录
Sourcefn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
删除记录
Sourcefn delete_by_id<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn delete_by_id<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
id: &'life3 DataValue,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
根据ID删除记录
Sourcefn count<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn count<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
统计记录数量
Sourcefn exists<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn exists<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
conditions: &'life3 [QueryCondition],
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
检查记录是否存在
Sourcefn create_table<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
fields: &'life3 HashMap<String, FieldType>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn create_table<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
fields: &'life3 HashMap<String, FieldType>,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
创建表/集合
Sourcefn create_index<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
index_name: &'life3 str,
fields: &'life4 [String],
unique: bool,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn create_index<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
index_name: &'life3 str,
fields: &'life4 [String],
unique: bool,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
创建索引
Sourcefn table_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn table_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
) -> Pin<Box<dyn Future<Output = QuickDbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
检查表是否存在
Sourcefn drop_table<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn drop_table<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
connection: &'life1 DatabaseConnection,
table: &'life2 str,
) -> Pin<Box<dyn Future<Output = QuickDbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
删除表/集合