Documentation ¶
Index ¶
- func Pagination(db *gorm.DB, page, size int) *gorm.DB
- type CbitSqlConnection
- type CbitSqlPool
- type CbitSqlSetting
- type Common
- type DbSetting
- type Dsn
- type GormPool
- type MySqlConnection
- type MySqlPool
- type MySqlSetting
- type PostgresConnection
- type PostgresPool
- type PostgresSetting
- type SqlServerConnection
- type SqlServerPool
- type SqlServerSetting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CbitSqlConnection ¶ added in v2.8.0
type CbitSqlPool ¶ added in v2.8.0
type CbitSqlPool struct {
// contains filtered or unexported fields
}
var ( // CbitSqlDsnFormat = "%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=True&loc=Local" CbitSqlDsnFormat = "%s:%d/%s?user=%s&password=%s" CbitSqlPoolApp CbitSqlPool )
func (*CbitSqlPool) GetConn ¶ added in v2.8.0
func (r *CbitSqlPool) GetConn() *gorm.DB
GetConn 获取主数据库链接
func (CbitSqlPool) Once ¶ added in v2.9.0
func (CbitSqlPool) Once(dbSetting *DbSetting) GormPool
Once 单例化:mysql链接池
type CbitSqlSetting ¶ added in v2.8.0
type CbitSqlSetting struct { Database string `yaml:"database"` Rws bool `yaml:"rws"` Main *MySqlConnection `yaml:"main"` Sources map[string]*CbitSqlConnection `yaml:"sources"` Replicas map[string]*CbitSqlConnection `yaml:"replicas"` }
type DbSetting ¶
type DbSetting struct { Common *Common `yaml:"common,omitempty"` MySql *MySqlSetting `yaml:"mysql,omitempty"` Postgres *PostgresSetting `yaml:"postgres,omitempty"` SqlServer *SqlServerSetting `yaml:"sqlServer,omitempty"` CbitSql *CbitSqlSetting `yaml:"cbitSql,omitempty"` }
var DbSet DbSetting
func (DbSetting) ExampleYaml ¶ added in v2.11.2
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 ¶
type MySqlSetting struct { Database string `yaml:"database"` Charset string `yaml:"charset"` Collation string `yaml:"collation"` Rws bool `yaml:"rws"` Main *MySqlConnection `yaml:"main"` Sources map[string]*MySqlConnection `yaml:"sources"` Replicas map[string]*MySqlConnection `yaml:"replicas"` }
type PostgresConnection ¶
type PostgresPool ¶
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) Once ¶ added in v2.9.0
func (PostgresPool) Once(dbSetting *DbSetting) GormPool
Once 单例化:postgres链接池
type PostgresSetting ¶
type PostgresSetting struct {
Main *PostgresConnection `yaml:"main"`
}
type SqlServerConnection ¶
type SqlServerPool ¶
type SqlServerPool struct {
// contains filtered or unexported fields
}
var ( SqlServerDsnFormat = "sqlserver://%s:%s@%s:?%d?database=%s" SqlServerPoolApp SqlServerPool )
func (SqlServerPool) Once ¶ added in v2.9.0
func (SqlServerPool) Once(dbSetting *DbSetting) GormPool
Once 单例化:sql server连接池
type SqlServerSetting ¶
type SqlServerSetting struct {
Main *SqlServerConnection `yaml:"main"`
}
Click to show internal directories.
Click to hide internal directories.