Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// SQLGroupManager是GroupManager结构体的全局变量
SQLGroupManager = newGroupManager()
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client继承了*gorm.DB的所有方法, 详细的使用方法请参考: http://gorm.io/docs/connecting_to_the_database.html
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func NewGroup ¶
func NewGroup(d SQLGroupConfig) (*Group, error)
NewGroup初始化一个Group, 一个Group包含一个master实例和零个或多个slave实例
type GroupManager ¶
type GroupManager struct {
// contains filtered or unexported fields
}
GroupManager提供了Add和Get操作, 用于管理Group
func (*GroupManager) Get ¶
func (gm *GroupManager) Get(name string) *Group
func (*GroupManager) PartitionBy ¶
func (gm *GroupManager) PartitionBy(partiton func() (bool, string, string)) *Client
Click to show internal directories.
Click to hide internal directories.