Documentation ¶
Index ¶
- Constants
- func DeleteRows(ctx context.Context, db *sqlx.DB, tx *sqlx.Tx, table string, ...) (int64, error)
- func InsertRows(ctx context.Context, db *sqlx.DB, tx *sqlx.Tx, table string, rowFields []Field, ...) (int64, error)
- func SelectRows(ctx context.Context, db *sqlx.DB, tx *sqlx.Tx, table string, fields []Field, ...) error
- func TransactionHandler(ctx context.Context, db *sqlx.DB, txFunc func(*sqlx.Tx) error) (err error)
- func UpdateRows(ctx context.Context, db *sqlx.DB, tx *sqlx.Tx, table string, ...) (int64, error)
- type Client
- type Field
- type Option
- type Value
- type WhereClause
Constants ¶
View Source
const ( FieldID = Field("id") FieldUUID = Field("uuid") FieldCreateTime = Field("create_time") FieldUpdateTime = Field("last_update_time") FieldName = Field("name") FieldIsDeleted = Field("is_deleted") FieldDeleteTime = Field("deleted_time") FieldUser = Field("user") FieldType = Field("typ") )
Fields for mysql tables
Variables ¶
This section is empty.
Functions ¶
func DeleteRows ¶
func DeleteRows(ctx context.Context, db *sqlx.DB, tx *sqlx.Tx, table string, whereClause []WhereClause, ops ...Option) (int64, error)
DeleteRows is a util function to delete rows from a table
func InsertRows ¶
func InsertRows(ctx context.Context, db *sqlx.DB, tx *sqlx.Tx, table string, rowFields []Field, rowValues [][]Value, ops ...Option) (int64, error)
InsertRows is a util function to insert some rows into a table
func SelectRows ¶
func SelectRows(ctx context.Context, db *sqlx.DB, tx *sqlx.Tx, table string, fields []Field, whereClause []WhereClause, result interface{}, ops ...Option) error
SelectRows is a util function to select some rows from a table
func TransactionHandler ¶
TransactionHandler is a wrapper function for mysql transcations
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for mysql db
type Option ¶
type Option func(opt *options)
Option for MySQL Client
func WithMaxConnsCount ¶
WithMaxConnsCount set max conns count for MySQL Client
func WithMaxIdleConnsCount ¶
WithMaxIdleConnsCount set max idle conns count for MySQL Client
Click to show internal directories.
Click to hide internal directories.