Documentation ¶
Index ¶
- Constants
- type BaseConnStrut
- type DialOptions
- type DockerClient
- type DockerOptions
- type FieldInfo
- type IDriverHelper
- type MongoDBStrut
- type MysqlSetting
- type PoolOptions
- type RedisOptions
- type RedisStrut
- type RelationSqlOption
- type RelationSqlStrut
- func (itf *RelationSqlStrut) Affair(ctx context.Context, opt *sql.TxOptions, f []SqlFunc) (err error)
- func (itf *RelationSqlStrut) ExecCtx(ctx context.Context, query string, args ...interface{}) (resultRow ResultRowInfo, err error)
- func (itf *RelationSqlStrut) FindOfCtx(ctx context.Context, query string, rely interface{}, args ...interface{}) (list []map[string]interface{}, err error)
- func (itf *RelationSqlStrut) GetSingleCtx(ctx context.Context, query string, rely interface{}, args ...interface{}) (single map[string]interface{}, err error)
- func (itf *RelationSqlStrut) Status() (status sql.DBStats)
- type ResultRowInfo
- type SqlFunc
Constants ¶
View Source
const ( Query = iota QueryRow Exec )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseConnStrut ¶
type DialOptions ¶
type DockerClient ¶
func NewDocker ¶
func NewDocker(opt DockerOptions) (cli *DockerClient, err error)
type DockerOptions ¶
DOC :https://docs.docker.com/engine/api/sdk/examples/ docker命令详情见官网
type IDriverHelper ¶
type IDriverHelper interface { }
type MongoDBStrut ¶
func NewMongoDB ¶
func NewMongoDB(database string, opt *options.ClientOptions, collection string) (client *MongoDBStrut, err error)
type MysqlSetting ¶
type PoolOptions ¶
type RedisOptions ¶
type RedisOptions struct { BaseConnStrut DialOptions PoolOptions }
type RedisStrut ¶
var (
RedisClient *RedisStrut
)
func NewRedis ¶
func NewRedis(opt RedisOptions) (pool *RedisStrut, err error)
func (*RedisStrut) Do ¶
func (p *RedisStrut) Do(commandName string, args ...interface{}) (reply interface{}, err error)
func (*RedisStrut) Receive ¶
func (p *RedisStrut) Receive() (reply interface{}, err error)
读取队列,未响应时堵塞
func (*RedisStrut) Send ¶
func (p *RedisStrut) Send(commandName string, args ...interface{}) error
发送至缓冲区
type RelationSqlOption ¶
type RelationSqlOption struct { BaseConnStrut ConnectString string MysqlSetting }
type RelationSqlStrut ¶
func NewMSSQL ¶
func NewMSSQL(opt RelationSqlOption, query url.Values) (rst *RelationSqlStrut, err error)
驱动地址: https://github.com/denisenkom/go-mssqldb 建议的连接字符串使用 URL 格式:下面列出了其他受支持的格式。sqlserver://username:password@host/instance?param1=value¶m2=value
func NewMySQL ¶
func NewMySQL(opt RelationSqlOption) (itf *RelationSqlStrut, err error)
func NewPostgreSQL ¶
func NewPostgreSQL(opt RelationSqlOption) (rst *RelationSqlStrut, err error)
https://github.com/lib/pq postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full doc : https://godoc.org/github.com/lib/pq
相关连接参数:
- dbname - The name of the database to connect to
- user - The user to sign in as
- password - The user's password
- host - The host to connect to. Values that start with / are for unix domain sockets. (default is localhost)
- port - The port to bind to. (default is 5432)
- sslmode - Whether or not to use SSL (default is require, this is not the default for libpq)
- fallback_application_name - An application_name to fall back to if one isn't provided.
- connect_timeout - Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely.
- sslcert - Cert file location. The file must contain PEM encoded data.
- sslkey - Key file location. The file must contain PEM encoded data.
- sslrootcert - The location of the root certificate file. The file must contain PEM encoded data.
Valid values for sslmode are:
- disable - No SSL
- require - Always SSL (skip verification)
- verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA)
- verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)
TODO 待实现更方便的命令执行方法
func (*RelationSqlStrut) ExecCtx ¶
func (itf *RelationSqlStrut) ExecCtx(ctx context.Context, query string, args ...interface{}) (resultRow ResultRowInfo, err error)
func (*RelationSqlStrut) FindOfCtx ¶
func (itf *RelationSqlStrut) FindOfCtx(ctx context.Context, query string, rely interface{}, args ...interface{}) (list []map[string]interface{}, err error)
获取多条记录 TODO 2020年11月15日20:21:13 指明要返回的字段,在参数rely里填入默认值以明确要返回的列
func (*RelationSqlStrut) GetSingleCtx ¶
func (itf *RelationSqlStrut) GetSingleCtx(ctx context.Context, query string, rely interface{}, args ...interface{}) (single map[string]interface{}, err error)
获取单条记录 TODO 2020年11月3日20:52:53 仅支持常用内置类型 指明要返回的字段,在参数rely里填入默认值以明确要返回的列
func (*RelationSqlStrut) Status ¶
func (itf *RelationSqlStrut) Status() (status sql.DBStats)
MYSQL 运行状态
type ResultRowInfo ¶
执行操作 TODO 2020年11月16日13:47:21
Click to show internal directories.
Click to hide internal directories.