sql

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGroupManager = newGroupManager()

Functions

This section is empty.

Types

type Client

type Client struct {
	*gorm.DB
}

func PartitionBy

func PartitionBy(partiton func() (bool, string, string)) *Client

type Group

type Group struct {
	// contains filtered or unexported fields
}

func Get

func Get(name string) *Group

func NewGroup

func NewGroup(name string, master string, slaves []string) (*Group, error)

func (*Group) Instance

func (g *Group) Instance(isMaster bool) *Client

func (*Group) Master

func (g *Group) Master() *Client

func (*Group) Slave

func (g *Group) Slave() *Client

type GroupConfig

type GroupConfig struct {
	Name   string   `toml:"name"`
	Master string   `toml:"master"`
	Slaves []string `toml:"slaves"`
}

type GroupManager

type GroupManager struct {
	// contains filtered or unexported fields
}

func (*GroupManager) Add

func (gm *GroupManager) Add(name string, g *Group) error

func (*GroupManager) Get

func (gm *GroupManager) Get(name string) *Group

func (*GroupManager) PartitionBy

func (gm *GroupManager) PartitionBy(partiton func() (bool, string, string)) *Client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL