Documentation
¶
Index ¶
- Variables
- func InterfaceToBool(value interface{}) bool
- func InterfaceToFloat64(value interface{}) float64
- func InterfaceToInt64(value interface{}) int64
- func InterfaceToString(value interface{}) string
- func Lcfirst(str string) string
- func RecycleSql(sql *Builder)
- func SetColVarType(colVar *[]interface{}, i int, typeName string)
- func SetResultValue(result *map[string]interface{}, index string, colVar interface{}, ...)
- func Transfer(sourceMap map[string]interface{}, targetStruct interface{}) error
- type Builder
- func (sql *Builder) All() ([]map[string]interface{}, error)
- func (sql *Builder) Count() (int64, error)
- func (sql *Builder) Delete() error
- func (sql *Builder) Exec() (int64, error)
- func (sql *Builder) Find(arg interface{}) (map[string]interface{}, error)
- func (sql *Builder) First() (map[string]interface{}, error)
- func (sql *Builder) FormFirst(v interface{}) error
- func (sql *Builder) Insert(values dialect.H) (int64, error)
- func (sql *Builder) LeftJoin(table string, fieldA string, operation string, fieldB string) *Builder
- func (sql *Builder) OrderBy(filed string, order string) *Builder
- func (sql *Builder) Select(fields ...string) *Builder
- func (sql *Builder) ShowColumns() ([]map[string]interface{}, error)
- func (sql *Builder) ShowTables() ([]map[string]interface{}, error)
- func (sql *Builder) Skip(offset int) *Builder
- func (sql *Builder) Table(table string) *Builder
- func (sql *Builder) Take(take int) *Builder
- func (sql *Builder) Update(values dialect.H) (int64, error)
- func (sql *Builder) UpdateRaw(raw string, args ...interface{}) *Builder
- func (sql *Builder) Where(field string, operation string, arg interface{}) *Builder
- func (sql *Builder) WhereIn(field string, arg []interface{}) *Builder
- func (sql *Builder) WhereNotIn(field string, arg []interface{}) *Builder
- func (sql *Builder) WhereRaw(raw string, args ...interface{}) *Builder
- type DB
- type Dialect
- type H
- type Model
Constants ¶
This section is empty.
Variables ¶
View Source
var BuilderPool = sync.Pool{ New: func() interface{} { return &Builder{ SqlComponent: dialect.SqlComponent{ Fields: make([]string, 0), TableName: "", Args: make([]interface{}, 0), Wheres: make([]dialect.Where, 0), Leftjoins: make([]dialect.Join, 0), UpdateRaws: make([]dialect.RawUpdate, 0), WhereRaws: "", }, connection: DBInstance.clone(), } }, }
Functions ¶
func InterfaceToBool ¶
func InterfaceToBool(value interface{}) bool
func InterfaceToFloat64 ¶
func InterfaceToFloat64(value interface{}) float64
func InterfaceToInt64 ¶
func InterfaceToInt64(value interface{}) int64
func InterfaceToString ¶
func InterfaceToString(value interface{}) string
func RecycleSql ¶
func RecycleSql(sql *Builder)
func SetColVarType ¶
func SetResultValue ¶
Types ¶
type Builder ¶
type Builder struct {
dialect.SqlComponent
// contains filtered or unexported fields
}
func (*Builder) ShowColumns ¶
func (*Builder) ShowTables ¶
func (*Builder) WhereNotIn ¶
type DB ¶
type DB struct {
Value interface{}
Error error
RowsAffected int64
// contains filtered or unexported fields
}
DB contains information for current db connection
var DBInstance *DB
type Dialect ¶
type Dialect interface {
// GetName get dialect's name
GetName() string
// ShowColumns show columns of specified table
ShowColumns(table string) string
// ShowTables show tables of database
ShowTables() string
// Insert
Insert(comp *dialect.SqlComponent) string
// Delete
Delete(comp *dialect.SqlComponent) string
// Update
Update(comp *dialect.SqlComponent) string
// Select
Select(comp *dialect.SqlComponent) string
}
func GetDialectByDriver ¶
Click to show internal directories.
Click to hide internal directories.