Documentation ¶
Index ¶
- Constants
- func BuildDelete(dbName ...string) iBuildDeleteReturn
- func BuildInsert(dbName ...string) iBuildInsertReturn
- func BuildQuery(dbName ...string) iBuildQueryReturn
- func BuildUpdate(dbName ...string) iBuildUpdateReturn
- func Close()
- func WithConnMaxLifetime(ConnMaxLifetime int) dbConfigParam
- func WithConnParams(ConnParams string) dbConfigParam
- func WithDataSourceName(DataSource string) dbConfigParam
- func WithEnableMigrate(EnableMigrate bool) dbConfigParam
- func WithHost(Host string) dbConfigParam
- func WithMaxIdleConns(MaxIdleConns int) dbConfigParam
- func WithMaxOpenConns(MaxOpenConns int) dbConfigParam
- func WithMigrateDir(MigrateDir string) dbConfigParam
- func WithPassword(Password string) dbConfigParam
- func WithPort(Port string) dbConfigParam
- func WithSchema(Schema string) dbConfigParam
- func WithUserName(UserName string) dbConfigParam
- type Column
- type DBConfig
- type DBExec
- func (p *DBExec) Delete(sqlBuilder iSQLBuilder) ([]map[string]interface{}, error)
- func (p *DBExec) Exec(sqlBuilder iSQLBuilder) ([]map[string]interface{}, error)
- func (p *DBExec) Insert(sqlBuilder iSQLBuilder) ([]map[string]interface{}, error)
- func (p *DBExec) Select(sqlBuilder iSQLBuilder) ([]map[string]interface{}, error)
- func (p *DBExec) Update(sqlBuilder iSQLBuilder) ([]map[string]interface{}, error)
- type Having
- type JoinType
- type Mysql
- func (p *Mysql) After(optType dbOptType, rawResult []map[string]interface{}) (result interface{}, err error)
- func (p *Mysql) Before(optType dbOptType, sqlBuilder iSQLBuilder) (string, []interface{})
- func (p *Mysql) Do(optType dbOptType, sql string, val []interface{}) (result []map[string]interface{}, err error)
- func (p *Mysql) SqlDB() *sql.DB
- type On
- type Order
- type Pgsql
- func (p *Pgsql) After(optType dbOptType, rawResult []map[string]interface{}) (result interface{}, err error)
- func (p *Pgsql) Before(optType dbOptType, sqlBuilder iSQLBuilder) (string, []interface{})
- func (p *Pgsql) Do(optType dbOptType, sql string, val []interface{}) (result []map[string]interface{}, err error)
- func (p *Pgsql) SqlDB() *sql.DB
- type QueryFunc
- type Table
- type Where
Constants ¶
View Source
const ( // MYSQL mysql MYSQL dbType = iota // PGSQL postgresql PGSQL )
View Source
const ( // Insert Insert Insert dbOptType = "INSERT INTO " // Delete Delete Delete dbOptType = "DELETE FROM " // Update Update Update dbOptType = "UPDATE " // Select Select Select dbOptType = "SELECT " )
View Source
const ( // COUNT select count COUNT queryType = " COUNT" // SUM select sum SUM queryType = " SUM" // MAX select max MAX queryType = " MAX" // MIN select min MIN queryType = " MIN" // AVG select avg AVG queryType = " AVG" )
View Source
const ( // EQ = EQ logicalOptType = " = " // GT > GT logicalOptType = " > " // LT < LT logicalOptType = " < " // GE >= GE logicalOptType = " >= " // LE <= LE logicalOptType = " <= " // NE <> NE logicalOptType = " <> " // LIKE like LIKE logicalOptType = " LIKE " // IN in IN logicalOptType = " IN " // IsNULL is null IsNULL logicalOptType = " IS NULL " // NotNULL is not null NotNULL logicalOptType = " IS NOT NULL " )
View Source
const ( // AND AND AND whereGroupType = " AND " // OR OR OR whereGroupType = " OR " // GroupStart ( GroupStart whereGroupType = " ( " // GroupEnd ) GroupEnd whereGroupType = " ) " )
View Source
const ( // DESC DESC DESC orderType = " DESC " // ASC ASC ASC orderType = " ASC " )
Variables ¶
This section is empty.
Functions ¶
func WithConnMaxLifetime ¶
func WithConnMaxLifetime(ConnMaxLifetime int) dbConfigParam
WithConnMaxLifetime set schema option
func WithConnParams ¶
func WithConnParams(ConnParams string) dbConfigParam
WithConnParams set schema option
func WithDataSourceName ¶
func WithDataSourceName(DataSource string) dbConfigParam
WithDataSourceName set data source name option
func WithEnableMigrate ¶
func WithEnableMigrate(EnableMigrate bool) dbConfigParam
WithEnableMigrate set schema option
func WithMaxIdleConns ¶
func WithMaxIdleConns(MaxIdleConns int) dbConfigParam
WithMaxIdleConns set schema option
func WithMaxOpenConns ¶
func WithMaxOpenConns(MaxOpenConns int) dbConfigParam
WithMaxOpenConns set schema option
func WithMigrateDir ¶
func WithMigrateDir(MigrateDir string) dbConfigParam
WithMigrateDir set schema option
func WithPassword ¶
func WithPassword(Password string) dbConfigParam
WithPassword set password option
func WithUserName ¶
func WithUserName(UserName string) dbConfigParam
WithUserName set username option
Types ¶
type DBConfig ¶
type DBConfig struct { DataSource string UserName string Password string Host string Port string Schema string ConnParams string MaxOpenConns int MaxIdleConns int ConnMaxLifetime int EnableMigrate bool MigrateDir string }
DBConfig db config struct
func NewMysqlConfig ¶
func NewMysqlConfig(params ...dbConfigParam) *DBConfig
NewMysqlConfig create new mysql config
func NewPgsqlConfig ¶
func NewPgsqlConfig(params ...dbConfigParam) *DBConfig
NewPgsqlConfig create pgsql config
type DBExec ¶
type DBExec struct {
// contains filtered or unexported fields
}
DBExec db executor
type Pgsql ¶
type Pgsql struct {
Mysql
}
Click to show internal directories.
Click to hide internal directories.