Documentation ¶
Index ¶
- Constants
- Variables
- func Alias(funcStr, alias string) string
- func Use(funcName string, args ...interface{}) (funcStr string, err error)
- type Engine
- func (engine *Engine) Column(columns ...string) *Session
- func (engine *Engine) ColumnValue(columns []string, elemBean interface{}) ([]interface{}, error)
- func (engine *Engine) DB() *sqlx.DB
- func (engine *Engine) Exec(query string, args ...interface{}) (sql.Result, error)
- func (engine *Engine) FindWithSql(obj interface{}, query string, args ...interface{}) (err error)
- func (engine *Engine) GetColumns(bean interface{}) []string
- func (engine *Engine) GetWithSQL(dest interface{}, query string, args ...interface{}) (err error)
- func (engine *Engine) GroupBy(groupBys ...string) *Session
- func (engine *Engine) Having(pred string, rest ...interface{}) *Session
- func (engine *Engine) Join(join string, rest ...interface{}) *Session
- func (engine *Engine) LeftJoin(join string, rest ...interface{}) *Session
- func (engine *Engine) Limit(limit int64, offset ...int64) *Session
- func (engine *Engine) NewSession() *Session
- func (engine *Engine) NotFromTable() *Session
- func (engine *Engine) Options(options ...string) *Session
- func (engine *Engine) Order(orderBys ...string) *Session
- func (engine *Engine) RightJoin(join string, rest ...interface{}) *Session
- func (engine *Engine) Table(name string) *Session
- func (engine *Engine) UseFunc(funcName, alias string, args ...interface{}) *Session
- func (engine *Engine) Where(pred string, args ...interface{}) *Session
- type Session
- func (session *Session) Clone() *Session
- func (session *Session) Close()
- func (session *Session) Column(columns ...string) *Session
- func (session *Session) ColumnValue(columns []string, elemBean interface{}) ([]interface{}, error)
- func (session *Session) DB() *sqlx.DB
- func (session *Session) Exec(query string, args ...interface{}) (sql.Result, error)
- func (session *Session) Find(obj interface{}) (err error)
- func (session *Session) FindWithSql(obj interface{}, query string, args ...interface{}) (err error)
- func (session *Session) GenFindSQL(obj interface{}) *Session
- func (session *Session) GenInsertSQL(obj interface{}) *Session
- func (session *Session) GetColumns(bean interface{}) []string
- func (session *Session) GetWithSQL(dest interface{}, query string, args ...interface{}) (err error)
- func (session *Session) GroupBy(groupBys ...string) *Session
- func (session *Session) Having(pred string, rest ...interface{}) *Session
- func (session *Session) ID(id uint64) *Session
- func (session *Session) Init()
- func (session *Session) Insert(bean interface{}) (err error)
- func (session *Session) InsertCHMulti(bean interface{}, args [][]interface{}) (err error)
- func (session *Session) Join(join string, rest ...interface{}) *Session
- func (session *Session) LeftJoin(join string, rest ...interface{}) *Session
- func (session *Session) Limit(limit int64, offset ...int64) *Session
- func (session *Session) NotFromTable() *Session
- func (session *Session) Options(options ...string) *Session
- func (session *Session) Order(orderBys ...string) *Session
- func (session *Session) RightJoin(join string, rest ...interface{}) *Session
- func (session *Session) Table(from string) *Session
- func (session *Session) ToSql() (sql string)
- func (session *Session) UseFunc(funcName, alias string, args ...interface{}) *Session
- func (session *Session) Values(values ...interface{}) *Session
- func (session *Session) Where(pred string, args ...interface{}) *Session
Constants ¶
View Source
const ( BIFPlus = "plus" //plus(a, b), a + b operator BIFMinus = "minus" //minus(a, b), a - b operator BIFMultiply = "multiply" //multiply(a, b), a * b operator BIFDivide = "divide" //divide(a, b), a / b operator BIFIntDiv = "intDiv" //intDiv(a, b) BIFIntDivOrZero = "intDivOrZero" //intDivOrZero(a, b) BIFModulo = "modulo" //modulo(a, b), a % b operator BIFNegate = "negate" //negate(a), -a operator BIFAbs = "abs" //abs(a) {#arithm_func-abs} BIFGcd = "gcd" //gcd(a, b) BIFLcm = "lcm" //lcm(a, b) )
Arithmetic functions
For all arithmetic functions, the result type is calculated as the smallest number type that the result fits in, if there is such a type. The minimum is taken simultaneously based on the number of bits, whether it is signed, and whether it floats. If there are not enough bits, the highest bit type is taken.
View Source
const ( BIFEmpty = "empty" //empty BIFNotEmpty = "notEmpty" //notEmpty BIFLength = "length" //length BIFEmptyArrayUInt8 = "emptyArrayUInt8" //emptyArrayUInt8 BIFEmptyArrayUInt16 = "emptyArrayUInt16" //emptyArrayUInt16 BIFEmptyArrayUInt32 = "emptyArrayUInt32" //emptyArrayUInt32 BIFEmptyArrayUInt64 = "emptyArrayUInt64" //emptyArrayUInt64 BIFEmptyArrayInt8 = "emptyArrayInt8" //emptyArrayInt8 BIFEmptyArrayInt16 = "emptyArrayInt16" //emptyArrayInt16 BIFEmptyArrayInt32 = "emptyArrayInt32" //emptyArrayInt32 BIFEmptyArrayInt64 = "emptyArrayInt64" //emptyArrayInt64 BIFEmptyArrayFloat32 = "emptyArrayFloat32" //emptyArrayFloat32 BIFEmptyArrayFloat64 = "emptyArrayFloat64" //emptyArrayFloat64 BIFEmptyArrayDate = "emptyArrayDate" //emptyArrayDate BIFEmptyArrayDateTime = "emptyArrayDateTime" //emptyArrayDateTime BIFEmptyArrayString = "emptyArrayString" //emptyArrayString BIFEmptyArrayToSingle = "emptyArrayToSingle" //emptyArrayToSingle BIFRange = "range" //range(N) BIFArray = "array" //array(x1, ...), operator [x1, ...] BIFArrayConcat = "arrayConcat" //arrayConcat(arrays) BIFArrayElement = "arrayElement" //arrayElement(arr, n), operator arr[n] BIFHas = "has" //has(arr, elem) BIFHasAll = "hasAll" //hasAll(set, subset) BIFHasAny = "hasAny" //hasAny(array1, array2) BIFIndexOf = "indexOf" //indexOf(arr, x) BIFCountEqual = "countEqual" //countEqual(arr, x) BIFArrayEnumerate = "arrayEnumerate" //arrayEnumerate(arr) BIFArrayEnumerateUniq = "arrayEnumerateUniq" //arrayEnumerateUniq(arr, ...) BIFArrayPopBack = "arrayPopBack" //arrayPopBack(array) BIFArrayPopFront = "arrayPopFront" //arrayPopFront(array) BIFArrayPushBack = "arrayPushBack" //arrayPushBack(array, single_value) BIFArrayPushFront = "arrayPushFront" //arrayPushFront(array, single_value) BIFArrayResize = "arrayResize" //arrayResize(array, size[, extender]) BIFArraySlice = "arraySlice" //arraySlice(array, offset[, length]) BIFArraySort = "arraySort" //arraySort([func,] arr, ...) BIFArrayReverseSort = "arrayReverseSort" //arrayReverseSort([func,] arr, ...) BIFArrayUniq = "arrayUniq" //arrayUniq(arr, ...) BIFArrayJoin = "arrayJoin" //arrayJoin(arr):SELECT arrayJoin([1, 2, 3] AS src) AS dst, 'Hello', src BIFArrayDifference = "arrayDifference" //arrayDifference(arr) BIFArrayDistinct = "arrayDistinct" //arrayDistinct(arr) BIFArrayEnumerateDense = "arrayEnumerateDense" //arrayEnumerateDense(arr) BIFArrayIntersect = "arrayIntersect" //arrayIntersect(arr) BIFArrayReduce = "arrayReduce" //arrayReduce(agg_func, arr1, ...) BIFArrayReverse = "arrayReverse" //arrayReverse(arr) )
Functions for working with arrays
View Source
const ( BIFBitAnd = "bitAnd" //bitAnd(a, b) BIFBitOr = "bitOr" //bitOr(a, b) BIFBitXor = "bitXor" //bitXor(a, b) BIFBitNot = "bitNot" //bitNot(a) BIFBitShiftLeft = "bitShiftLeft" //bitShiftLeft(a, b) BIFBitShiftRight = "bitShiftRight" //bitShiftRight(a, b) BIFBitRotateLeft = "bitRotateLeft" //bitRotateLeft(a, b) BIFBitRotateRight = "bitRotateRight" //bitRotateRight(a, b) BIFBitTest = "bitTest" //bitTest(a, b) BIFBitTestAll = "bitTestAll" //bitTestAll(a, b) BIFBitTestAny = "bitTestAny" //bitTestAny(a, b) )
Bit functions
View Source
const ( BIFHex = "hex" BIFUnhex = "unhex" BIFUUIDStringToNum = "UUIDStringToNum" BIFUUIDNumToString = "UUIDNumToString" BIFBitmaskToList = "bitmaskToList" BIFBitmaskToArray = "bitmaskToArray" )
Encoding functions
View Source
const ( BIFE = "e" BIFPi = "pi" BIFExp = "exp" BIFLog = "log" BIFLn = "ln" BIFExp2 = "exp2" BIFLog2 = "log2" BIFExp10 = "exp10" BIFLog10 = "log10" BIFSqrt = "sqrt" BIFCbrt = "cbrt" BIFErf = "erf" BIFErfc = "erfc" BIFLgamma = "lgamma" BIFTgamma = "tgamma" BIFSin = "sin" BIFCos = "cos" BIFTan = "tan" BIFAsin = "asin" BIFAcos = "acos" BIFAtan = "atan" BIFPow = "pow" BIFPower = "power" BIFIntExp2 = "intExp2" BIFIntExp10 = "intExp10" )
View Source
const ( BIFProtocol = "protocol" //protocol,Returns the protocol. Examples: http, ftp, mailto, magnet... BIFDomain = "domain" //domain,Gets the domain. Cut scheme with size less than 16 bytes. BIFDomainWithoutWWW = "domainWithoutWWW" //domainWithoutWWW BIFTopLevelDomain = "topLevelDomain" //topLevelDomain BIFFirstSignificantSubdomain = "firstSignificantSubdomain" //firstSignificantSubdomain BIFCutToFirstSignificantSubdomain = "cutToFirstSignificantSubdomain" //cutToFirstSignificantSubdomain BIFPath = "path" //path BIFPathFull = "pathFull" //pathFull BIFQueryString = "queryString" //queryString BIFFragment = "fragment" //fragment BIFURLHierarchy = "URLHierarchy" //URLHierarchy(URL) BIFURLPathHierarchy = "URLPathHierarchy" //URLPathHierarchy(URL) BIFDecodeURLComponent = "decodeURLComponent" //decodeURLComponent(URL) BIFCutWWW = "cutWWW" //cutWWW BIFCutQueryString = "cutQueryString" //cutQueryString BIFCutFragment = "cutFragment" //cutFragment BIFCutQueryStringAndFragment = "cutQueryStringAndFragment" //cutQueryStringAndFragment BIFCutURLParameter = "cutURLParameter" //cutURLParameter(URL, name) )
Functions for working with URLs
View Source
const ( BIFGenerateUUIDv4 = "generateUUIDv4" //generateUUIDv4() BIFToUUID = "toUUID" //toUUID(String) )
Functions for working with UUID
Variables ¶
View Source
var ( ErrorWithoutPrepare = errors.New("error: prepare is false") ErrorWithoutStmt = errors.New("error: stmt is nil") ErrParamsType = errors.New("error: param type error") ErrTableNotFound = errors.New("error: table not found") ErrNotSupportInsertType = errors.New("error: not support type") ErrNotSupportFindType = errors.New("error: not support type") ErrOnlySupportPtr = errors.New("must pass a pointer, not a value, to StructScan destination") ErrNotSupportNilPtr = errors.New("nil pointer passed to StructScan destination") )
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) ColumnValue ¶
func (*Engine) FindWithSql ¶
FindWithSql
func (*Engine) GetColumns ¶
func (*Engine) GetWithSQL ¶
GetWithSQL
func (*Engine) NotFromTable ¶
NotFromTable 如果使用函数生成,不从表中读取数据
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) ColumnValue ¶
func (*Session) FindWithSql ¶
FindWithSql 使用定义的sql去查询结果
func (*Session) GenFindSQL ¶
GenFindSQL 生成查询使用的代码
func (*Session) GenInsertSQL ¶
func (*Session) GetColumns ¶
func (*Session) GetWithSQL ¶
func (*Session) InsertCHMulti ¶
func (*Session) NotFromTable ¶
NotFromTable 如果使用函数生成,不从表中读取数据
Click to show internal directories.
Click to hide internal directories.