db

package
v0.0.0-...-752a2b9 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 11 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	USERNAME = ""
	PASSWORD = ""
	NETWORK  = "tcp"
	SERVER   = "localhost"
	PORT     = 3306
	DATABASE = ""
	PREFIX   = "t_"
)

Variables

View Source
var (
	DB sql.DB
)

Functions

This section is empty.

Types

type DbConnection

type DbConnection struct {
	DB       *sql.DB
	DbPrefix string
	DbName   string
	Config   map[string]string
}

创建连接器

func (*DbConnection) Connt

func (DbConnection *DbConnection) Connt(cnt *map[string]interface{})

type DbQuery

type DbQuery struct {
	Wher        string //[]map[string]string
	Joinn       string
	Wherestring string

	DB     *sql.DB
	Rows   interface{}
	Row    interface{}
	Prefix string
	sync.RWMutex
	// contains filtered or unexported fields
}

构建查询器

func (*DbQuery) Alias

func (sqlstruct *DbQuery) Alias(alias string)

func (*DbQuery) Analyticwhere

func (sqlstruct *DbQuery) Analyticwhere(structName interface{})

func (*DbQuery) Builder

func (sqlstruct *DbQuery) Builder(dbConnection *DbConnection)

func (*DbQuery) Clearquery

func (sqlstruct *DbQuery) Clearquery()

func (*DbQuery) Count

func (sqlstruct *DbQuery) Count()

func (*DbQuery) CreateDBTx

func (sqlstruct *DbQuery) CreateDBTx() (context.Context, *sql.Tx, error)

func (*DbQuery) Del

func (sqlstruct *DbQuery) Del()

func (*DbQuery) Field

func (sqlstruct *DbQuery) Field(field string)

func (*DbQuery) Find

func (sqlstruct *DbQuery) Find(args ...interface{}) *sql.Rows

func (*DbQuery) GetField

func (sqlstruct *DbQuery) GetField() string

func (*DbQuery) GetGroup

func (sqlstruct *DbQuery) GetGroup() string

func (*DbQuery) GetLimit

func (sqlstruct *DbQuery) GetLimit() string

func (*DbQuery) GetOrder

func (sqlstruct *DbQuery) GetOrder() string

func (*DbQuery) GetRow

func (sqlstruct *DbQuery) GetRow(query *sql.Rows) map[string]string

func (*DbQuery) GetRows

func (sqlstruct *DbQuery) GetRows(query *sql.Rows) map[int]map[string]string

func (*DbQuery) GetSave

func (sqlstruct *DbQuery) GetSave() string

func (*DbQuery) Getjoin

func (sqlstruct *DbQuery) Getjoin() string

func (*DbQuery) Getwhere

func (sqlstruct *DbQuery) Getwhere() string

func (*DbQuery) Group

func (sqlstruct *DbQuery) Group(group string)

func (*DbQuery) Join

func (sqlstruct *DbQuery) Join(join string)

涉及线程安全,改用字符串

func (*DbQuery) Limit

func (sqlstruct *DbQuery) Limit(limit string)

func (*DbQuery) Order

func (sqlstruct *DbQuery) Order(order string)

func (*DbQuery) Save

func (sqlstruct *DbQuery) Save(save map[string]interface{}) sql.Result

func (*DbQuery) Select

func (sqlstruct *DbQuery) Select(args ...interface{}) *sql.Rows

func (*DbQuery) SelectSql

func (sqlstruct *DbQuery) SelectSql() string

func (*DbQuery) Table

func (sqlstruct *DbQuery) Table(table string)

func (*DbQuery) TxSave

func (sqlstruct *DbQuery) TxSave(ctx context.Context, tx *sql.Tx, save map[string]interface{}) (sql.Result, error)

事务写入

func (*DbQuery) TxUpdate

func (sqlstruct *DbQuery) TxUpdate(ctx context.Context, tx *sql.Tx, update map[string]interface{}, where ...interface{}) (sql.Result, error)

事务更新

func (*DbQuery) Update

func (sqlstruct *DbQuery) Update(update map[string]interface{}, where ...interface{}) sql.Result

func (*DbQuery) Where

func (sqlstruct *DbQuery) Where(wher string)

涉及线程安全,改用字符串

type Member

type Member struct {
	Member_mobile string `db:"member_mobile"`
}

Jump to

Keyboard shortcuts

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