Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbSetting ¶ added in v0.0.3
type DbSetting struct { Common *Common `yaml:"common"` MySql *MySqlSetting `yaml:"mysql"` Postgres *PostgresSetting `yaml:"postgres"` SqlServer *SqlServerSetting `yaml:"sqlServer"` }
type MySqlConnection ¶
type MySqlPool ¶
type MySqlPool struct {
// contains filtered or unexported fields
}
var ( MySqlDsnFormat = "%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=True&loc=Local" MySqlPoolApp MySqlPool )
type MySqlSetting ¶ added in v0.0.2
type MySqlSetting struct { MaxOpenConns int `yaml:"maxOpenConns"` MaxIdleConns int `yaml:"maxIdleConns"` MaxLifetime int `yaml:"maxLifetime"` MaxIdleTime int `yaml:"maxIdleTime"` Rws bool `yaml:"rws"` Main *MySqlConnection `yaml:"main"` Sources map[string]*MySqlConnection `yaml:"sources"` Replicas map[string]*MySqlConnection `yaml:"replicas"` }
type PostgresConnection ¶ added in v0.0.8
type PostgresPool ¶ added in v0.0.8
type PostgresPool struct {
// contains filtered or unexported fields
}
var ( PostgresDsnFormat = "host=%s user=%s password=%s dbname=%s port=%d sslmode=%s TimeZone=%s" PostgresPoolApp PostgresPool )
func (*PostgresPool) Close ¶ added in v0.0.8
func (receiver *PostgresPool) Close() error
Close 关闭数据库链接
func (*PostgresPool) GetConn ¶ added in v0.0.8
func (receiver *PostgresPool) GetConn() *gorm.DB
GetMain 获取主数据库链接
func (PostgresPool) New ¶ added in v0.0.11
func (PostgresPool) New(dbSetting *DbSetting) *PostgresPool
New 实例化:postgres链接池
type PostgresSetting ¶ added in v0.0.8
type PostgresSetting struct { MaxOpenConns int `yaml:"maxOpenConns"` MaxIdleConns int `yaml:"maxIdleConns"` MaxLifetime int `yaml:"maxLifetime"` MaxIdleTime int `yaml:"maxIdleTime"` Main *PostgresConnection `yaml:"main"` }
type SqlServerConnection ¶ added in v0.0.8
type SqlServerPool ¶ added in v0.0.8
type SqlServerPool struct {
// contains filtered or unexported fields
}
var ( SqlServerDsnFormat = "sqlserver://%s:%s@%s:?%d?database=%s" SqlServerPoolApp SqlServerPool )
func (*SqlServerPool) Close ¶ added in v0.0.8
func (receiver *SqlServerPool) Close() error
Close 关闭数据库链接
func (*SqlServerPool) GetConn ¶ added in v0.0.8
func (receiver *SqlServerPool) GetConn() *gorm.DB
GetMain 获取主数据库链接
func (SqlServerPool) New ¶ added in v0.0.11
func (SqlServerPool) New(dbSetting *DbSetting) *SqlServerPool
New 实例化:sql server连接池
type SqlServerSetting ¶ added in v0.0.8
type SqlServerSetting struct { MaxOpenConns int `yaml:"maxOpenConns"` MaxIdleConns int `yaml:"maxIdleConns"` MaxLifetime int `yaml:"maxLifetime"` MaxIdleTime int `yaml:"maxIdleTime"` Main *SqlServerConnection `yaml:"main"` }
Click to show internal directories.
Click to hide internal directories.