data

package
v1.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package data @Description: 该文件来源于https://github.com/FloatTech/ZeroBot-Plugin/blob/master/data/sqlite.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sqlite

type Sqlite struct {
	DB     *sql.DB
	DBPath string
}

Sqlite 数据库对象

func (*Sqlite) Count

func (db *Sqlite) Count(table string) (num int, err error)

Count 查询数据库行数 返回行数以及错误

func (*Sqlite) Create

func (db *Sqlite) Create(table string, objptr interface{}) (err error)

Create 生成数据库 默认结构体的第一个元素为主键 返回错误

func (*Sqlite) Del

func (db *Sqlite) Del(table string, condition string) (err error)

Del 删除数据库 condition 可为"WHERE id = 0" 返回错误

func (*Sqlite) Find

func (db *Sqlite) Find(table string, objptr interface{}, condition string) (err error)

Find 查询数据库 condition 可为"WHERE id = 0" 默认字段与结构体元素顺序一致 返回错误

func (*Sqlite) Insert

func (db *Sqlite) Insert(table string, objptr interface{}) (err error)

Insert 插入数据集 默认结构体的第一个元素为主键 返回错误

func (*Sqlite) ListTables

func (db *Sqlite) ListTables() (s []string, err error)

ListTables 列出所有表名 返回所有表名+错误

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL