_sql

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 12 Imported by: 0

README

type Machine struct {
	Driver    string `json:"driver"`
	Host      string `json:"host"`
	Port      string `json:"port"`
	Database  string `json:"database"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Charset   string `json:"charset"`
	Collation string `json:"collation"`
}
type Master struct {
	Count       int        `json:"count"`
	MachineList []*Machine `json:"machine_list"`
}
type Slave struct {
	Count       int        `json:"count"`
	MachineList []*Machine `json:"machine_list"`
}
type Cluster struct {
	Master *Master
	Slave  *Slave
}
type Business struct {
	Count       int        `json:"count"`
	ClusterList []*Cluster `json:"cluster_list"`
}

var Conf map[string]*Business

_sql组件仅上线底层数据库操作,所需要的信息,比如配置machine,表table,均由上层计算后传入
比如分库分表等,需要在上层进行计算,最终的到machine和table,传入,执行

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Business

type Business struct {
	Count       int        `json:"count"`
	ClusterList []*Cluster `json:"cluster_list"`
}

type Cluster

type Cluster struct {
	Master *Master
	Slaver *Slaver
}

type Machine

type Machine struct {
	Driver    string `json:"driver"`
	Host      string `json:"host"`
	Port      string `json:"port"`
	Database  string `json:"database"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Charset   string `json:"charset"`
	Collation string `json:"collation"`
}

type Master

type Master struct {
	Count       int        `json:"count"`
	MachineList []*Machine `json:"machine_list"`
}

type Slaver

type Slaver struct {
	Count       int        `json:"count"`
	MachineList []*Machine `json:"machine_list"`
}

type Sql

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

func New

func New() *Sql

func (*Sql) Add

func (this *Sql) Add() int64

func (*Sql) AddList

func (this *Sql) AddList() int64

func (*Sql) BeginTransaction

func (this *Sql) BeginTransaction() *sql.Tx

func (*Sql) Commit

func (this *Sql) Commit()

func (*Sql) Count

func (this *Sql) Count() int64

func (*Sql) Del

func (this *Sql) Del() int64

func (*Sql) Driver

func (this *Sql) Driver(driver string) *Sql

func (*Sql) Dsn

func (this *Sql) Dsn(dsn string) *Sql

func (*Sql) Execute

func (this *Sql) Execute() int64

func (*Sql) Field

func (this *Sql) Field(field string) *Sql

func (*Sql) Get

func (this *Sql) Get() map[string]string

func (*Sql) GetList

func (this *Sql) GetList() []map[string]string

func (*Sql) Group

func (this *Sql) Group(group string) *Sql

func (*Sql) Index

func (this *Sql) Index(index string) *Sql

func (*Sql) Limit

func (this *Sql) Limit(limit int) *Sql

func (*Sql) Machine

func (this *Sql) Machine(machine *Machine) *Sql

func (*Sql) MachineMaster

func (this *Sql) MachineMaster(machineMaster *Machine) *Sql

func (*Sql) MachineSlaver

func (this *Sql) MachineSlaver(machineSlaver *Machine) *Sql

func (*Sql) Master

func (this *Sql) Master(master bool) *Sql

func (*Sql) Offset

func (this *Sql) Offset(offset int) *Sql

func (*Sql) Order

func (this *Sql) Order(order string) *Sql

func (*Sql) Parameter

func (this *Sql) Parameter(parameter ...interface{}) *Sql

func (*Sql) Query

func (this *Sql) Query() []map[string]string

func (*Sql) Rollback

func (this *Sql) Rollback()

func (*Sql) Row

func (this *Sql) Row(row map[string]interface{}) *Sql

func (*Sql) RowList

func (this *Sql) RowList(rowList []map[string]interface{}) *Sql

func (*Sql) Set

func (this *Sql) Set() int64

func (*Sql) Sql

func (this *Sql) Sql(sql string) *Sql

func (*Sql) Table

func (this *Sql) Table(table string) *Sql

func (*Sql) Tx

func (this *Sql) Tx(tx *sql.Tx) *Sql

func (*Sql) Where

func (this *Sql) Where(where string) *Sql

Jump to

Keyboard shortcuts

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