weSubDatabase

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 16 Imported by: 0

README

weSubDatabase

MySQL sub-Database

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckString added in v0.0.5

func CheckString(str string) []string

===============

检查字符串中是否有linux下的非法字符和SQL注入

"

str	string	"需要检查的字符串"
return	bool	"是否有非法字符"

===============

Check whether there are illegal characters and SQL injection under Linux in the string

str	string	"String to be checked"
return	bool	"Whether there are illegal characters"

func Parse

func Parse(jsonStr string) (*wJson, error)

===============

解析json字符串
jsonStr		string		"需要解析的json字符串"
return 1	*Json		"解析后的json对象"
return 2	error		"解析错误"

==============

Parsing JSON strings
jsonStr		string		"json string"
return1		*Json		"parsed json object"
return2		error		"parsing error"

func SetRegexpString added in v0.0.5

func SetRegexpString(regexpStr string)

===============

设置正则表达式

regexpStr	string	"正则表达式
						空字符串时修改为默认值"

===============

Set regular expression

regexpStr	string	"Regular expression
						When the string is empty, it is default"

func Test

func Test()

Types

type Config

type Config struct {
	Mysql    []SQLConfig   `json:"mysql"`
	Redis    []RedisConfig `json:"redis"`
	MaxLink  MaxLinkNumber `json:"maxLinkNumber"`
	Contrast Contrast      `json:"contrast"`
}

func GetConfig

func GetConfig(configStr string) (*Config, error)

===============

从json字符串中解析配置
configStr	string	"需要解析的json字符串"
return 1	*Config	"解析后的配置对象"
return 2	error	"解析错误"

==============

Parse configuration from json string
configStr	string	"json string"
return 1	*Config	"parsed configuration object"
return 2	error	"parsing error"

type Contrast

type Contrast struct {
	ExtraItem int      `json:"extraItem"`
	Key       []string `json:"key"`
}

type IsPrimaryKeyO added in v0.0.4

type IsPrimaryKeyO func(*Option)

是否为主键的可选配置

Optional configuration for whether it is a primary key

func OIPKIsPrimaryKey added in v0.0.4

func OIPKIsPrimaryKey(IsPrimaryKey bool) IsPrimaryKeyO

===============

设置是否为主键
IsPrimaryKey	bool	"是否为主键"

===============

Set whether it is a primary key
IsPrimaryKey	bool	"Whether it is a primary key"

func OIPKIsShowPrint added in v0.0.4

func OIPKIsShowPrint(IsShowPrint bool) IsPrimaryKeyO

===============

是否输出到控制台
IsShowPrint	bool	"是否输出到控制台"

===============

Whether to output to the console
IsShowPrint	bool	"Whether to output to the console"

type IsShowPrintO added in v0.0.4

type IsShowPrintO func(*Option)

是否输出到控制台

Whether to output to the console

func OIsShowPrint added in v0.0.4

func OIsShowPrint(IsShowPrint bool) IsShowPrintO

===============

是否输出到控制台
IsShowPrint	bool	"是否输出到控制台"

===============

Whether to output to the console
IsShowPrint	bool	"Whether to output to the console"

type LinkSQLO added in v0.0.4

type LinkSQLO func(*Option)

连接MySQL时的可选配置

Optional configuration when connecting to MySQL

func OLIsShowPrint added in v0.0.4

func OLIsShowPrint(IsShowPrint bool) LinkSQLO

===============

设置是输出到控制台
IsShowPrint	bool	"是否输出到控制台"

===============

Set whether to output to the console
IsShowPrint	bool	"Whether to output to the console"

func OLWaitCount added in v0.0.4

func OLWaitCount(WaitCount int) LinkSQLO

===============

设置等待次数
WaitCount	int	"等待次数"

===============

Set the number of waits
WaitCount	int	"Number of waits"

func OLWaitTime added in v0.0.4

func OLWaitTime(WaitTime int) LinkSQLO

===============

设置每次等待时间,单位毫秒
WaitTime	int	"每次等待时间,单位毫秒"

===============

Set the waiting time per time, in milliseconds
WaitTime	int	"Waiting time per time, in milliseconds"

type MaxLinkNumber

type MaxLinkNumber struct {
	MySQL int `json:"mysql"`
	Redis int `json:"redis"`
}

type MysqlDB

type MysqlDB struct {
	//	数据库名
	//
	//	Database name
	Name string
	//	当前连接的数据库在配置中的位置
	//
	//	The location of the currently connected database in the configuration
	DBItem int
	//	数据库连接
	//
	//	Database connection
	DB *sql.DB
}

func (*MysqlDB) Close

func (db *MysqlDB) Close()

===============

关闭数据库

===============

Close database

func (*MysqlDB) ExecCMD

func (s *MysqlDB) ExecCMD(sqlStr string, Debug *log.Logger, options ...IsShowPrintO) (int64, int64, error)

===============

根据 *Setting 从数据库集中调用单行SQL指令
sqlStr		string			"SQL指令"
Debug		*log.Logger		"调试输出"
options		[]IsShowPrintO		"配置"
	IsShowPrint	bool			"是否输出到控制台"
return 1	int64			"插入的行数"
return 2	int64			"影响的行数"
return 3	[]error			"错误信息"

===============

According to *Setting, call single row SQL instruction from database set
sqlStr		string			"SQL instruction"
Debug		*log.Logger		"Debug output"
options		[]IsShowPrintO		"Configuration"
isShowPrint	bool			"Whether to output
										to the console"
return 1	int64			"Number of rows inserted"
return 2	int64			"Number of rows affected"
return 3	[]error			"Error message"

func (*MysqlDB) QueryCMD

func (s *MysqlDB) QueryCMD(sqlStr string, Debug *log.Logger, options ...IsShowPrintO) ([]map[string]string, error)

===============

根据 *Setting 从数据库集中调用单行SQL查询指令
sqlStr		string			"SQL指令"
Debug		*log.Logger		"调试输出"
options		[]IsShowPrintO		"配置"
	IsShowPrint	bool			"是否输出到控制台"
return 1	[]map[string]string	"查询结果"
return 2	[]error			"错误信息"

===============

According to *Setting, call single row SQL query instruction from database set
sqlStr		string			"SQL instruction"
Debug		*log.Logger		"Debug output"
options		[]IsShowPrintO		"Configuration"
	IsShowPrint	bool			"Whether to output to the
										console"
return 1	[]map[string]string	"Query result"
return 2	[]error			"Error message"

type Option

type Option struct {
	//	等待次数
	//
	//	Number of waits
	WaitCount int
	//	每次等待时间,单位毫秒
	//
	//	Waiting time per time, in milliseconds
	WaitTime int
	//	是否为主键
	//
	//	Whether it is a primary key
	IsPrimaryKey bool
	//	重试时间
	//
	//	Retry time
	RetryTime int
	//	是否输出到控制台
	//
	//	Whether to output to the console
	IsShowPrint bool
	//	Redis专用:在查詢完成後刪除此條目
	//
	//	Redis special: delete this entry after the query is completed
	IsDelete bool
	//	Redis专用:資料條目的超時時間(秒)
	//
	//	Redis special: timeout time of data entry (seconds)
	AutoDeleteTime int
	//	Redis专用:在批次操作中是否遇到錯誤就停止
	//
	//	Redis special: whether to stop if an error is encountered in batch operation
	IsErrorStop bool
}

type RedisConfig added in v0.0.7

type RedisConfig struct {
	Addr     string `json:"redis_addr"`
	Port     string `json:"redis_port"`
	Password string `json:"redis_pwd"`
	MaxDB    int    `json:"redis_max_db"`
}

type RedisDB added in v0.0.7

type RedisDB struct {
	//	数据库地址
	//
	//	Database Address
	Addr string
	//	当前连接的数据库在配置中的位置
	//
	//	The location of the currently connected database in the configuration
	DBItem int
	//	数据库连接
	//
	//	Database connection
	DB *redis.Client
}

func (*RedisDB) Close added in v0.0.7

func (db *RedisDB) Close()

===============

关闭Redis数据库

===============

Close Redis database

func (*RedisDB) Del added in v0.0.7

func (rDB *RedisDB) Del(keys []string, options ...RedisO) error

===============

从Redis数据库中删除数据
keys		[]string	"键"
options		...RedisO	"可选配置"
	IsErrorStop	bool		"是否在出錯時停止,默认值为true"
return		error		"错误信息"

===============

Delete data from Redis database
keys		[]string	"Key"
options		...RedisO	"Optional configuration"
	IsErrorStop	bool		"Whether to stop when an
								error occurs, the default
								value is true"
return		error		"Error message"

func (*RedisDB) DelMulti added in v0.0.7

func (rDB *RedisDB) DelMulti(keyPattern string, options ...RedisO) error

===============

从Redis数据库中批次删除数据
keyPattern	string		"键(支持通配符,如:*)"
options		...RedisO	"可选配置"
	IsErrorStop	bool		"是否在出錯時停止,默认值为true"
return		error		"错误信息"

===============

Delete data in batches from Redis database
keyPattern	string		"Key (supports wildcards,
								such as: *)"
options		...RedisO	"Optional configuration"
	IsErrorStop	bool		"Whether to stop when an
								error occurs, the default
								value is true"
return		error		"Error message"

func (*RedisDB) GetString added in v0.0.7

func (rDB *RedisDB) GetString(key string, options ...RedisO) (string, error)

===============

从Redis数据库中获取数据
key		string		"键"
options		...RedisO	"可选配置"
	IsDelete	bool		"是否删除,默认值为false"
return 1	string		"值"
return 2	error		"错误信息"

===============

Get data from Redis database
key		string		"Key"
options		...RedisO	"Optional configuration"
	IsDelete	bool		"Whether to delete, the default
								value is false"
return 1	string		"Value"
return 2	error		"Error message"

func (*RedisDB) GetStringAll added in v0.0.7

func (rDB *RedisDB) GetStringAll(keyPattern string, options ...RedisO) (map[string]string, error)

===============

从Redis数据库中批次获取数据
keyPattern	string			"键(支持通配符,如:*)"
options		...RedisO		"可选配置"
	IsDelete	bool			"是否删除,默认值为false"
	IsErrorStop	bool			"是否在出錯時停止,
										默认值为false"
return 1	map[string]string	"值"
return 2	error			"错误信息"

===============

Get data in batches from Redis database
keyPattern	string			"Key (supports
										wildcards, such as: *)"
options		...RedisO		"Optional configuration"
	IsDelete	bool			"Whether to delete,the
										default value is false"
	IsErrorStop	bool			"Whether to stop when an
										error occurs,the default
										value is false"
return 1	map[string]string	"Value"
return 2	error			"Error message"

func (*RedisDB) Keys added in v0.0.7

func (rDB *RedisDB) Keys(keyPattern string) ([]string, error)

===============

从Redis数据库中获取全部键值
keyPattern	string		"键(支持通配符,如:*)"
return 1	[]string	"键"
return 2	error		"错误信息"

===============

Get all key values from Redis database
keyPattern	string		"Key (supports wildcards,
								such as: *)"
return 1	[]string	"Key"
return 2	error		"Error message"

func (*RedisDB) SetValue added in v0.0.7

func (rDB *RedisDB) SetValue(key string, val string, options ...RedisO) error

===============

向Redis数据库中插入数据
key			string		"键"
val			string		"值"
options			...RedisO	"可选配置"
	AutoDeleteTime	int		"自动删除时间,单位秒"
return			error		"错误信息"

===============

Insert data into Redis database
key			string		"Key"
val			string		"Value"
options			...RedisO	"Optional configuration"
	AutoDeleteTime	int		"Auto delete time, in
										seconds"
return			error		"Error message"

type RedisO added in v0.0.7

type RedisO func(*Option)

连接MySQL时的可选配置

Optional configuration when connecting to MySQL

func OLRedisAutoDeleteTime added in v0.0.7

func OLRedisAutoDeleteTime(AutoDeleteTime int) RedisO

===============

自動刪除時間,單位秒
AutoDeleteTime	int	"自动删除时间,单位秒"

===============

Auto delete time, in seconds
AutoDeleteTime	int	"Auto delete time, in seconds"

func OLRedisIsDelete added in v0.0.7

func OLRedisIsDelete(IsDelete bool) RedisO

===============

在查詢完成後刪除此條目
IsDelete	bool	"是否删除"

===============

Delete this entry after the query is complete
IsDelete	bool	"Whether to delete"

func OLRedisIsErrorStop added in v0.0.7

func OLRedisIsErrorStop(IsErrorStop bool) RedisO

===============

是否在出錯時停止
IsErrorStop	bool	"是否在出錯時停止"

===============

Whether to stop when an error occurs
IsErrorStop	bool	"Whether to stop when an error occurs"

func OLRedisIsShowPrint added in v0.0.7

func OLRedisIsShowPrint(IsShowPrint bool) RedisO

===============

设置是输出到控制台
IsShowPrint	bool	"是否输出到控制台"

===============

Set whether to output to the console
IsShowPrint	bool	"Whether to output to the console"

func OLRedisWaitCount added in v0.0.7

func OLRedisWaitCount(WaitCount int) RedisO

===============

设置等待次数
WaitCount	int	"等待次数"

===============

Set the number of waits
WaitCount	int	"Number of waits"

func OLRedisWaitTime added in v0.0.7

func OLRedisWaitTime(WaitTime int) RedisO

===============

设置每次等待时间,单位毫秒
WaitTime	int	"每次等待时间,单位毫秒"

===============

Set the waiting time per time, in milliseconds
WaitTime	int	"Waiting time per time, in milliseconds"

type RetryTimeO added in v0.0.4

type RetryTimeO func(*Option)

重试时间的可选配置

Optional configuration of retry time

func OptionRetryTime added in v0.0.3

func OptionRetryTime(RetryTime int) RetryTimeO

===============

设置重试时间
RetryTime	int	"重试等待时间(ms)"

===============

Set retry time
RetryTime	int	"Retry wait time(ms)"

type SQLConfig

type SQLConfig struct {
	User     string `json:"mysql_user"`
	Password string `json:"mysql_pwd"`
	Address  string `json:"mysql_addr"`
	Port     string `json:"mysql_port"`
	DB       string `json:"mysql_db"`
}

func GetSQLConfig

func GetSQLConfig(config string) (*SQLConfig, error)

===============

从json字符串中解析MySQL配置
config		string		"需要解析的json字符串"
return 1	*SQLConfig	"解析后的MySQL配置对象"
return 2	error		"解析错误"

==============

Parse MySQL configuration from json string
config		string		"json string"
return 1	*SQLConfig	"parsed MySQL configuration object"
return 2	error		"parsing error"

func GetSQLConfigMap

func GetSQLConfigMap(configMap map[string]interface{}) *SQLConfig

===============

从字典中解析MySQL配置
configMap	map[string]interface{}	"需要解析的字典"
return 1	*SQLConfig		"解析后的MySQL配置对象"

==============

Parse MySQL configuration from dictionary
configMap	map[string]interface{}	"dictionary"
return 1	*SQLConfig		"parsed MySQL configuration
										object"

type Setting

type Setting struct {
	//	数据库配置
	//
	//	Database configuration
	SqlConfigs []SQLConfig
	// //	数据库名
	// //
	// //	Database name
	// DBName string
	//	下一个数据库ID号,起始为1
	//
	//	Next database ID number, starting at 1
	NextDBID int
	//	数据库最大数目
	//
	//	Maximum number of databases
	DBMaxNum int
	//	连接数目
	//
	//	Number of connections
	LinkNum int
	//	最大连接数目
	//
	//	Maximum number of connections
	MaxLink int
	//	数据库连接
	//
	//	Database connection
	MySQLDB []*MysqlDB
	//	加密对象
	//
	//	Encryption object
	SEKey *simpleEncryption.SecretKey
	//	重新连接数据库的时间间隔
	//
	//	Time interval for reconnecting to the database
	ConnectAgainTime int
	//	上次连接失败的时间, 用于判断是否需要重新连接
	//
	//	The last time the connection failed, used to determine whether to reconnect
	ConnectFailTime []*time.Time

	//	Redis配置
	//
	//	Redis configuration
	RedisConfigs []RedisConfig
	//	下一个Redis数据库ID号,起始为1
	//
	//	Next Redis database ID number, starting at 1
	NextRedisDBID int
	//	Redis最大数目
	//
	//	Maximum number of Redis
	RedisMaxNum int
	//	连接数目
	//
	//	Number of connections
	RedisLinkNum int
	//	最大连接数目
	//
	//	Maximum number of connections
	RedisMaxLink int
	//	Redis连接
	//
	//	Redis connection
	RedisDB []*RedisDB
	//	上次连接失败的时间, 用于判断是否需要重新连接
	//
	//	The last time the connection failed, used to determine whether to reconnect
	RedisConnectFailTime []*time.Time
}

func New

func New(configString string, options ...RetryTimeO) (*Setting, error)

===============

数据库配置
configString	string		"配置文件字符串"
options		[]RetryTimeO	"配置"
	RetryTime	int		"重试时间(ms)"
return 1	*Setting	"数据库配置对象"
return 2	error		"错误信息"

===============

Database config
configString	string		"Configuration file string"
options		[]RetryTimeO	"Configuration"
	RetryTime	int		"Retry time(ms)"
return 1	*Setting	"Database configuration object"
return 2	error		"Error message"

func (*Setting) Add

func (s *Setting) Add(table string, keys []string, values [][]string, Debug *log.Logger, options ...IsShowPrintO) ([]int64, []error)

===============

自动根据 *Setting 向下一个数据库中的指定表添加数据
table		string		"表名"
keys		[]string	"键名"
values		[][]string	"值"
Debug		*log.Logger	"调试输出"
options		[]IsShowPrintO	"配置"
	IsShowPrint	bool		"是否输出到控制台"
return 1	[]int64		"插入的行数"
return 2	[]error		"错误信息"

===============

Automatically add data to the specified table in the next database according to *Setting
table		string		"table name"
keys		[]string	"key name"
values		[][]string	"value"
Debug		*log.Logger	"debug output"
options		[]IsShowPrintO	"Configuration"
	IsShowPrint	bool		"Whether to output to the console"
return 1	[]int64		"Number of rows inserted"
return 2	[]error		"Error message"

func (*Setting) AddForPrimary added in v0.0.13

func (s *Setting) AddForPrimary(table string, encryptedKey []string, keys []string, value [][]string, Debug *log.Logger, options ...IsShowPrintO) ([]int64, []error)

===============

根据encryptedKey计算Value值的数据库下标,并根据下标向表中插入
table		string		"表名"
encryptedKey	[]string	"根据此项计算value应该插入哪个库中"
keys		[]string	"键名"
values		[][]string	"值"
Debug		*log.Logger	"调试输出"
options		[]IsShowPrintO	"配置"
	IsShowPrint	bool		"是否输出到控制台"
return 1	[]int64		"插入的行数"
return 2	[]error		"错误信息"

===============

Calculate the database subscript of the Value value based on the encryptedKey, and insert it into the table based on the subscript.
table		string		"table name"
encryptedKey	[]string	"Calculate which library the value should be inserted into based on this item"
keys		[]string	"key name"
values		[][]string	"value"
Debug		*log.Logger	"debug output"
options		[]IsShowPrintO	"Configuration"
	IsShowPrint	bool		"Whether to output to the console"
return 1	[]int64		"Number of rows inserted"
return 2	[]error		"Error message"

func (*Setting) DecryptID

func (s *Setting) DecryptID(primaryKey string, ids []string) ([]bool, [][]string, [][]int)

===============

根据主键和id数组解密出数据库ID和主键ID
primaryKey	string		"主键字段名"
ids		[]string	"主键ID数组"
return 1	[]bool		"解密出的ID是否有对应的数据库"
return 2	[][]string	"解密出的数据库ID"
return 3	[][]int		"解密出的主键ID在原数组中的位置"

===============

Decrypt the database ID and primary key ID based on the primary key and ID array
primaryKey	string		"primary key field name"
ids		[]string	"primary key ID array"
return 1	[]bool		"Whether the decrypted ID has a
								corresponding database"
return 2	[][]string	"Decrypted database ID"
return 3	[][]int		"The position of the decrypted
								primary key ID in the original
								array"

func (*Setting) Delete

func (s *Setting) Delete(table string, forKey string, ids []string, Debug *log.Logger, options ...IsPrimaryKeyO) ([]int64, []error)

===============

自动根据 *Setting 向下一个数据库中的指定表删除数据
table			string		"表名"
forKey			string		"键名"
ids			[]string	"值"
Debug			*log.Logger	"调试输出"
options			[]IsPrimaryKeyO	"配置"
	IsPrimaryKey	bool		"是否为主键"
	IsShowPrint		bool		"是否输出到控制台"
return 1		[]int64		"删除的行数"
return 2		[]error		"错误信息"

===============

Automatically delete data from the specified table in the next database according to *Setting
table			string		"table name"
forKey			string		"key name"
ids			[]string	"value"
Debug			*log.Logger	"debug output"
options			[]IsPrimaryKeyO	"Configuration"
	IsPrimaryKey	bool		"Whether it is a primary
										key"
	IsShowPrint		bool		"Whether to output to the
										console"
return 1		[]int64		"Number of rows deleted"
return 2		[]error		"Error message"

func (*Setting) EncryptPrimaryKey

func (s *Setting) EncryptPrimaryKey(queryDatas []map[string]string, primaryKey string) []map[string]string

===============

加密主键, *Setting.SEKey 为 nil 时不加密
queryDatas	[]map[string]string	"查询结果"
primaryKey	string			"主键字段名
										为空字符串时不加密"
return		[]map[string]string	"查询结果"

===============

Encrypt primary key, *Setting.SEKey is not encrypted when nil
queryDatas	[]map[string]string	"query result"
primaryKey	string			"primary key field name
										When it is an empty string,
										it is not encrypted"
return		[]map[string]string	query result

func (*Setting) IsRetryConnect added in v0.0.3

func (s *Setting) IsRetryConnect(item int) bool

===============

判断是否可以连接数据库
item		int	"需要连接的数据库在配置中的位置"
return 1	bool	"是否可以尝试连接"

===============

Determine whether the database can be connected
item		int	"Location of the database to be
				 	connected in the configuration"
return 1	bool	"Whether to try to connect"
func (s *Setting) Link(item int) (*MysqlDB, error)

===============

连接数据库
item		int		"需要连接的数据库在配置中的位置"
return 1	*MysqlDB	"连接池中的位置"
return 2	error		"错误信息"

===============

Connect to MySQL database
item		int		"Location of the database to be
					 		connected in the configuration"
return 1	*MysqlDB	"Location in the connection pool"
return 2	error		"Error message"

func (*Setting) MysqlClose

func (s *Setting) MysqlClose(i int, options ...IsShowPrintO)

===============

关闭MySQL连接
i	int	"连接池中的位置"

===============

Close MySQL connection
i	int	"Position in the connection pool"

func (*Setting) MysqlIsRun

func (s *Setting) MysqlIsRun(item int, options ...LinkSQLO) (int, error)

===============

连接MySQL数据库并放入连接池
item		int		"配置文件中的第几个MySQL配置"
options		[]LinkSQLO	"配置"
	WaitCount	int		"等待次数"
	WaitTime	int		"每次等待时间,单位毫秒"
return 1	int		"连接池中的位置"
return 2	error		"错误信息"

===============

Connect to MySQL database and put it into Connection pool
item		int		"Which MySQL configuration in
								the configuration file"
options		[]LinkSQLO	"Configuration"
	WaitCount	int		"Number of waits"
	WaitTime	int		"Waiting time per time,
								in milliseconds"
return 1	int		"Position in the connection pool"
return 2	error		"Error message"

func (*Setting) Query

func (s *Setting) Query(table string, from string, primaryKey string, where string, order string, limit string, Debug *log.Logger, options ...IsShowPrintO) ([]map[string]string, []error)

===============

根据 *Setting 从数据库集中查询
table		string			"表名"
from		string			"查询字段
										空字符串为默认值 *"
primaryKey	string			"主键
										空字符串时不加密"
where		string			"查询条件"
order		string			"排序"
limit		string			"分页
										空字符串为默认值:100"
Debug		*log.Logger		"调试日志对象"
options		[]IsShowPrintO		"配置"
	IsShowPrint	bool			"是否输出到控制台"
return 1	[]map[string]string	"查询结果"
return 2	[]error			"错误信息"

===============

According to *Setting, query from the database set
table		string			"Table name"
from		string			"Query field
										Empty string is the default
										value *"
primaryKey	string			"Primary key
										Empty string is not
										encrypted"
where		string			"Query condition"
order		string			"Sorting"
limit		string			"Paging
										Empty string is the default
										value: 100"
Debug		*log.Logger		"Debug log object"
options		[]IsShowPrintO		"Configuration"
	IsShowPrint	bool			"Whether to output to the
										console"
return 1	[]map[string]string	"Query result"
return 2	[]error			"Error message"

func (*Setting) QueryID

func (s *Setting) QueryID(table string, from string, primaryKey string, ids []string, order string, Debug *log.Logger, options ...IsShowPrintO) ([]map[string]string, []error)

===============

自动根据 *Setting 从数据库集中,根据加密后的主键查询
table		string			"表名"
from		string			"查询的字段"
primaryKey	string			"主键"
ids		[]string		"加密后的主键"
order		string			"排序"
Debug		*log.Logger		"调试输出"
options		[]IsShowPrintO		"配置"
	IsShowPrint	bool			"是否输出到控制台"
return 1	[]map[string]string	"查询到的数据"
return 2	[]error			"错误信息"

===============

Automatically query from the database set according to *Setting, according to the encrypted primary key
table		string			"table name"
from		string			"query field"
primaryKey	string			"primary key"
ids		[]string		"encrypted primary key"
order		string			"sort"
Debug		*log.Logger		"debug output"
options		[]IsShowPrintO		"Configuration"
	IsShowPrint	bool			"Whether to output to the
										console"
return 1	[]map[string]string	"query data"
return 2	[]error			"error message"

func (*Setting) RedisClose added in v0.0.7

func (s *Setting) RedisClose(i int, options ...IsShowPrintO)

===============

关闭Redis连接
i	int	"连接池中的位置"

===============

Close Redis connection
i	int	"Position in the connection pool"

func (*Setting) RedisIsRun added in v0.0.7

func (s *Setting) RedisIsRun(item int, dbID int, options ...RedisO) (int, error)

===============

连接Redis数据库并放入连接池
item	int	"数据库ID"
dbID	int	"数据库在配置中的位置"
options	...RedisO	"可选配置"
	WaitCount	int	"等待次数"
	WaitTime	int	"每次等待时间,单位毫秒"
	IsShowPrint	bool	"是否输出到控制台"
return 1	int	"连接池中的位置"
return 2	error	"错误信息"

===============

Connect to the Redis database and put it in the connection pool
item	int	"Database ID"
dbID	int	"Location of the database in the configuration"
options	...RedisO	"Optional configuration"
	WaitCount	int	"Number of waits"
	WaitTime	int	"Waiting time per time, in milliseconds"
	IsShowPrint	bool	"Whether to output to the console"
return 1	int	"Position in the connection pool"
return 2	error	"Error message"
func (s *Setting) RedisLink(item int, dbID int) (*RedisDB, error)

===============

连接Redis数据库
item		int		"需要连接的数据库在配置中的位置"
dbID		int		"需要连接的数据库ID"
return 1	*RedisDB	"连接池中的位置"
return 2	error		"错误信息"

===============

Connect to Redis database
item		int		"Location of the database to be
					 		connected in the configuration"
dbID		int		"Database ID to be connected"
return 1	*RedisDB	"Location in the connection pool"
return 2	error		"Error message"

func (*Setting) SelectLastID

func (s *Setting) SelectLastID(table string, primaryKey string, Debug *log.Logger, options ...IsShowPrintO) (int, int, error)

===============

根据 *Setting 从数据库集中查询指定表的最后一条数据的 ID
table		string		"表名"
primaryKey	string		"主键名,主键类型必须为数字类型"
Debug		*log.Logger	"Debug 日志对象"
options		[]IsShowPrintO	"配置"
	IsShowPrint	bool		"是否输出到控制台"
return 1	int		"下一条数据所在的数据库索引"
return 2	int		"下一条数据的 ID"
return 3	error		"错误信息"

===============

According to *Setting, query the ID of the last data of the specified table from the database set
table		string		"table name"
primaryKey	string		"primary key name,The primary key
								type must be a numeric type"
Debug		*log.Logger	"Debug log object"
options		[]IsShowPrintO	"Configuration"
	IsShowPrint	bool		"Whether to output to the
								console"
return 1	int		"The database index where the next
								data is located"
return 2	int		"ID of the next data"
return 3	error		"Error message"

func (*Setting) Update

func (s *Setting) Update(table string, key []string, value [][]string, forKey string, ids []string, Debug *log.Logger, options ...IsPrimaryKeyO) ([]int64, []error)

===============

更新数据
table			string			"表名"
key			[]string		"字段名"
value			[][]string		"值"
forKey			string			"加密用的key"
ids			[]string		"主键"
Debug			*log.Logger		"调试输出"
options			[]UpdateOptionConfig	"配置"
	IsPrimaryKey	bool			"是否使用主键"
	IsShowPrint		bool			"是否输出到控制台"
return 1		[]int64			"更新的行数"
return 2		error			"错误信息"

===============

Update data
table			string			"Table name"
key			[]string		"Field name"
value			[][]string		"Value"
forKey			string			"Encryption key"
ids			[]string		"Primary key"
Debug			*log.Logger		"Debug output"
options			[]UpdateOptionConfig	"Configuration"
	IsPrimaryKey	bool			"Whether to use the
												primary key"
	IsShowPrint		bool			"Whether to output
												to the console"
return 1		[]int64			"Number of rows
												updated"
return 2		error			"Error message"

Jump to

Keyboard shortcuts

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