sharding

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(mas []config.Mysql, sls []config.Mysql)

Types

type Mysql

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

func NewMysql

func NewMysql(isMaster bool) *Mysql

func (*Mysql) AddSharding

func (m *Mysql) AddSharding(key interface{}) *Mysql

func (*Mysql) BatchInsert

func (m *Mysql) BatchInsert(key interface{}, batch *ds.Batch) (int64, error)

func (*Mysql) Begin

func (m *Mysql) Begin() error

func (*Mysql) Commit

func (m *Mysql) Commit() error

func (*Mysql) Delete

func (m *Mysql) Delete(key interface{}, del *ds.Delete) (int64, error)

func (*Mysql) Exec

func (m *Mysql) Exec(key interface{}, statement string) error

func (*Mysql) FetchAll

func (m *Mysql) FetchAll(key interface{}, table string, where map[string]interface{}, t interface{}) ([]interface{}, error)

func (*Mysql) FetchAllByWhere added in v0.0.6

func (m *Mysql) FetchAllByWhere(key interface{}, table string, where *ds.Where, t interface{}) ([]interface{}, error)

func (*Mysql) FetchPage added in v0.0.6

func (m *Mysql) FetchPage(key interface{}, table string, where map[string]interface{}, t interface{}, page, pageSize int) ([]interface{}, error)

func (*Mysql) FetchPageByWhere added in v0.0.6

func (m *Mysql) FetchPageByWhere(key interface{}, table string, where *ds.Where, t interface{}, page, pageSize int) ([]interface{}, error)

func (*Mysql) FetchRow

func (m *Mysql) FetchRow(key interface{}, table string, where map[string]interface{}, t interface{}) (interface{}, error)

func (*Mysql) GetConnection

func (m *Mysql) GetConnection(key int) *db.Mysql

func (*Mysql) GetShardingKey

func (m *Mysql) GetShardingKey(key interface{}) int

func (*Mysql) Insert

func (m *Mysql) Insert(key interface{}, insert *ds.Insert) (int64, error)

func (*Mysql) Query

func (m *Mysql) Query(key interface{}, query string, t interface{}, args ...interface{}) ([]interface{}, error)

func (*Mysql) RollBack

func (m *Mysql) RollBack() error

func (*Mysql) Update

func (m *Mysql) Update(key interface{}, update *ds.Update) (int64, error)

Jump to

Keyboard shortcuts

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