package
Version:
v0.0.2
Opens a new window with list of versions in this module.
Published: May 26, 2020
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Documentation
¶
Package db to manage database
type DB struct {
*sql.DB
}
DB 定制的sql数据库
func (db *DB) GetRows(queryStatement string, StructPtr interface{}) ([]interface{}, error)
GetRows 描述了从数据库中查询的过程
func (db *DB) GetValues(statement string, dest ...interface{}) error
GetValues 获取查询语句的多个值
在dest存放变量的指针
NOTICE: dest中变量的指针的顺序,需要与statement中查询的一样
func (db *DB) Insert(insertStatement string, data interface{}) error
Insert 描述了向DB内插入数据的过程
type DBer interface {
Name() string
Insert(statement string, data interface{}) error
GetRows(statement string, structPtr interface{}) ([]interface{}, error)
GetValues(statement string, dest ...interface{}) error
}
DBer 是定制数据库的接口
Source Files
¶
Click to show internal directories.
Click to hide internal directories.