Versions in this module Expand all Collapse all v1 v1.0.0 May 11, 2026 Changes in this version + func EscapeString(value string) string + func Union(queries ...*Q) (string, error) + type Column string + type DBInterface interface + BeginTx func(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) + Close func() + Exec func(query string, args ...interface{}) (sql.Result, error) + ExecMany func(stmts []string, chunkSize int) (e error) + Host func() string + Name func() string + Query func(query string, args ...interface{}) (*sql.Rows, error) + QueryRow func(query string, args ...interface{}) *sql.Row + type Field struct + As string + FieldType FieldType + Name Column + Raw string + func NewField(fieldType FieldType, column Column, opts ...string) *Field + func NewRawField(raw string) *Field + func (f *Field) String(dbAlias string) string + type FieldType int + const FieldTypeAvg + const FieldTypeBasic + const FieldTypeCount + const FieldTypeDistinct + const FieldTypeMax + const FieldTypeMin + const FieldTypeRaw + const FieldTypeSum + type ModelInterface interface + Create func(db DBInterface) error + Delete func(db DBInterface) error + String func() string + Table_Column_Types func() map[Column]string + Table_Columns func() []Column + Table_InsertColumns func() []Column + Table_Name func() TableName + Table_PrimaryKey func() Column + Table_PrimaryKey_Value func() int64 + Table_UpdateColumns func() []Column + Update func(db DBInterface) error + type OrderDir int + const OrderDirASC + const OrderDirDESC + func OrderDirFromString(s string) OrderDir + func (q OrderDir) String() string + type Q struct + func Delete(model ModelInterface) *Q + func Insert(model ModelInterface) *Q + func Query(model ModelInterface) *Q + func Raw(model ModelInterface, query string) *Q + func Select(model ModelInterface) *Q + func Update(model ModelInterface) *Q + func (q *Q) Alias(alias string) *Q + func (q *Q) Avg(name Column, as string) *Q + func (q *Q) Count(name Column, as string) *Q + func (q *Q) Distinct(name Column) *Q + func (q *Q) Field(name Column) *Q + func (q *Q) FieldAs(name Column, as string) *Q + func (q *Q) FieldRaw(fieldStr, as string) *Q + func (q *Q) Fields(fields ...*Field) *Q + func (q *Q) GroupBy(col ...Column) *Q + func (q *Q) GroupByColumns(cols ...Column) *Q + func (q *Q) Limit(limit, offset int64) *Q + func (q *Q) LimitPage(limit, page int64) *Q + func (q *Q) Max(name Column, as string) *Q + func (q *Q) Min(name Column, as string) *Q + func (q *Q) OrderBy(col Column, dir OrderDir) *Q + func (q *Q) Raw(query string) *Q + func (q *Q) Set(fieldName Column, value interface{}) *Q + func (q *Q) String() (string, error) + func (q *Q) Sum(name Column, as string) *Q + func (q *Q) Where(args ...*WherePart) *Q + type QueryErrorType string + const QUERY_ERROR_EMPTY_WHERE_CLAUSE + const QUERY_ERROR_INVALID_COLUMN + const QUERY_ERROR_INVALID_VALUE + type QueryType int + const QueryTypeDelete + const QueryTypeInsert + const QueryTypeRaw + const QueryTypeSelect + const QueryTypeUpdate + type TableName string + type WherePart struct + func And(args ...*WherePart) *WherePart + func Ands(args ...*WherePart) *WherePart + func Between(fieldName Column, from, to interface{}) *WherePart + func BetweenFloats(fieldName Column, from, to float64) *WherePart + func BetweenInt64s(fieldName Column, from, to int64) *WherePart + func BetweenInts(fieldName Column, from, to int) *WherePart + func BetweenStrings(fieldName Column, from, to string) *WherePart + func BitAnd(fieldName Column, a, b int64) *WherePart + func EQ(fieldName Column, value interface{}) *WherePart + func EQF(fieldName1, fieldName2 string) *WherePart + func EQFloat(fieldName Column, value float64) *WherePart + func EQInt(fieldName Column, value int) *WherePart + func EQInt64(fieldName Column, value int64) *WherePart + func EQString(fieldName Column, value string) *WherePart + func Exists(clause *Q) *WherePart + func GT(fieldName Column, value interface{}) *WherePart + func GTFloat(fieldName Column, value float64) *WherePart + func GTInt(fieldName Column, value int) *WherePart + func GTInt64(fieldName Column, value int64) *WherePart + func GTOE(fieldName Column, value interface{}) *WherePart + func GTOEFloat(fieldName Column, value float64) *WherePart + func GTOEInt(fieldName Column, value int) *WherePart + func GTOEInt64(fieldName Column, value int64) *WherePart + func IN(fieldName Column, values ...interface{}) *WherePart + func INInt(fieldName Column, values ...int) *WherePart + func INInt64(fieldName Column, values ...int64) *WherePart + func INString(fieldName Column, values ...string) *WherePart + func IsNotNull(fieldName Column) *WherePart + func IsNull(fieldName Column) *WherePart + func LT(fieldName Column, value interface{}) *WherePart + func LTFloat(fieldName Column, value float64) *WherePart + func LTInt(fieldName Column, value int) *WherePart + func LTInt64(fieldName Column, value int64) *WherePart + func LTOE(fieldName Column, value interface{}) *WherePart + func LTOEFloat(fieldName Column, value float64) *WherePart + func LTOEInt(fieldName Column, value int) *WherePart + func LTOEInt64(fieldName Column, value int64) *WherePart + func Like(fieldName Column, value string) *WherePart + func Mod(fieldName Column, value, remainder int64) *WherePart + func Modf(value int64, fieldName Column, remainder int64) *WherePart + func NE(fieldName Column, value interface{}) *WherePart + func NEF(fieldName1, fieldName2 string) *WherePart + func NEFloat(fieldName Column, value float64) *WherePart + func NEInt(fieldName Column, value int) *WherePart + func NEInt64(fieldName Column, value int64) *WherePart + func NEString(fieldName Column, value string) *WherePart + func NOTIN(fieldName Column, values ...interface{}) *WherePart + func NOTINFloat(fieldName Column, values ...float64) *WherePart + func NOTINInt(fieldName Column, values ...int) *WherePart + func NOTINInt64(fieldName Column, values ...int64) *WherePart + func NOTINString(fieldName Column, values ...string) *WherePart + func NotExists(clause *Q) *WherePart + func NotLike(fieldName Column, value string) *WherePart + func Or(args ...*WherePart) *WherePart + func Ors(args ...*WherePart) *WherePart + func PE() *WherePart + func PS() *WherePart + func Paren(args ...*WherePart) *WherePart + func Rawf(str string, args ...interface{}) *WherePart + func WhereAll() *WherePart + type WhereType int + const WhereTypeAll + const WhereTypeAnd + const WhereTypeBetween + const WhereTypeBitAnd + const WhereTypeEquals + const WhereTypeEqualsField + const WhereTypeExists + const WhereTypeGreaterThan + const WhereTypeGreaterThanOrEqualTo + const WhereTypeIN + const WhereTypeIsNotNull + const WhereTypeIsNull + const WhereTypeLessThan + const WhereTypeLessThanOrEqualTo + const WhereTypeLike + const WhereTypeMod + const WhereTypeModF + const WhereTypeNone + const WhereTypeNotEquals + const WhereTypeNotEqualsField + const WhereTypeNotExists + const WhereTypeNotIN + const WhereTypeNotLike + const WhereTypeOr + const WhereTypeParenthesisEnd + const WhereTypeParenthesisStart + const WhereTypeRaw