mysql

package
v0.0.0-...-2b54507 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 23 Imported by: 23

Documentation

Index

Constants

View Source
const (
	OssConfigMissingSentence = "oss configuration is missing!"
	DBOpenErrorSentence      = "db.Open(): %q\n"
	TxOpenErrorSentence      = "tx.Open(): %q\n"
)
View Source
const (
	TableMessageQueue             = "ppm_mqs_message_queue"
	TableMessageQueueConsumer     = "ppm_mqs_message_queue_consumer"
	TableMessageQueueConsumerFail = "ppm_mqs_message_queue_consumer_fail"
)
View Source
const (
	TcId        = "id"
	TcIsDelete  = "is_delete"
	TcTopic     = "topic"
	TcGroupName = "group_name"
	TcMessageId = "message_id"
)

Variables

This section is empty.

Functions

func BatchInsert

func BatchInsert(obj Domain, objs []interface{}) error

func Close

func Close(conn sqlbuilder.Database, tx sqlbuilder.Tx)

func Generate

func Generate(savePath string, tables []string) error

func GetConnect

func GetConnect() (sqlbuilder.Database, error)

func GetFileSplit

func GetFileSplit() string

func InitSess

func InitSess() (sqlbuilder.Database, error)

func Insert

func Insert(obj Domain) error

func InsertReturnId

func InsertReturnId(obj Domain) (interface{}, error)

func IsExistByCond

func IsExistByCond(table string, cond db.Cond) (bool, error)

func Rollback

func Rollback(tx sqlbuilder.Tx)

func SelectAllByCond

func SelectAllByCond(table string, cond db.Cond, objs interface{}) error

func SelectAllByCondWithNumAndOrder

func SelectAllByCondWithNumAndOrder(table string, cond db.Cond, union *db.Union, page int, size int, order interface{}, objs interface{}) error

func SelectAllByCondWithPageAndOrder

func SelectAllByCondWithPageAndOrder(table string, cond db.Cond, union *db.Union, page int, size int, order interface{}, objs interface{}) (uint64, error)

func SelectById

func SelectById(table string, id interface{}, obj interface{}) error

func SelectByQuery

func SelectByQuery(query string, objs interface{}, args ...interface{}) error

func SelectCountByCond

func SelectCountByCond(table string, cond db.Cond) (uint64, error)

func SelectOneByCond

func SelectOneByCond(table string, cond db.Cond, obj interface{}) error

func TransBatchInsert

func TransBatchInsert(tx sqlbuilder.Tx, obj Domain, objs []interface{}) error

func TransInsert

func TransInsert(tx sqlbuilder.Tx, obj Domain) error

func TransInsertReturnId

func TransInsertReturnId(tx sqlbuilder.Tx, obj Domain) (interface{}, error)

func TransSelectAllByCond

func TransSelectAllByCond(tx sqlbuilder.Tx, table string, cond db.Cond, objs interface{}) error

func TransSelectAllByCondWithNumAndOrder

func TransSelectAllByCondWithNumAndOrder(tx sqlbuilder.Tx, table string, cond db.Cond, union *db.Union, page int, size int, order interface{}, objs interface{}) error

func TransSelectAllByCondWithPageAndOrder

func TransSelectAllByCondWithPageAndOrder(tx sqlbuilder.Tx, table string, cond db.Cond, union *db.Union, page int, size int, order interface{}, objs interface{}) (uint64, error)

func TransSelectById

func TransSelectById(tx sqlbuilder.Tx, table string, id interface{}, obj interface{}) error

func TransSelectByQuery

func TransSelectByQuery(tx sqlbuilder.Tx, query string, objs interface{}, args ...interface{}) error

func TransSelectCountByCond

func TransSelectCountByCond(tx sqlbuilder.Tx, table string, cond db.Cond) (uint64, error)

func TransSelectOneByCond

func TransSelectOneByCond(tx sqlbuilder.Tx, table string, cond db.Cond, obj interface{}) error

func TransUpdate

func TransUpdate(tx sqlbuilder.Tx, obj Domain) error

func TransUpdateSmart

func TransUpdateSmart(tx sqlbuilder.Tx, table string, id int64, upd Upd) error

func TransUpdateSmartWithCond

func TransUpdateSmartWithCond(tx sqlbuilder.Tx, table string, cond db.Cond, upd Upd) (int64, error)

func TransX

func TransX(txFunc func(tx sqlbuilder.Tx) error) error

func Update

func Update(obj Domain) error

func UpdateSmart

func UpdateSmart(table string, id int64, upd Upd) error

func UpdateSmartWithCond

func UpdateSmartWithCond(table string, cond db.Cond, upd Upd) (int64, error)

Types

type Domain

type Domain interface {
	TableName() string
}

type Hooks

type Hooks struct{}

Hooks satisfies the sqlhook.Hooks interface

func (*Hooks) After

func (h *Hooks) After(ctx context.Context, query string, args ...interface{}) (context.Context, error)

After hook will get the timestamp registered on the Before hook and print the elapsed time

func (*Hooks) Before

func (h *Hooks) Before(ctx context.Context, query string, args ...interface{}) (context.Context, error)

Before hook will print the query with it's args and return the context with the timestamp

type Upd

type Upd map[string]interface{}

Jump to

Keyboard shortcuts

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