Documentation
¶
Index ¶
- Variables
- func ArrayIntersect(slice1, slice2 []string) []string
- func ArrayOf(i ...interface{}) []interface{}
- func ByteArrayScan(src interface{}) (interface{}, error)
- func CamelToSnakeString(s string) string
- func Float32Scan(src interface{}) (interface{}, error)
- func IntScan(src interface{}) (interface{}, error)
- func Register(name string, inter SqlFactory)
- func ScannerResultToStruct(t reflect.Type, scanners []interface{}, columnNames []string, ...) reflect.Value
- func SliceToGroupSlice(vs interface{}) map[string][]interface{}
- func StructToMap(vs interface{}, columns ...string) (map[string]interface{}, []string, error)
- func UnZipSlice(vs interface{}) []interface{}
- type CndImpl
- func (c *CndImpl) And(field string, operation Operation, value ...interface{}) Condition
- func (c *CndImpl) And2(condition Condition) Condition
- func (c *CndImpl) And3(rawExpresssion string, values ...interface{}) Condition
- func (c *CndImpl) And3Bool(b bool, rawExpresssion string, values ...interface{}) Condition
- func (c *CndImpl) AndBool(b bool, field string, operation Operation, values ...interface{}) Condition
- func (c *CndImpl) Eq(field string, values interface{}) Condition
- func (c *CndImpl) EqBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) Field() string
- func (c *CndImpl) Ge(field string, values interface{}) Condition
- func (c *CndImpl) GeBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) Gt(field string, values interface{}) Condition
- func (c *CndImpl) GtBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) HasSubConditions() bool
- func (c *CndImpl) In(field string, values ...interface{}) Condition
- func (c *CndImpl) InBool(b bool, field string, values ...interface{}) Condition
- func (c *CndImpl) IsNotNull(field string) Condition
- func (c *CndImpl) IsNotNullBool(b bool, filed string) Condition
- func (c *CndImpl) IsNull(filed string) Condition
- func (c *CndImpl) IsNullBool(b bool, field string) Condition
- func (c *CndImpl) Items() []Condition
- func (c *CndImpl) Le(field string, values interface{}) Condition
- func (c *CndImpl) LeBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) Like(field string, values interface{}) Condition
- func (c *CndImpl) LikeBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) LikeIgnoreEnd(field string, values interface{}) Condition
- func (c *CndImpl) LikeIgnoreEndBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) LikeIgnoreStart(field string, values interface{}) Condition
- func (c *CndImpl) LikeIgnoreStartBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) Linker() Linker
- func (c *CndImpl) Lt(field string, values interface{}) Condition
- func (c *CndImpl) LtBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) NotEq(field string, values interface{}) Condition
- func (c *CndImpl) NotEqBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) NotIn(field string, values ...interface{}) Condition
- func (c *CndImpl) NotInBool(b bool, field string, values ...interface{}) Condition
- func (c *CndImpl) Operation() Operation
- func (c *CndImpl) Or(field string, operation Operation, values ...interface{}) Condition
- func (c *CndImpl) Or2(condition Condition) Condition
- func (c *CndImpl) Or3(rawExpresssion string, values ...interface{}) Condition
- func (c *CndImpl) Or3Bool(b bool, rawExpresssion string, values ...interface{}) Condition
- func (c *CndImpl) OrBool(b bool, field string, operation Operation, values ...interface{}) Condition
- func (c *CndImpl) OrEq(field string, values interface{}) Condition
- func (c *CndImpl) OrEqBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrGe(field string, values interface{}) Condition
- func (c *CndImpl) OrGeBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrGt(field string, values interface{}) Condition
- func (c *CndImpl) OrGtBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrIn(field string, values ...interface{}) Condition
- func (c *CndImpl) OrInBool(b bool, field string, values ...interface{}) Condition
- func (c *CndImpl) OrIsNotNull(field string) Condition
- func (c *CndImpl) OrIsNotNullBool(b bool, field string) Condition
- func (c *CndImpl) OrIsNull(field string) Condition
- func (c *CndImpl) OrIsNullBool(b bool, field string) Condition
- func (c *CndImpl) OrLe(field string, values interface{}) Condition
- func (c *CndImpl) OrLeBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrLike(field string, values interface{}) Condition
- func (c *CndImpl) OrLikeBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrLikeIgnoreEnd(field string, values interface{}) Condition
- func (c *CndImpl) OrLikeIgnoreEndBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrLikeIgnoreStart(field string, values interface{}) Condition
- func (c *CndImpl) OrLikeIgnoreStartBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrLt(field string, values interface{}) Condition
- func (c *CndImpl) OrLtBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrNotEq(field string, values interface{}) Condition
- func (c *CndImpl) OrNotEqBool(b bool, field string, values interface{}) Condition
- func (c *CndImpl) OrNotIn(field string, values ...interface{}) Condition
- func (c *CndImpl) OrNotInBool(b bool, field string, values ...interface{}) Condition
- func (c *CndImpl) PayLoads() int64
- func (c *CndImpl) RawExpression() string
- func (c *CndImpl) SetValues(values []interface{})
- func (c *CndImpl) Values() []interface{}
- type Column
- type Condition
- func Cnd(field string, operation Operation, values ...interface{}) Condition
- func CndEmpty() Condition
- func CndEq(field string, value interface{}) Condition
- func CndFull(linker Linker, field string, operation Operation, rawExpression string, ...) Condition
- func CndGe(field string, value interface{}) Condition
- func CndGt(field string, value interface{}) Condition
- func CndIn(field string, values ...interface{}) Condition
- func CndIsNotNull(field string) Condition
- func CndIsNull(field string) Condition
- func CndLe(field string, value interface{}) Condition
- func CndLike(field string, value interface{}) Condition
- func CndLikeIgnoreEnd(field string, value interface{}) Condition
- func CndLikeIgnoreStart(field string, value interface{}) Condition
- func CndLt(field string, value interface{}) Condition
- func CndNotEq(field string, value interface{}) Condition
- func CndNotIn(field string, values ...interface{}) Condition
- func CndRaw(rawExpresssion string, values ...interface{}) Condition
- func MapToCondition(maps map[string]interface{}) Condition
- func StructToCondition(vs interface{}, columns ...string) Condition
- type CountResult
- type DB
- func (db *DB) Begin() error
- func (db *DB) CleanDb() *DB
- func (db *DB) CleanOrders() *DB
- func (db DB) Clone() DB
- func (db *DB) Commit()
- func (db DB) Count(columnName string) (int64, error)
- func (db DB) Delete(vs ...interface{}) (int64, int64, error)
- func (db DB) DoTransaction(work TransactionWork) (interface{}, error)
- func (db DB) ExecuteRaw() (int64, int64, error)
- func (db DB) ExecuteStatement(statement string, data ...interface{}) (sql.Result, error)
- func (db DB) Factory() SqlFactory
- func (db DB) First(vs interface{}) (interface{}, error)
- func (db DB) GetCnd() Condition
- func (db DB) GetOrderBys() []OrderBy
- func (db DB) GetPage() (int64, int64)
- func (db DB) Insert(v interface{}, columns ...string) (int64, int64, error)
- func (db DB) IsInTransaction() bool
- func (db *DB) OrderBy(field string, t OrderType) *DB
- func (db *DB) OrderByAsc(field string) *DB
- func (db *DB) OrderByDesc(field string) *DB
- func (db *DB) OrderBys(orderbys []OrderBy) *DB
- func (db *DB) Page(page int64, pageSize int64) *DB
- func (db *DB) Raw(sql string, datas ...interface{}) *DB
- func (db DB) RawDb() *sql.DB
- func (db *DB) Rollback()
- func (db DB) Select(vs interface{}, columns ...string) (interface{}, error)
- func (db DB) SelectByModel(model TableModel) (interface{}, error)
- func (db DB) Sum(columnName string) (int64, error)
- func (db DB) Table(table string) DB
- func (db DB) Update(v interface{}, columns ...string) (int64, int64, error)
- func (db *DB) Where(cnd Condition) *DB
- func (db *DB) Where2(sql string, patches ...interface{}) *DB
- type DefaultModel
- func (d DefaultModel) Clone() TableModel
- func (d DefaultModel) ColumnDataMap() map[string]interface{}
- func (d DefaultModel) Columns() []string
- func (d DefaultModel) Condition() Condition
- func (d DefaultModel) GetScanners(columns []string) ([]interface{}, int, error)
- func (d DefaultModel) OrderBys() []OrderBy
- func (d DefaultModel) Page() PageInfo
- func (d DefaultModel) PrimaryAuto() bool
- func (d DefaultModel) Scan(rows *sql.Rows) (interface{}, error)
- func (d *DefaultModel) SetColumns(columns []string) error
- func (d *DefaultModel) SetCondition(c Condition) error
- func (d *DefaultModel) SetData(_ interface{}, valueOfData reflect.Value, isStruct bool, isPtr bool, ...)
- func (d *DefaultModel) SetOrderBys(orders []OrderBy) error
- func (d *DefaultModel) SetPage(p PageInfo) error
- func (d *DefaultModel) SetTable(tableName string)
- func (d DefaultModel) Table() string
- type DefaultStruct
- type EmptyScanner
- type GenerateSQLFunc
- type IScanner
- type ITableName
- type Linker
- type Operation
- type OrderBy
- type OrderByImpl
- type OrderType
- type PageImpl
- type PageInfo
- type RawTableInfo
- type ScanFunc
- type ScannerGenerateFunc
- type ScannerImpl
- type SqlFactory
- type SqlProto
- type SqlType
- type TableModel
- type TransactionWork
Constants ¶
This section is empty.
Variables ¶
View Source
var Debug bool
Functions ¶
func ArrayIntersect ¶ added in v2.0.2
func ByteArrayScan ¶ added in v2.0.2
func ByteArrayScan(src interface{}) (interface{}, error)
func CamelToSnakeString ¶ added in v2.0.2
func Float32Scan ¶ added in v2.0.2
func Float32Scan(src interface{}) (interface{}, error)
func Register ¶ added in v2.0.2
func Register(name string, inter SqlFactory)
func ScannerResultToStruct ¶ added in v2.0.2
func SliceToGroupSlice ¶ added in v2.0.2
func SliceToGroupSlice(vs interface{}) map[string][]interface{}
func StructToMap ¶ added in v2.0.2
func UnZipSlice ¶ added in v2.0.2
func UnZipSlice(vs interface{}) []interface{}
Types ¶
type CndImpl ¶ added in v2.0.2
type CndImpl struct {
// contains filtered or unexported fields
}
func (*CndImpl) HasSubConditions ¶ added in v2.0.2
func (*CndImpl) IsNotNullBool ¶ added in v2.0.2
func (*CndImpl) IsNullBool ¶ added in v2.0.2
func (*CndImpl) LikeIgnoreEnd ¶ added in v2.0.2
func (*CndImpl) LikeIgnoreEndBool ¶ added in v2.0.2
func (*CndImpl) LikeIgnoreStart ¶ added in v2.0.2
func (*CndImpl) LikeIgnoreStartBool ¶ added in v2.0.2
func (*CndImpl) OrIsNotNull ¶ added in v2.0.2
func (*CndImpl) OrIsNotNullBool ¶ added in v2.0.2
func (*CndImpl) OrIsNullBool ¶ added in v2.0.2
func (*CndImpl) OrLikeBool ¶ added in v2.0.2
func (*CndImpl) OrLikeIgnoreEnd ¶ added in v2.0.2
func (*CndImpl) OrLikeIgnoreEndBool ¶ added in v2.0.2
func (*CndImpl) OrLikeIgnoreStart ¶ added in v2.0.2
func (*CndImpl) OrLikeIgnoreStartBool ¶ added in v2.0.2
func (*CndImpl) OrNotEqBool ¶ added in v2.0.2
func (*CndImpl) OrNotInBool ¶ added in v2.0.2
func (*CndImpl) RawExpression ¶ added in v2.0.2
type Condition ¶ added in v2.0.2
type Condition interface { PayLoads() int64 //有效荷载,说明当前条件及其链式条件共有多少有多少个条件 Linker() Linker Field() string Operation() Operation Values() []interface{} SetValues([]interface{}) Items() []Condition HasSubConditions() bool RawExpression() string Eq(field string, values interface{}) Condition EqBool(b bool, field string, value interface{}) Condition OrEq(field string, value interface{}) Condition OrEqBool(b bool, field string, value interface{}) Condition Ge(field string, value interface{}) Condition GeBool(b bool, field string, value interface{}) Condition OrGe(field string, value interface{}) Condition OrGeBool(b bool, field string, value interface{}) Condition Gt(field string, values interface{}) Condition GtBool(b bool, field string, values interface{}) Condition OrGt(field string, values interface{}) Condition OrGtBool(b bool, field string, values interface{}) Condition Le(field string, values interface{}) Condition LeBool(b bool, field string, values interface{}) Condition OrLe(field string, values interface{}) Condition OrLeBool(b bool, field string, values interface{}) Condition Lt(field string, values interface{}) Condition LtBool(b bool, field string, values interface{}) Condition OrLt(field string, values interface{}) Condition OrLtBool(b bool, field string, values interface{}) Condition NotEq(field string, values interface{}) Condition NotEqBool(b bool, field string, values interface{}) Condition OrNotEq(field string, values interface{}) Condition OrNotEqBool(b bool, field string, values interface{}) Condition In(field string, values ...interface{}) Condition InBool(b bool, field string, values ...interface{}) Condition OrIn(field string, values ...interface{}) Condition OrInBool(b bool, field string, values ...interface{}) Condition NotIn(field string, values ...interface{}) Condition NotInBool(b bool, field string, values ...interface{}) Condition OrNotIn(field string, values ...interface{}) Condition OrNotInBool(b bool, field string, values ...interface{}) Condition Like(field string, values interface{}) Condition LikeBool(b bool, field string, values interface{}) Condition OrLike(field string, values interface{}) Condition OrLikeBool(b bool, field string, values interface{}) Condition LikeIgnoreStart(field string, values interface{}) Condition LikeIgnoreStartBool(b bool, field string, values interface{}) Condition OrLikeIgnoreStart(field string, values interface{}) Condition OrLikeIgnoreStartBool(b bool, field string, values interface{}) Condition LikeIgnoreEnd(field string, values interface{}) Condition LikeIgnoreEndBool(b bool, field string, values interface{}) Condition OrLikeIgnoreEnd(field string, values interface{}) Condition OrLikeIgnoreEndBool(b bool, field string, values interface{}) Condition IsNull(filed string) Condition IsNullBool(b bool, field string) Condition IsNotNull(field string) Condition IsNotNullBool(b bool, field string) Condition OrIsNull(filed string) Condition OrIsNullBool(b bool, field string) Condition OrIsNotNull(field string) Condition OrIsNotNullBool(b bool, field string) Condition And(field string, operation Operation, value ...interface{}) Condition AndBool(b bool, field string, operation Operation, value ...interface{}) Condition And2(condition Condition) Condition And3(rawExpresssion string, values ...interface{}) Condition And3Bool(b bool, rawExpresssion string, values ...interface{}) Condition Or(field string, operation Operation, value ...interface{}) Condition OrBool(b bool, field string, operation Operation, value ...interface{}) Condition Or2(condition Condition) Condition Or3(rawExpresssion string, values ...interface{}) Condition Or3Bool(b bool, rawExpresssion string, values ...interface{}) Condition }
func CndIsNotNull ¶ added in v2.0.3
func CndLikeIgnoreEnd ¶ added in v2.0.3
func CndLikeIgnoreStart ¶ added in v2.0.3
func MapToCondition ¶ added in v2.0.2
func StructToCondition ¶ added in v2.0.2
type CountResult ¶ added in v2.0.2
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func OpenWithConfig ¶
func (*DB) CleanOrders ¶
func (DB) DoTransaction ¶
func (db DB) DoTransaction(work TransactionWork) (interface{}, error)
func (DB) ExecuteStatement ¶
func (DB) Factory ¶ added in v2.0.2
func (db DB) Factory() SqlFactory
func (DB) GetOrderBys ¶ added in v2.0.2
func (DB) IsInTransaction ¶
func (*DB) OrderByAsc ¶
func (*DB) OrderByDesc ¶
func (DB) SelectByModel ¶
func (db DB) SelectByModel(model TableModel) (interface{}, error)
type DefaultModel ¶ added in v2.0.2
type DefaultModel struct {
// contains filtered or unexported fields
}
func (DefaultModel) Clone ¶ added in v2.0.2
func (d DefaultModel) Clone() TableModel
func (DefaultModel) ColumnDataMap ¶ added in v2.0.2
func (d DefaultModel) ColumnDataMap() map[string]interface{}
func (DefaultModel) Columns ¶ added in v2.0.2
func (d DefaultModel) Columns() []string
func (DefaultModel) Condition ¶ added in v2.0.2
func (d DefaultModel) Condition() Condition
func (DefaultModel) GetScanners ¶ added in v2.0.2
func (d DefaultModel) GetScanners(columns []string) ([]interface{}, int, error)
func (DefaultModel) OrderBys ¶ added in v2.0.2
func (d DefaultModel) OrderBys() []OrderBy
func (DefaultModel) Page ¶ added in v2.0.2
func (d DefaultModel) Page() PageInfo
func (DefaultModel) PrimaryAuto ¶ added in v2.0.2
func (d DefaultModel) PrimaryAuto() bool
func (DefaultModel) Scan ¶ added in v2.0.2
func (d DefaultModel) Scan(rows *sql.Rows) (interface{}, error)
func (*DefaultModel) SetColumns ¶ added in v2.0.2
func (d *DefaultModel) SetColumns(columns []string) error
func (*DefaultModel) SetCondition ¶ added in v2.0.2
func (d *DefaultModel) SetCondition(c Condition) error
func (*DefaultModel) SetOrderBys ¶ added in v2.0.2
func (d *DefaultModel) SetOrderBys(orders []OrderBy) error
func (*DefaultModel) SetPage ¶ added in v2.0.2
func (d *DefaultModel) SetPage(p PageInfo) error
func (*DefaultModel) SetTable ¶ added in v2.0.2
func (d *DefaultModel) SetTable(tableName string)
func (DefaultModel) Table ¶ added in v2.0.2
func (d DefaultModel) Table() string
type DefaultStruct ¶ added in v2.0.2
type DefaultStruct struct { }
type EmptyScanner ¶ added in v2.0.2
type EmptyScanner struct {
ColName string
}
var EMPTY_SCANNER *EmptyScanner = &EmptyScanner{}
func (EmptyScanner) Scan ¶ added in v2.0.2
func (e EmptyScanner) Scan(_ interface{}) error
type GenerateSQLFunc ¶ added in v2.0.2
type GenerateSQLFunc func(model ...TableModel) []SqlProto
type IScanner ¶ added in v2.0.2
func GetIScannerOfColumn ¶ added in v2.0.2
func GetIScannerOfColumn(col interface{}) IScanner
type ITableName ¶ added in v2.0.4
type ITableName interface {
TableName() string
}
type Operation ¶ added in v2.0.2
type Operation int
const ( Eq Operation NotEq Ge Gt Le Lt Like LikeIgnoreStart LikeIgnoreEnd In NotIn IsNull IsNotNull RawOperation )
type OrderBy ¶ added in v2.0.2
func MakeOrderBy ¶ added in v2.0.2
type OrderByImpl ¶ added in v2.0.2
type OrderByImpl struct {
// contains filtered or unexported fields
}
func (OrderByImpl) Name ¶ added in v2.0.2
func (o OrderByImpl) Name() string
func (OrderByImpl) Type ¶ added in v2.0.2
func (o OrderByImpl) Type() OrderType
type RawTableInfo ¶ added in v2.0.2
func GetRawTableInfo ¶ added in v2.0.2
func GetRawTableInfo(v interface{}) RawTableInfo
type ScannerGenerateFunc ¶ added in v2.0.2
type ScannerImpl ¶ added in v2.0.2
func (*ScannerImpl) Scan ¶ added in v2.0.2
func (scanner *ScannerImpl) Scan(src interface{}) error
type SqlFactory ¶ added in v2.0.2
type SqlFactory interface { GetSqlFunc(sqlType SqlType) GenerateSQLFunc ConditionToSql(preTag bool, condition Condition) (string, []interface{}) }
func Get ¶ added in v2.0.2
func Get(name string) (SqlFactory, bool)
type TableModel ¶ added in v2.0.2
type TableModel interface { Table() string SetTable(tableName string) Columns() []string SetColumns([]string) error SetData(data interface{}, valueOfData reflect.Value, isStruct bool, isPtr bool, isSlice bool) GetScanners(columns []string) ([]interface{}, int, error) PrimaryAuto() bool ColumnDataMap() map[string]interface{} Condition() Condition SetCondition(c Condition) error OrderBys() []OrderBy SetOrderBys(orders []OrderBy) error Page() PageInfo SetPage(p PageInfo) error Scan(rows *sql.Rows) (interface{}, error) Clone() TableModel }
func GetTableModel ¶ added in v2.0.2
func GetTableModel(v interface{}, choosedColumns ...string) (TableModel, error)
type TransactionWork ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.