Sqlite

Struct Sqlite 

Source
pub struct Sqlite {
    pub connection: Connection,
    pub default: String,
    pub params: Params,
}

Fields§

§connection: Connection

当前连接配置

§default: String

当前选中配置

§params: Params

Implementations§

Source§

impl Sqlite

Source

pub fn connect(connection: Connection, default: String) -> Result<Self, String>

Source

pub fn query(&mut self, sql: String) -> (bool, JsonValue)

Source

pub fn execute(&mut self, sql: String) -> (bool, JsonValue)

Trait Implementations§

Source§

impl Clone for Sqlite

Source§

fn clone(&self) -> Sqlite

Returns a duplicate 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 DbMode for Sqlite

Source§

fn database_tables(&mut self) -> JsonValue

数据库是否存在
Source§

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

创建数据库
Source§

fn backups(&mut self, _filename: &str) -> bool

备份
Source§

impl Debug for Sqlite

Source§

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

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

impl Mode for Sqlite

Source§

fn table_create(&mut self, options: TableOptions) -> JsonValue

Source§

fn table_update(&mut self, options: TableOptions) -> 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 Sqlite

当前表
Source§

fn change_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 order(&mut self, field: &str, by: bool) -> &mut Self

排序
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 location(&mut self, field: &str) -> &mut Self

location 字段
Source§

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

显示字段
Source§

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

隐藏字段
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 page(&mut self, page: i32, limit: i32) -> &mut Self

分页
Source§

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

查询指定列并返回数组
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 update(&mut self, data: JsonValue) -> JsonValue

更新
Source§

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

批量更新
Source§

fn delete(&mut self) -> JsonValue

删除
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) -> Result<JsonValue, String>

sql语句执行
Source§

fn sql_execute(&mut self, sql: &str) -> Result<JsonValue, String>

Source§

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

自增
Source§

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

自减
Source§

fn buildsql(&mut self) -> String

构造子查询
Source§

fn join( &mut self, table: &str, main_fields: &str, right_fields: &str, ) -> &mut Self

连结 Read more
Source§

fn join_inner( &mut self, table: &str, main_fields: &str, second_fields: &str, ) -> &mut Self

内连接–用来取交集 Read more

Auto Trait Implementations§

§

impl Freeze for Sqlite

§

impl RefUnwindSafe for Sqlite

§

impl Send for Sqlite

§

impl Sync for Sqlite

§

impl Unpin for Sqlite

§

impl UnwindSafe for Sqlite

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more