Documentation
¶
Index ¶
- Variables
- func Create[T any](log zerolog.Logger, con sq.BaseRunner, table string, req T, returning []string, ...) (id int, err error)
- func CreateMany[T any](log zerolog.Logger, con sq.BaseRunner, table string, reqs []T, ...) (ids []int, err error)
- func Delete(log zerolog.Logger, con sq.BaseRunner, table string, where []string) (err error)
- func ExistM(log zerolog.Logger, con *sqlx.DB, table string, where map[string]any) (ret bool, err error)
- func ExistS(log zerolog.Logger, con *sqlx.DB, table string, where []string) (bool, error)
- func GetM[T any](log zerolog.Logger, con *sqlx.DB, table string, where map[string]any) (ret T, err error)
- func GetManyM[T any](log zerolog.Logger, con *sqlx.DB, table string, where map[string]any, ...) (ret []T, err error)
- func GetManyS[T any](log zerolog.Logger, con *sqlx.DB, table string, where []string, ...) (ret []T, err error)
- func GetS[T any](log zerolog.Logger, con *sqlx.DB, table string, where []string) (ret T, err error)
- func ListFlex[T any](log zerolog.Logger, con *sqlx.DB, page util.Page, table string, ...) (ret []T, total int, err error)
- func ListM[T any](log zerolog.Logger, con *sqlx.DB, page util.Page, table string, ...) (ret []T, total int, err error)
- func ListS[T any](log zerolog.Logger, con *sqlx.DB, page util.Page, table string, ...) (ret []T, total int, err error)
- func NewDB(dbName, url string, dcfg DBConfig) *sqlx.DB
- func SetActive(log zerolog.Logger, con *sqlx.DB, table string, id int, active bool) (err error)
- func SetDelete(log zerolog.Logger, con *sqlx.DB, table string, id int, del bool) (err error)
- func UpdateM(log zerolog.Logger, con sq.BaseRunner, table string, where map[string]any, ...) (err error)
- func UpdateMore(log zerolog.Logger, con sq.BaseRunner, table string, ids []int, ...) (err error)
- func UpdateS(log zerolog.Logger, con sq.BaseRunner, table string, where []string, ...) (err error)
- func UpdateWithID(log zerolog.Logger, con sq.BaseRunner, table string, id int, ...) (err error)
- func UpsertManyNoPartition[T any](log zerolog.Logger, con sq.BaseRunner, table string, pks []string, tag string, ...) (err error)
- type DBConfig
- type PartitionFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var Psql = squirrel.StatementBuilder.PlaceholderFormat(squirrel.Dollar)
Functions ¶
func Create ¶
func Create[T any](log zerolog.Logger, con sq.BaseRunner, table string, req T, returning []string, partitionFunc PartitionFunc) (id int, err error)
func CreateMany ¶
func CreateMany[T any](log zerolog.Logger, con sq.BaseRunner, table string, reqs []T, returning []string, partitionFunc PartitionFunc) (ids []int, err error)
func UpdateMore ¶
func UpdateWithID ¶
Types ¶
type DBConfig ¶
type DBConfig struct {
MaxOpenConn int
MaxIdelConn int
ConnMaxIdleTime time.Duration
ConnMaxLifetime time.Duration
}
func (*DBConfig) SetDefault ¶
func (d *DBConfig) SetDefault()
type PartitionFunc ¶
type PartitionFunc func(runner sq.BaseRunner, table string) error
Click to show internal directories.
Click to hide internal directories.