sql

package
v1.2.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package sql 数据库/数据处理相关工具

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) error

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

func (*Sqlite) Find

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

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

func (*Sqlite) Insert

func (db *Sqlite) Insert(table string, objptr interface{}) 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