Documentation ¶
Index ¶
- func InsertCompiler(ctx context.Context, client Client, builder *InsertBuilder, ...) string
- func InsertWithBuilder(ctx context.Context, client Client, builder *InsertBuilder, ...) error
- func QueryCompiler(ctx context.Context, client Client, builder *SelectBuilder) string
- func QueryWithBuilder(ctx context.Context, client Client, builder *SelectBuilder, data interface{}) error
- type Client
- type Config
- type DbPool
- type InsertBuilder
- type SelectBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertCompiler ¶
func InsertWithBuilder ¶
func InsertWithBuilder(ctx context.Context, client Client, builder *InsertBuilder, data map[string]interface{}, hasLog ...bool) error
InsertWithBuilder 传入一个 SQLBuilder 并执行 QueryContext
func QueryCompiler ¶
func QueryCompiler(ctx context.Context, client Client, builder *SelectBuilder) string
func QueryWithBuilder ¶
func QueryWithBuilder(ctx context.Context, client Client, builder *SelectBuilder, data interface{}) error
QueryWithBuilder 传入一个 SQLBuilder 并执行 QueryContext
Types ¶
type Client ¶
type Client interface { DbName() string DbDriver() string DbIp() string DbPort() string UserName() string UserPassword() string DbPool() DbPool SetDbName(str string) SetDbDriver(str string) SetDbIp(str string) SetDbPort(str string) SetUserName(str string) SetUserPassword(str string) SetDbPool(dp DbPool) Query(ctx context.Context, tableName string, where map[string]interface{}, columns []string, data interface{}) error Insert(ctx context.Context, tableName string, data map[string]interface{}) error InsertNoLog(ctx context.Context, tableName string, data map[string]interface{}) error }
func NewDefault ¶
func NewDefault() Client
type Config ¶
type Config struct { Username string // 账号名 Password string // 密码 DbName string // 数据库名称 DbDriver string // 驱动名称 Host string Port string }
Config 配置
func DefaultDbConf ¶
func DefaultDbConf() *Config
type DbPool ¶
func DefaultDbPool ¶
func DefaultDbPool() DbPool
type InsertBuilder ¶
type InsertBuilder struct {
// contains filtered or unexported fields
}
InsertBuilder 默认的select sql builder
func NewInsertBuilder ¶
func NewInsertBuilder(table string) *InsertBuilder
type SelectBuilder ¶
type SelectBuilder struct {
// contains filtered or unexported fields
}
SelectBuilder 默认的select sql builder
func NewSelectBuilder ¶
func NewSelectBuilder(table string, where map[string]interface{}, fields []string) *SelectBuilder
Click to show internal directories.
Click to hide internal directories.