backend_node

package
v0.0.0-...-b4c1251 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseNodeList

func ParseNodeList(cfgList []config.NodeConfig, schemaName string) (map[string]*Node, error)

Types

type Node

type Node struct {
	Master *backend.DB

	sync.RWMutex
	SlaveList        []*backend.DB
	DownAfterNoAlive time.Duration

	Cfg    config.NodeConfig
	DbName string
	Online bool
}

func ParseNode

func ParseNode(cfg config.NodeConfig, schemaName string) (*Node, error)

func (*Node) Execute

func (n *Node) Execute(command string, fromSlave bool, args ...interface{}) (*mysql.Result, error)

func (*Node) GetDb

func (n *Node) GetDb(fromSlave bool) *backend.DB

func (*Node) GetMasterDb

func (n *Node) GetMasterDb() (*backend.DB, error)

func (*Node) GetSlaveConn

func (n *Node) GetSlaveConn() (*backend.DB, error)

func (*Node) ParseMaster

func (n *Node) ParseMaster(masterStr string) error

func (*Node) ParseSlave

func (n *Node) ParseSlave(slaveList []string) error

ParseSlave slaveStr(127.0.0.1:3306@2,192.168.0.12:3306@3)

func (*Node) String

func (n *Node) String() string

func (*Node) UseDb

func (n *Node) UseDb(dbName string) error

Jump to

Keyboard shortcuts

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