xmysql

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCanNotPrepared = errors.New("can't prepare in condition")
)

Functions

func ErrNoRowsFilter

func ErrNoRowsFilter(err error) error

过滤sql.ErrNoRows错误

func GetAddSQLFromObj

func GetAddSQLFromObj(tableName string, o interface{}, addType string) string

func GetColumnListExpressionFromObj

func GetColumnListExpressionFromObj(o interface{}) exp.ColumnListExpression

GetColumnListExpressionFromObj 根据对象获取goqu的字段表达式

func GetColumnsArrayFromObj

func GetColumnsArrayFromObj(o interface{}) []string

GetColumnsFromObj2 获取所有字段数组

func GetColumnsArrayInterfaceFromObj

func GetColumnsArrayInterfaceFromObj(o interface{}) []interface{}

GetColumnsFromObj2 获取所有字段数组

func GetColumnsFromObj

func GetColumnsFromObj(o interface{}) string

GetColumnsFromObj 获取所有字段

func GetInsertSQLFromObj

func GetInsertSQLFromObj(tableName string, o interface{}) string

GetInsertSQLFromObj 获取插入语句

func GetReplaceInsertSQLFromObj

func GetReplaceInsertSQLFromObj(tableName string, o interface{}) string

func GetSqlSelect

func GetSqlSelect(o interface{}, table string) string

获取查询语句

func HasOptLockUpdateSuccess

func HasOptLockUpdateSuccess(result sql.Result, err error) error

判断乐观锁是否更新成功

func MysqlDialect

func MysqlDialect() *goqu.DialectWrapper

Types

type Repository

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

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

func (*Repository) Close added in v1.4.2

func (r *Repository) Close()

func (*Repository) Exec

func (r *Repository) Exec(sqlStr string, args ...interface{}) (sql.Result, error)

func (*Repository) ExecNamed

func (r *Repository) ExecNamed(sqlStr string, args interface{}) (sql.Result, error)

func (*Repository) Get

func (r *Repository) Get(sqlStr string, obj interface{}, args ...interface{}) error

func (*Repository) Select

func (r *Repository) Select(sqlStr string, obj interface{}, args ...interface{}) error

type StmtDB

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

func NewStmtDB

func NewStmtDB(db *sqlx.DB) *StmtDB

func (*StmtDB) Close added in v1.4.2

func (r *StmtDB) Close()

func (*StmtDB) DB

func (r *StmtDB) DB() *sqlx.DB

func (*StmtDB) Exec

func (r *StmtDB) Exec(sqlStr string, args []interface{}) (sql.Result, error)

func (*StmtDB) ExecNamed

func (r *StmtDB) ExecNamed(sqlStr string, args interface{}) (sql.Result, error)

func (*StmtDB) Get

func (r *StmtDB) Get(sqlStr string, obj interface{}, args []interface{}) error

func (*StmtDB) GetNamedStmt

func (r *StmtDB) GetNamedStmt(sqlPrepared string) (*sqlx.NamedStmt, error)

func (*StmtDB) GetStmt

func (r *StmtDB) GetStmt(sqlPrepared string) (*sqlx.Stmt, error)

func (*StmtDB) Select

func (r *StmtDB) Select(sqlStr string, obj interface{}, args []interface{}) error

Jump to

Keyboard shortcuts

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