Documentation ¶
Index ¶
- Constants
- func DB() *gorm.DB
- func GetAutoSliceDB(db *gorm.DB, userId int64, sf SP) *gorm.DB
- func InitQpsDB(limit int, interval time.Duration)
- func OpenMysqlDB(dbType string, dbUrl string, config *gorm.Config, ...) (instance *gorm.DB, err error)
- func QpsDB() *gorm.DB
- func SetMainDB(main *gorm.DB, DSN string)
- type Consistent
- type SP
Constants ¶
View Source
const ( EmptyVal = "" PartOnlyOne = 1 )
View Source
const ( // MYSQL dbType MYSQL = "mysql" // PG dbType PG = "postgres" )
Variables ¶
This section is empty.
Functions ¶
func GetAutoSliceDB ¶ added in v1.2.6
GetAutoSliceDB 获取自动分表
Types ¶
type Consistent ¶ added in v1.4.6
type Consistent struct { //虚拟节点个数,用来增加hash的平衡性 VirtualNode int //map 读写锁 sync.RWMutex // contains filtered or unexported fields }
Consistent 创建结构体保存一致性hash信息
func NewConsistent ¶ added in v1.4.6
func NewConsistent() *Consistent
NewConsistent 创建一致性hash算法结构体,设置默认节点数量
func (*Consistent) Get ¶ added in v1.4.6
func (c *Consistent) Get(name string) (string, error)
Get 根据数据标示获取最近的服务器节点信息
func (*Consistent) Remove ¶ added in v1.4.6
func (c *Consistent) Remove(element string)
Remove 删除一个节点
Click to show internal directories.
Click to hide internal directories.