db

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLDB added in v1.0.12

type MySQLDB struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

func MySQLConnect added in v1.0.12

func MySQLConnect(UseDataBases string) (*MySQLDB, error)

连接 MySQL 数据库

func (*MySQLDB) Count added in v1.2.0

func (mysqlDB *MySQLDB) Count() (int, error)

返回查询条数数量

func (*MySQLDB) Delete added in v1.0.12

func (mysqlDB *MySQLDB) Delete() (sql.Result, error)

删除数据,返回操作条数

func (*MySQLDB) Execute added in v1.0.12

func (mysqlDB *MySQLDB) Execute(query string, args ...interface{}) (sql.Result, error)

执行语句

func (*MySQLDB) Fields added in v1.0.12

func (mysqlDB *MySQLDB) Fields(fields ...string) *MySQLDB

设置查询字段

func (*MySQLDB) First added in v1.0.12

func (mysqlDB *MySQLDB) First(queryResult interface{}) error

返回第一条数据

func (*MySQLDB) Insert added in v1.0.12

func (mysqlDB *MySQLDB) Insert(ModelData model.MySQLModel) (sql.Result, error)

插入数据库

func (*MySQLDB) Migrate added in v1.3.1

func (mysqlDB *MySQLDB) Migrate(db_name string, model model.MySQLModel)

模型迁移

func (*MySQLDB) Name added in v1.0.12

func (mysqlDB *MySQLDB) Name() string

获取数据库别名

func (*MySQLDB) OrderBy added in v1.2.0

func (mysqlDB *MySQLDB) OrderBy(orders ...string) *MySQLDB

排序

func (*MySQLDB) Page added in v1.2.0

func (mysqlDB *MySQLDB) Page(page int, pagesize int) (int, int, error)

排序

func (*MySQLDB) Query added in v1.0.12

func (mysqlDB *MySQLDB) Query(query string, args ...interface{}) (*sql.Rows, error)

查询语句

func (*MySQLDB) Select added in v1.0.12

func (mysqlDB *MySQLDB) Select(queryResult interface{}) error

执行查询语句获取数据

func (*MySQLDB) SetModel added in v1.0.12

func (mysqlDB *MySQLDB) SetModel(model model.MySQLModel) *MySQLDB

设置使用模型

func (*MySQLDB) Update added in v1.0.12

func (mysqlDB *MySQLDB) Update(ModelData model.MySQLModel) (sql.Result, error)

更新数据,返回操作条数

func (*MySQLDB) Where added in v1.0.12

func (mysqlDB *MySQLDB) Where(query string, args ...interface{}) *MySQLDB

查询语句

type SQLite3DB added in v1.0.12

type SQLite3DB struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

func SQLite3Connect added in v1.0.12

func SQLite3Connect(UseDataBases string) (*SQLite3DB, error)

连接 SQLite3 数据库

func (*SQLite3DB) Count added in v1.2.0

func (sqlite3DB *SQLite3DB) Count() (int, error)

返回查询条数数量

func (*SQLite3DB) Delete added in v1.0.12

func (sqlite3DB *SQLite3DB) Delete() (sql.Result, error)

删除数据,返回操作条数

func (*SQLite3DB) Execute added in v1.0.12

func (sqlite3DB *SQLite3DB) Execute(query string, args ...interface{}) (sql.Result, error)

执行语句

func (*SQLite3DB) Fields added in v1.0.12

func (sqlite3DB *SQLite3DB) Fields(fields ...string) *SQLite3DB

设置查询字段

func (*SQLite3DB) First added in v1.0.12

func (sqlite3DB *SQLite3DB) First(queryResult interface{}) error

返回第一条数据

func (*SQLite3DB) Insert added in v1.0.12

func (sqlite3DB *SQLite3DB) Insert(ModelData model.SQLite3Model) (sql.Result, error)

插入数据库

func (*SQLite3DB) Migrate added in v1.3.1

func (sqlite3DB *SQLite3DB) Migrate(db_name string, model model.SQLite3Model)

模型迁移

func (*SQLite3DB) Name added in v1.0.12

func (sqlite3DB *SQLite3DB) Name() string

获取数据库别名

func (*SQLite3DB) OrderBy added in v1.2.0

func (sqlite3DB *SQLite3DB) OrderBy(orders ...string) *SQLite3DB

排序

func (*SQLite3DB) Page added in v1.2.0

func (sqlite3DB *SQLite3DB) Page(page int, pagesize int) (int, int, error)

排序

func (*SQLite3DB) Query added in v1.0.12

func (sqlite3DB *SQLite3DB) Query(query string, args ...interface{}) (*sql.Rows, error)

查询语句

func (*SQLite3DB) Select added in v1.0.12

func (sqlite3DB *SQLite3DB) Select(queryResult interface{}) error

执行查询语句获取数据

func (*SQLite3DB) SetModel added in v1.0.12

func (sqlite3DB *SQLite3DB) SetModel(model model.SQLite3Model) *SQLite3DB

设置使用模型

func (*SQLite3DB) Update added in v1.0.12

func (sqlite3DB *SQLite3DB) Update(ModelData model.SQLite3Model) (sql.Result, error)

更新数据,返回操作条数

func (*SQLite3DB) Where added in v1.0.12

func (sqlite3DB *SQLite3DB) Where(query string, args ...interface{}) *SQLite3DB

查询语句

Jump to

Keyboard shortcuts

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