mysql

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializationDb

func InitializationDb(conf *define.DatabaseConf) *sql.DB

InitializationDb 初始化Db

func NewDb

func NewDb(tx *sql.Tx, db *sql.DB) define.Db

NewDb 新的Db操作

Types

type Db

type Db struct {
	// contains filtered or unexported fields
}

func (*Db) AndWhere

func (c *Db) AndWhere(str string, arg ...any) define.Db

AndWhere 条件语句

func (*Db) Args

func (c *Db) Args(arg ...any) define.Db

Args 替换值

func (*Db) ColumnInt64

func (c *Db) ColumnInt64() []int64

ColumnInt64 获取列整形

func (*Db) ColumnString

func (c *Db) ColumnString() []string

ColumnString 获取列字符串

func (*Db) Count

func (c *Db) Count() int64

Count 条件总数

func (*Db) Delete

func (c *Db) Delete() (int64, error)

Delete 删除数据

func (*Db) Field

func (c *Db) Field(field ...string) define.Db

Field 字段名

func (*Db) GetDb

func (c *Db) GetDb() *sql.DB

GetDb 获取Db

func (*Db) GetTx

func (c *Db) GetTx() *sql.Tx

GetTx 获取Tx

func (*Db) GroupBy

func (c *Db) GroupBy(groupBy ...string) define.Db

GroupBy 分组操作

func (*Db) InnerJoin

func (c *Db) InnerJoin(str, on string) define.Db

InnerJoin 内连接

func (*Db) Insert

func (c *Db) Insert() (int64, error)

Insert 插入数据

func (*Db) Join

func (c *Db) Join(opt, str, on string) define.Db

Join 连接操作

func (*Db) LeftJoin

func (c *Db) LeftJoin(str, on string) define.Db

LeftJoin 左连接

func (*Db) OffsetLimit

func (c *Db) OffsetLimit(offset, limit int64) define.Db

OffsetLimit 限制行数

func (*Db) OrWhere

func (c *Db) OrWhere(str string, arg ...any) define.Db

OrWhere 并且条件语句

func (*Db) OrderBy

func (c *Db) OrderBy(orderBy ...string) define.Db

OrderBy 排序操作

func (*Db) Query

func (c *Db) Query(rowsFn func(rows *sql.Rows))

Query 多条数据查询

func (*Db) QueryRow

func (c *Db) QueryRow(rowFn func(row *sql.Row))

QueryRow 单条数据查询

func (*Db) RightJoin

func (c *Db) RightJoin(str, on string) define.Db

RightJoin 右连接

func (*Db) SqlExec

func (c *Db) SqlExec(s string, args []any) (sql.Result, error)

SqlExec 语句执行

func (*Db) SqlQuery

func (c *Db) SqlQuery(s string, args []any, rowsFn func(rows *sql.Rows))

SqlQuery 多条数据查询

func (*Db) SqlQueryRow

func (c *Db) SqlQueryRow(s string, args []any, rowFn func(row *sql.Row))

SqlQueryRow 单条数据查询

func (*Db) Table

func (c *Db) Table(name string) define.Db

Table 设置表名

func (*Db) Update

func (c *Db) Update() (int64, error)

Update 更新数据

func (*Db) Value

func (c *Db) Value(val ...string) define.Db

Value 字段值

func (*Db) Where

func (c *Db) Where(opt string, str string, arg ...any) define.Db

Where 条件

Jump to

Keyboard shortcuts

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