Documentation ¶
Index ¶
- Variables
- func CheckErr(err error) error
- func InitDatabase(config BaseConfig) (err error)
- func InitOrm(config BaseConfig) (err error)
- func RegisterDataBase(init bool, aliasName, driverName, dataSource string, params ...orm.DBOption) (err error)
- func RegisterDatabase(config BaseConfig) (err error)
- func RegisterDriver(driver Driver) (err error)
- func RegisterModels(models ...interface{})
- type BaseConfig
- type Driver
- type DriverType
- type MysqlConfig
- type OrmContext
- type Pager
- type PostgresConfig
- type SqliteConfig
- type TxContext
Constants ¶
This section is empty.
Variables ¶
View Source
var DriverMysql = Driver{"mysql", orm.DRMySQL}
View Source
var DriverOracle = Driver{"oracle", orm.DROracle}
View Source
var DriverPostgres = Driver{"postgres", orm.DRPostgres}
View Source
var DriverSqlite = Driver{"sqlite3", orm.DRSqlite}
View Source
var DriverTiDB = Driver{"tidb", orm.DRTiDB}
Functions ¶
func InitDatabase ¶ added in v1.2.0
func InitDatabase(config BaseConfig) (err error)
func InitOrm ¶
func InitOrm(config BaseConfig) (err error)
func RegisterDataBase ¶ added in v1.2.0
func RegisterDatabase ¶ added in v1.2.1
func RegisterDatabase(config BaseConfig) (err error)
func RegisterDriver ¶ added in v1.2.0
func RegisterModels ¶ added in v1.2.0
func RegisterModels(models ...interface{})
Types ¶
type BaseConfig ¶
type BaseConfig struct {
// contains filtered or unexported fields
}
func (*BaseConfig) MaxConn ¶ added in v1.1.1
func (b *BaseConfig) MaxConn(n int)
func (*BaseConfig) MaxIdle ¶ added in v1.1.1
func (b *BaseConfig) MaxIdle(n int)
func (*BaseConfig) RegisterModel ¶
func (b *BaseConfig) RegisterModel(models ...interface{})
type MysqlConfig ¶
type MysqlConfig struct { InitDb bool AliasName string UserName string Password string Host string Port int MaxIdle int MaxConn int DbName string }
func (*MysqlConfig) Build ¶
func (c *MysqlConfig) Build() (b BaseConfig)
type OrmContext ¶
func New ¶ added in v1.1.0
func New() *OrmContext
func NewOrm ¶ added in v1.2.0
func NewOrm(aliasName string) *OrmContext
func (*OrmContext) Transaction ¶
func (o *OrmContext) Transaction(h func(TxContext) error) (err error)
type PostgresConfig ¶
type PostgresConfig struct { InitDb bool AliasName string UserName string Password string Host string Port int DbName string MaxIdle int MaxConn int SSL string }
func (*PostgresConfig) Build ¶
func (c *PostgresConfig) Build() (b BaseConfig)
type SqliteConfig ¶
func (*SqliteConfig) Build ¶
func (c *SqliteConfig) Build() (b BaseConfig)
Click to show internal directories.
Click to hide internal directories.