Documentation ¶
Index ¶
- Constants
- func InitDbGormConnection(connStr string, poolSize int, dns utils.DNSClient) (*gorm.DB, error)
- type Config
- type DB
- func (d *DB) Close()
- func (d *DB) Exec(sql string, value ...interface{}) error
- func (d *DB) ExecWithTX(iLevel sql.IsolationLevel, sqlStr string, args ...interface{}) error
- func (d *DB) Mock(db *sql.DB)
- func (d *DB) Open(config *Config) error
- func (d *DB) OpenWithDSN(dsn string) error
- func (d *DB) Query(mapper func(row Row) (interface{}, error), sql string, args ...interface{}) ([]interface{}, error)
- func (d *DB) QueryMap(conv func(i interface{}) interface{}, sql string, args ...interface{}) ([]map[string]interface{}, error)
- func (d *DB) QueryRow(mapper func(row Row) (interface{}, error), sql string, args ...interface{}) (interface{}, error)
- func (d *DB) SetImpl(db *sql.DB)
- type Row
Constants ¶
View Source
const ExternalProto = "ext"
ExternalProto ...
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { User string Passwd string Net string Addr string DBName string Timeout time.Duration Params map[string]string }
Config ...
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB ...
func (*DB) ExecWithTX ¶
func (d *DB) ExecWithTX(iLevel sql.IsolationLevel, sqlStr string, args ...interface{}) error
ExecWithTX exec sql in transaction
func (*DB) OpenWithDSN ¶
OpenWithDSN open db connection with dsn string
func (*DB) Query ¶
func (d *DB) Query(mapper func(row Row) (interface{}, error), sql string, args ...interface{}) ([]interface{}, error)
Query ...
func (*DB) QueryMap ¶
func (d *DB) QueryMap(conv func(i interface{}) interface{}, sql string, args ...interface{}) ([]map[string]interface{}, error)
QueryMap ...
Click to show internal directories.
Click to hide internal directories.