Enum br_db::Db

source ·
pub enum Db {
    None,
}

Variants§

§

None

Implementations§

source§

impl Db

source

pub fn new(conf: JsonValue) -> Db

source

pub fn connection(&mut self, name: &str) -> Db

Trait Implementations§

source§

impl Clone for Db

source§

fn clone(&self) -> Db

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Db

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Mode for Db

source§

fn order(&mut self, field: &str, by: bool) -> &mut Self

排序

  • field 排序字段
  • by 排序方法 true 降序 false 升序
source§

fn inc(&mut self, field: &str, num: f64) -> &mut Self

自增

source§

fn dec(&mut self, field: &str, num: f64) -> &mut Self

自减

source§

fn database_create(&mut self, name: &str) -> bool

创建数据库
source§

fn table_create(&mut self, data: Table) -> JsonValue

source§

fn table_update(&mut self, data: Table) -> JsonValue

source§

fn table_info(&mut self, table: &str) -> JsonValue

获取表信息
source§

fn table_is_exist(&mut self, name: &str) -> bool

判断表是否存在
source§

fn table(&mut self, name: &str) -> &mut Self

当前表
source§

fn autoinc(&mut self) -> &mut Self

主键自增
source§

fn fetch_sql(&mut self) -> &mut Self

返回sql语句
source§

fn group(&mut self, field: &str) -> &mut Self

分组
source§

fn distinct(&mut self) -> &mut Self

消除重复记录
source§

fn json(&mut self, field: &str) -> &mut Self

JSON 字段
source§

fn column(&mut self, field: &str) -> JsonValue

查询指定列并返回数组
source§

fn where_and( &mut self, field: &str, compare: &str, value: JsonValue ) -> &mut Self

查询
source§

fn where_or( &mut self, field: &str, compare: &str, value: JsonValue ) -> &mut Self

source§

fn where_column( &mut self, field_a: &str, compare: &str, field_b: &str ) -> &mut Self

比较两个列
source§

fn count(&mut self) -> JsonValue

总数量
source§

fn max(&mut self, field: &str) -> JsonValue

最大值
source§

fn min(&mut self, field: &str) -> JsonValue

最小值
source§

fn sum(&mut self, field: &str) -> JsonValue

合计
source§

fn avg(&mut self, field: &str) -> JsonValue

平均值
source§

fn select(&mut self) -> JsonValue

获取集合
source§

fn find(&mut self) -> JsonValue

获取单记录
source§

fn value(&mut self, field: &str) -> JsonValue

获取单一列值
source§

fn insert(&mut self, data: JsonValue) -> JsonValue

添加
source§

fn insert_all(&mut self, data: JsonValue) -> JsonValue

批量添加
source§

fn page(&mut self, page: i32, limit: i32) -> &mut Self

分页
source§

fn update(&mut self, data: JsonValue) -> JsonValue

更新
source§

fn delete(&mut self) -> JsonValue

删除
source§

fn field(&mut self, name: &str) -> &mut Self

显示字段
source§

fn hidden(&mut self, name: &str) -> &mut Self

隐藏字段
source§

fn transaction(&mut self) -> bool

事务开始
source§

fn commit(&mut self) -> bool

事务提交
source§

fn rollback(&mut self) -> bool

事务回滚
source§

fn sql(&mut self, sql: &str) -> JsonValue

sql语句执行

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.