mysqllib

package
v0.0.0-...-2ec961a Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var G_dbtables map[string]interface{}
View Source
var G_fd_dict map[string]interface{}
View Source
var G_fd_list map[string]interface{}
View Source
var G_tb_dict map[string]interface{}

Functions

This section is empty.

Types

type MysqlIni

type MysqlIni struct {
	DbUser     string   `json:"db_user"`
	DbPassword string   `json:"db_password"`
	DbHost     string   `json:"db_host"`
	DbPort     string   `json:"db_port"`
	DbName     string   `json:"db_name"`
	DbMaxpool  int      `json:"db_maxpool"`
	DbMinpool  int      `json:"db_minpool"`
	DbPerfix   string   `json:"db_perfix"`
	Slavedb    []string `json:"slavedb"`
	Maxtime    int      `json:"maxtime"`
}
var G_MysqlIni MysqlIni

type Mysqlcon

type Mysqlcon struct {
	Masterdb    *sql.DB
	Slavedb     []*sql.DB
	Db_host     string
	Db_port     string
	Db_name     string
	Db_password string
	SqlTx       *sql.Tx
	Slock       sync.RWMutex
	Sql_param   []interface{}
	Tablename   string
	Sql_where   string
	Sql_order   string
	Sql_fields  string
	Sql_limit   string
	Db_perfix   string
	PRK_editfd  string
	Query_data  []map[string]interface{}
	Join_arr    map[string]string
	LastSqltext string
	ActionName  string
}
var G_Dbcon *Mysqlcon

func NewMySql_Server_DB

func NewMySql_Server_DB() *Mysqlcon

func NewMysqlDB

func NewMysqlDB(jsonstr string) *Mysqlcon

func (*Mysqlcon) BeginStart

func (that *Mysqlcon) BeginStart() bool

func (*Mysqlcon) Build_where

func (that *Mysqlcon) Build_where() (string, []interface{})

func (*Mysqlcon) CheckConnectStatus

func (that *Mysqlcon) CheckConnectStatus()

func (*Mysqlcon) Check_PK

func (that *Mysqlcon) Check_PK(fdname string) bool

func (*Mysqlcon) Check_data_fields

func (that *Mysqlcon) Check_data_fields(fieldname string) bool

func (*Mysqlcon) Commit

func (that *Mysqlcon) Commit()

func (*Mysqlcon) Count

func (that *Mysqlcon) Count() int64

func (*Mysqlcon) Dbinit

func (that *Mysqlcon) Dbinit()

* 初始化结构

func (*Mysqlcon) Delete

func (that *Mysqlcon) Delete() (sql.Result, error)

func (*Mysqlcon) Excute

func (that *Mysqlcon) Excute(sqltext string, param []interface{}) (sql.Result, error)

func (*Mysqlcon) Fileds

func (that *Mysqlcon) Fileds(name string) *Mysqlcon

func (*Mysqlcon) Find

func (that *Mysqlcon) Find() map[string]string

func (*Mysqlcon) GetLastSql

func (that *Mysqlcon) GetLastSql() string

func (*Mysqlcon) GetWherePostFrom

func (that *Mysqlcon) GetWherePostFrom(postdata map[string]interface{}, masterdb string) map[string]interface{}

func (*Mysqlcon) Get_fields_sql

func (that *Mysqlcon) Get_fields_sql(fd_name, val_name string) (result string)

func (*Mysqlcon) Get_mysql_dict

func (db *Mysqlcon) Get_mysql_dict(tbname string)

func (*Mysqlcon) Get_new_add

func (that *Mysqlcon) Get_new_add() map[string]string

func (*Mysqlcon) Get_read_dbcon

func (that *Mysqlcon) Get_read_dbcon() *sql.DB

func (*Mysqlcon) Get_select_data

func (that *Mysqlcon) Get_select_data(d_data map[string]string, masterdb string) map[string]string

func (*Mysqlcon) Get_where_data

func (that *Mysqlcon) Get_where_data(postdata map[string]interface{}) map[string]interface{}

func (*Mysqlcon) IMax

func (that *Mysqlcon) IMax(fd string) int64

func (*Mysqlcon) IMin

func (that *Mysqlcon) IMin(fd string) int64

func (*Mysqlcon) Init_Redis_Struct

func (that *Mysqlcon) Init_Redis_Struct()

func (*Mysqlcon) Insert

func (that *Mysqlcon) Insert(postdata map[string]interface{}) (sql.Result, error)

func (*Mysqlcon) Join

func (that *Mysqlcon) Join(tbname string, jointype string, where string, fileds string) *Mysqlcon

func (that *Mysqlcon) delete(fields ...string) (*Mysqlcon) { that.Tokens = append(that.Tokens, "SELECT", strings.Join(fields,","))

	return qb
}

func (*Mysqlcon) Limit

func (that *Mysqlcon) Limit(limitstr string) *Mysqlcon

func (*Mysqlcon) Max

func (that *Mysqlcon) Max(fd string) float64

func (*Mysqlcon) Merge_And_where

func (that *Mysqlcon) Merge_And_where(where_str, new_str string) string

func (*Mysqlcon) Merge_OR_where

func (that *Mysqlcon) Merge_OR_where(where_str, new_str string) string

func (*Mysqlcon) Min

func (that *Mysqlcon) Min(fd string) float64

func (*Mysqlcon) Order

func (that *Mysqlcon) Order(orderstr string) *Mysqlcon

func (*Mysqlcon) Query

func (that *Mysqlcon) Query(sqltext string, param []interface{}) []map[string]string

func (*Mysqlcon) Query_One

func (that *Mysqlcon) Query_One(sqltext string, param []interface{}) map[string]string

func (*Mysqlcon) Rollback

func (that *Mysqlcon) Rollback()

func (*Mysqlcon) Select

func (that *Mysqlcon) Select() []map[string]string

func (*Mysqlcon) SetDec

func (that *Mysqlcon) SetDec(fdname string, quantity int) (sql.Result, error)

func (*Mysqlcon) SetInc

func (that *Mysqlcon) SetInc(fdname string, quantity int) (sql.Result, error)

func (*Mysqlcon) SetPK

func (that *Mysqlcon) SetPK(pkfd string) *Mysqlcon

func (*Mysqlcon) SetWhere

func (that *Mysqlcon) SetWhere(where string, param ...interface{}) *Mysqlcon

func (*Mysqlcon) Sum

func (that *Mysqlcon) Sum(fd string) float64

func (*Mysqlcon) Tbname

func (that *Mysqlcon) Tbname(name string) *Mysqlcon

设置数据表

func (*Mysqlcon) Type2str

func (that *Mysqlcon) Type2str(val interface{}) string

func (*Mysqlcon) Update

func (that *Mysqlcon) Update(postdata map[string]interface{}) (sql.Result, error)

func (*Mysqlcon) Update_redis

func (that *Mysqlcon) Update_redis(tbname string)

func (*Mysqlcon) Where

func (that *Mysqlcon) Where(where interface{}) *Mysqlcon

Jump to

Keyboard shortcuts

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