Versions in this module Expand all Collapse all v1 v1.0.1 May 18, 2023 v1.0.0 May 13, 2023 Changes in this version + func CountWhere(model interface{}, psql string, param ...interface{}) (count int64) + func CreateInBatches(model interface{}, count int) (RowsAffected int64, err error) + func Escape(val interface{}) string + func EscapeInLocation(val interface{}, loc *time.Location) string + func Exec(psql string, param ...interface{}) (RowsAffected int64, err error) + func FindOne(dest interface{}, cond ...interface{}) + func FindOneByCond(dest interface{}, cond interface{}) + func FindOneWhere(dest interface{}, psql string, param ...interface{}) + func FindWhere(dest interface{}, psql string, param ...interface{}) + func FormatInLocation(query string, loc *time.Location, args ...interface{}) string + func GetDB() *sql.DB + func Raw(dest interface{}, psql string, param ...interface{}) + func Save(model interface{}) (RowsAffected int64, err error) + func SaveByFields(model interface{}, fields ...string) (RowsAffected int64, err error) + func Scan(rows *sql.Rows, dest interface{}) error + func ScanResult(rows *sql.Rows, dest interface{}) error + func ScanSlice(rows *sql.Rows, dest interface{}) error + func SetSingleQuoteEscaper(escaper string) + func TableCount(table string) (count int64) + func Updates(model interface{}, data map[string]interface{}) (RowsAffected int64, err error) + type Client struct + Clients map[string]*DB + Configs ClientConfig + func Open(configs ClientConfig, log *zap.Logger) (*Client, error) + func (client *Client) Close() error + func (client *Client) CreateClient(database string) (db *DB, err error) + func (client *Client) Use(database string) (db *DB) + type ClientConfig struct + Clients map[string]interface{} + Default map[string]interface{} + type ClientDSN interface + GetDSN func(config map[string]interface{}) string + type Config struct + ConnMaxLifetime int + Driver Driver + Enabled bool + MaxIdleConnection int + MaxOpenConnection int + URL string + type DB struct + LogSQL bool + func (db *DB) Begin() (*Trans, error) + func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Trans, error) + func (db *DB) Exec(query string, args ...interface{}) (sql.Result, error) + func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + func (db *DB) Init(conf Config, logger *zap.Logger) + func (db *DB) Query(query string, args ...interface{}) *RowsResult + func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) *RowsResult + func (db *DB) QueryRow(query string, args ...interface{}) *RowResult + func (db *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *RowResult + func (db *DB) RawDB() *sql.DB + type DelStatus int8 + const Deleted + const Undeleted + func (delStatus DelStatus) String() string + type Driver int32 + const MariaDB + const MySQL + const PgSQL + func (driver Driver) String() string + type Mssql struct + func (mssql *Mssql) GetDSN(config map[string]interface{}) string + type Mysql struct + func (mysql *Mysql) GetDSN(config map[string]interface{}) string + func (mysql *Mysql) Init(c Config) (err error) + type Orm struct + func (orm *Orm) Init(tablePrefix string, logger *zap.Logger) + type RowResult struct + LastError error + func (r *RowResult) Err() error + func (r *RowResult) Scan(dest interface{}) error + type RowsResult struct + LastError error + func (r *RowsResult) Close() error + func (r *RowsResult) Raw() (*sql.Rows, error) + func (r *RowsResult) Scan(dest interface{}) error + type SQL struct + func (sql SQL) Format(query string, args ...interface{}) string + type Trans struct + DB *DB + TransactionID string + func (tx *Trans) Commit() error + func (tx *Trans) Exec(query string, args ...interface{}) (sql.Result, error) + func (tx *Trans) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + func (tx *Trans) Query(query string, args ...interface{}) *RowsResult + func (tx *Trans) QueryContext(ctx context.Context, query string, args ...interface{}) *RowsResult + func (tx *Trans) QueryRow(query string, args ...interface{}) *RowResult + func (tx *Trans) QueryRowContext(ctx context.Context, query string, args ...interface{}) *RowResult + func (tx *Trans) Rollback() error