Crate pgbatis

Source

Re-exports§

pub use plugin::logic_delete::LogicDelete;
pub use plugin::logic_delete::LogicDeletePlugin;
pub use wrapper::Wrapper;
pub use pgmacro;
pub use tokio_postgres;

Modules§

plugin
unit
wrapper

Structs§

Client
An asynchronous PostgreSQL client.
NoTls
A MakeTlsConnect and TlsConnect implementation which simply returns an error.
PageHash
PageT
Pgbatis
Row
A row of data returned from the database by a query.
TransactionBatchParam

Constants§

LOG_SPACE

Traits§

ColumnExt
Parameters
ToSql
A trait for types that can be converted into Postgres values.

Functions§

check_row_by_column
check_row_wrap
execute
fetch
通过一个字段执行删除操作 1、需要定义一个 trait fetch_result{} 用于赋值返回值与 新增修改的宏 进行分离 主要目的需要查询数据库数据回来进行计算的业务。定义返回值,单表使用比较多 fetch(wrapper) -> Result<Vec, Error> 单表不翻页 完成 fetch_one(wrapper) ->Result<T, Error> 单表单条数据 fetch_page(wrapper) ->Result<PageT<>, Error> 单表翻页 2、返回值定义Vec<HashMap<String,Value>> ,好处就是不需要定义返回值的结构体,可以根据需求调整sql的返回值,直接rep. query(&sql,&[args])->Result<Vec<HashMap<String,Value>>, Error> 主要用于联合查询,统计查询 query_one(&sql,&[args])->Result<HashMap<String,Value>,Error> 联合查询单条数据 query_page(&[返回字段],SQL,&[args])->Result<PageHash<HashMap<String,Value>>,Error> 联合查询进行翻页 统计查询 单表不翻页
fetch_one
fetch_one(wrapper) ->Result<T, Error> 单表单条数据
fetch_page
fetch_with_recoder_field
format_like
字符串左右新增百分号
format_like_left
字符串左新增百分号
format_like_right
字符串左新增百分号
link
query
query_one
query_page
query_t
remove
通过唯一ID执行删除操作
save
执行保存操作,执行insert操作
set_unlogic_delete_table
设置无逻辑删除的表
transaction_batch
事务 批量更新/新增 ,不同的表
transaction_delete_and_save
事务新增 用于按指定ID批量删除,然后批量新增
update
执行更新操作,执行update操作