Versions in this module Expand all Collapse all v2 v2.21.1 Jan 28, 2022 Changes in this version + var ToggleMultiTable = "MultiTable" + var ToggleNeedAutoAlias = "NeedAlias" + var ToggleUseValues = "UseValues" + var UpdateNeedLimitByWhere = errors.New("no where limit for update") + func Alias(expr SqlExpr, name string) *exAlias + func Comment(c string) *comment + func ContextWithToggles(ctx context.Context, toggles Toggles) context.Context + func CrossJoin(table SqlExpr) *join + func Expect() *combination + func ForEachStructFieldValue(ctx context.Context, rv reflect.Value, fn func(*StructField)) + func FullJoin(table SqlExpr) *join + func GetColumnName(fieldName, tagValue string) string + func GroupBy(groups ...SqlExpr) *groupBy + func InnerJoin(table SqlExpr) *join + func Intersect() *combination + func IsNilExpr(e SqlExpr) bool + func Join(table SqlExpr, prefixes ...string) *join + func LeftJoin(table SqlExpr) *join + func Limit(rowCount int64) *limit + func MultiMayAutoAlias(columns ...SqlExpr) *exMayAutoAlias + func OnConflict(columns *Columns) *onConflict + func OrderBy(orders ...*Order) *orderBy + func RangeNotNilExpr(exprs []SqlExpr, each func(e SqlExpr, i int)) + func ResolveIndexNameAndMethod(n string) (name string, method string) + func RightJoin(table SqlExpr) *join + func ScanDefToTable(rv reflect.Value, table *Table) + func TableAliasFromContext(ctx context.Context) string + func TableNameFromContext(ctx context.Context) string + func ToMap(list []string) map[string]bool + func Union() *combination + func Where(c SqlCondition) *where + func WithTableAlias(tableName string) func(ctx context.Context) context.Context + func WithTableName(tableName string) func(ctx context.Context) context.Context + func WriteAdditions(e *Ex, additions ...Addition) + func WriteAssignments(e *Ex, assignments ...*Assignment) + type Addition interface + AdditionType func() AdditionType + type AdditionType int + const AdditionCombination + const AdditionComment + const AdditionGroupBy + const AdditionJoin + const AdditionLimit + const AdditionOnConflict + const AdditionOrderBy + const AdditionOther + const AdditionWhere + type Additions []Addition + func (additions Additions) Len() int + func (additions Additions) Less(i, j int) bool + func (additions Additions) Swap(i, j int) + type Assignment struct + func ColumnsAndValues(columnOrColumns SqlExpr, values ...interface{}) *Assignment + func (a *Assignment) Ex(ctx context.Context) *Ex + func (a *Assignment) IsNil() bool + type Assignments []*Assignment + type BuildSubQuery func(table *Table) SqlExpr + type Column struct + Description []string + FieldName string + Name string + Relation []string + Table *Table + func Col(name string) *Column + func (c *Column) Between(leftValue interface{}, rightValue interface{}) SqlCondition + func (c *Column) Desc(d int) SqlExpr + func (c *Column) Eq(v interface{}) SqlCondition + func (c *Column) Ex(ctx context.Context) *Ex + func (c *Column) Expr(query string, args ...interface{}) *Ex + func (c *Column) Gt(v interface{}) SqlCondition + func (c *Column) Gte(v interface{}) SqlCondition + func (c *Column) In(args ...interface{}) SqlCondition + func (c *Column) Incr(d int) SqlExpr + func (c *Column) IsNil() bool + func (c *Column) IsNotNull() SqlCondition + func (c *Column) IsNull() SqlCondition + func (c *Column) LeftLike(v string) SqlCondition + func (c *Column) Like(v string) SqlCondition + func (c *Column) Lt(v interface{}) SqlCondition + func (c *Column) Lte(v interface{}) SqlCondition + func (c *Column) Neq(v interface{}) SqlCondition + func (c *Column) NotBetween(leftValue interface{}, rightValue interface{}) SqlCondition + func (c *Column) NotIn(args ...interface{}) SqlCondition + func (c *Column) NotLike(v string) SqlCondition + func (c *Column) Of(table *Table) *Column + func (c *Column) RightLike(v string) SqlCondition + func (c *Column) T() *Table + func (c *Column) ValueBy(v interface{}) *Assignment + func (c Column) Field(fieldName string) *Column + func (c Column) Full() *Column + func (c Column) On(table *Table) *Column + func (c Column) Type(v interface{}, tagValue string) *Column + type ColumnType struct + AutoIncrement bool + Comment string + Decimal uint64 + Default *string + DeprecatedActions *DeprecatedActions + GetDataType func(engine string) string + Length uint64 + Null bool + OnUpdate *string + Type reflect.Type + func ColumnTypeFromTypeAndTag(typ reflect.Type, nameAndFlags string) *ColumnType + type Columns struct + func Cols(names ...string) *Columns + func (cols *Columns) Add(columns ...*Column) + func (cols *Columns) AutoIncrement() (col *Column) + func (cols *Columns) Clone() *Columns + func (cols *Columns) Col(columnName string) (col *Column) + func (cols *Columns) Cols(colNames ...string) (*Columns, error) + func (cols *Columns) Ex(ctx context.Context) *Ex + func (cols *Columns) F(fileName string) (col *Column) + func (cols *Columns) FieldNames() []string + func (cols *Columns) Fields(fieldNames ...string) (*Columns, error) + func (cols *Columns) IsNil() bool + func (cols *Columns) Len() int + func (cols *Columns) List() (l []*Column) + func (cols *Columns) MustFields(fieldNames ...string) *Columns + func (cols *Columns) Range(cb func(col *Column, idx int)) + func (cols *Columns) Remove(name string) + type CombinationAddition struct + func (CombinationAddition) AdditionType() AdditionType + type CommentAddition struct + func (CommentAddition) AdditionType() AdditionType + type ComposedCondition struct + func (c *ComposedCondition) And(cond SqlCondition) SqlCondition + func (c *ComposedCondition) Ex(ctx context.Context) *Ex + func (c *ComposedCondition) IsNil() bool + func (c *ComposedCondition) Or(cond SqlCondition) SqlCondition + func (c *ComposedCondition) Xor(cond SqlCondition) SqlCondition + type Condition struct + func AsCond(ex SqlExpr) *Condition + func (c *Condition) And(cond SqlCondition) SqlCondition + func (c *Condition) Ex(ctx context.Context) *Ex + func (c *Condition) IsNil() bool + func (c *Condition) Or(cond SqlCondition) SqlCondition + func (c *Condition) Xor(cond SqlCondition) SqlCondition + type DataTypeDescriber interface + DataType func(driverName string) string + type DeprecatedActions struct + RenameTo string + type Dialect interface + AddColumn func(col *Column) SqlExpr + AddIndex func(key *Key) SqlExpr + CreateDatabase func(dbName string) SqlExpr + CreateSchema func(schemaName string) SqlExpr + CreateTableIsNotExists func(t *Table) []SqlExpr + DataType func(columnType *ColumnType) SqlExpr + DriverName func() string + DropColumn func(col *Column) SqlExpr + DropDatabase func(dbName string) SqlExpr + DropIndex func(key *Key) SqlExpr + DropTable func(t *Table) SqlExpr + IsErrorConflict func(err error) bool + IsErrorUnknownDatabase func(err error) bool + ModifyColumn func(col *Column, prev *Column) SqlExpr + PrimaryKeyName func() string + RenameColumn func(col *Column, target *Column) SqlExpr + TruncateTable func(t *Table) SqlExpr + type Ex struct + func ColumnsByStruct(v interface{}) *Ex + func Expr(query string, args ...interface{}) *Ex + func ResolveExpr(v interface{}) *Ex + func ResolveExprContext(ctx context.Context, v interface{}) *Ex + func (e *Ex) AppendArgs(args ...interface{}) + func (e *Ex) Args() []interface{} + func (e *Ex) ArgsLen() int + func (e *Ex) Err() error + func (e *Ex) IsNil() bool + func (e *Ex) Query() string + func (e *Ex) WhiteComments(comments []byte) + func (e *Ex) WriteEnd() + func (e *Ex) WriteExpr(expr SqlExpr) + func (e *Ex) WriteGroup(fn func(e *Ex)) + func (e *Ex) WriteHolder(idx int) + func (e Ex) Ex(ctx context.Context) *Ex + type FieldValues map[string]interface + func FieldValuesFromStructBy(structValue interface{}, fieldNames []string) (fieldValues FieldValues) + func FieldValuesFromStructByNonZero(structValue interface{}, excludes ...string) (fieldValues FieldValues) + type Function struct + func Avg(sqlExprs ...SqlExpr) *Function + func Count(sqlExprs ...SqlExpr) *Function + func Distinct(sqlExprs ...SqlExpr) *Function + func First(sqlExprs ...SqlExpr) *Function + func Func(name string, sqlExprs ...SqlExpr) *Function + func Last(sqlExprs ...SqlExpr) *Function + func Max(sqlExprs ...SqlExpr) *Function + func Min(sqlExprs ...SqlExpr) *Function + func Sum(sqlExprs ...SqlExpr) *Function + func (f *Function) Ex(ctx context.Context) *Ex + func (f *Function) IsNil() bool + type GroupByAddition struct + func (GroupByAddition) AdditionType() AdditionType + type Indexes map[string][]string + type JoinAddition struct + func (JoinAddition) AdditionType() AdditionType + type Key struct + Columns *Columns + IsUnique bool + Method string + Name string + Table *Table + func Index(name string, columns *Columns) *Key + func PrimaryKey(columns *Columns) *Key + func UniqueIndex(name string, columns *Columns) *Key + func (key *Key) IsPrimary() bool + func (key *Key) T() *Table + func (key Key) On(table *Table) *Key + func (key Key) Using(method string) *Key + type Keys struct + func (keys *Keys) Add(nextKeys ...*Key) + func (keys *Keys) Clone() *Keys + func (keys *Keys) IsEmpty() bool + func (keys *Keys) Key(keyName string) (key *Key) + func (keys *Keys) Len() int + func (keys *Keys) Range(cb func(key *Key, idx int)) + func (keys *Keys) Remove(name string) + type LimitAddition struct + func (LimitAddition) AdditionType() AdditionType + type Model interface + TableName func() string + type OnConflictAddition struct + func (OnConflictAddition) AdditionType() AdditionType + type Order struct + func AscOrder(target SqlExpr) *Order + func DescOrder(target SqlExpr) *Order + func (o *Order) Ex(ctx context.Context) *Ex + func (o *Order) IsNil() bool + type OrderByAddition struct + func (OrderByAddition) AdditionType() AdditionType + type OtherAddition struct + func AsAddition(expr SqlExpr) *OtherAddition + func ForUpdate() *OtherAddition + func OnDuplicateKeyUpdate(assignments ...*Assignment) *OtherAddition + func Returning(expr SqlExpr) *OtherAddition + func (OtherAddition) AdditionType() AdditionType + func (a *OtherAddition) IsNil() bool + type SelectStatement interface + type SqlAssignment interface + type SqlAssignmentMarker interface + type SqlCondition interface + And func(cond SqlCondition) SqlCondition + Or func(cond SqlCondition) SqlCondition + Xor func(cond SqlCondition) SqlCondition + func And(conditions ...SqlCondition) SqlCondition + func EmptyCond() SqlCondition + func Or(conditions ...SqlCondition) SqlCondition + func Xor(conditions ...SqlCondition) SqlCondition + type SqlConditionMarker interface + type SqlExpr interface + Ex func(ctx context.Context) *Ex + IsNil func() bool + func ExprBy(build func(ctx context.Context) *Ex) SqlExpr + func Multi(exprs ...SqlExpr) SqlExpr + func MultiWith(connector string, exprs ...SqlExpr) SqlExpr + type StmtDelete struct + func Delete() *StmtDelete + func (s *StmtDelete) Ex(ctx context.Context) *Ex + func (s *StmtDelete) IsNil() bool + func (s StmtDelete) From(table *Table, additions ...Addition) *StmtDelete + type StmtInsert struct + func Insert(modifiers ...string) *StmtInsert + func (s *StmtInsert) Ex(ctx context.Context) *Ex + func (s *StmtInsert) IsNil() bool + func (s StmtInsert) Into(table *Table, additions ...Addition) *StmtInsert + func (s StmtInsert) Values(cols *Columns, values ...interface{}) *StmtInsert + type StmtSelect struct + func Select(sqlExpr SqlExpr, modifiers ...string) *StmtSelect + func (s *StmtSelect) Ex(ctx context.Context) *Ex + func (s *StmtSelect) IsNil() bool + func (s StmtSelect) From(table *Table, additions ...Addition) *StmtSelect + type StmtUpdate struct + func Update(table *Table, modifiers ...string) *StmtUpdate + func (s *StmtUpdate) Ex(ctx context.Context) *Ex + func (s *StmtUpdate) IsNil() bool + func (s StmtUpdate) Set(assignments ...*Assignment) *StmtUpdate + func (s StmtUpdate) Where(c SqlCondition, additions ...Addition) *StmtUpdate + type StructField struct + ColumnName string + Field reflect.StructField + TableName string + TagValue string + Value reflect.Value + type Table struct + Description []string + Model Model + ModelName string + Name string + Schema string + func T(tableName string, tableDefinitions ...TableDefinition) *Table + func TableFromModel(model Model) *Table + func (t *Table) AddCol(d *Column) + func (t *Table) AddKey(key *Key) + func (t *Table) AssignmentsByFieldValues(fieldValues FieldValues) (assignments Assignments) + func (t *Table) ColumnsAndValuesByFieldValues(fieldValues FieldValues) (columns *Columns, args []interface{}) + func (t *Table) Diff(prevTable *Table, dialect Dialect) (exprList []SqlExpr) + func (t *Table) Ex(ctx context.Context) *Ex + func (t *Table) Expr(query string, args ...interface{}) *Ex + func (t *Table) IsNil() bool + func (t *Table) TableName() string + func (t Table) WithSchema(schema string) *Table + type TableDefinition interface + T func() *Table + type Tables struct + func (tables *Tables) Add(tabs ...*Table) + func (tables *Tables) Model(structName string) *Table + func (tables *Tables) Range(cb func(tab *Table, idx int)) + func (tables *Tables) Remove(name string) + func (tables *Tables) Table(tableName string) *Table + func (tables *Tables) TableNames() (names []string) + type Toggles map[string]bool + func TogglesFromContext(ctx context.Context) Toggles + func (toggles Toggles) Is(key string) bool + func (toggles Toggles) Merge(next Toggles) Toggles + type ValuerExpr interface + ValueEx func() string + type WhereAddition struct + func (WhereAddition) AdditionType() AdditionType + type WithColDescriptions interface + ColDescriptions func() map[string][]string + type WithComments interface + Comments func() map[string]string + type WithIndexes interface + Indexes func() Indexes + type WithPrimaryKey interface + PrimaryKey func() []string + type WithRelations interface + ColRelations func() map[string][]string + type WithStmt struct + func With(t *Table, build BuildSubQuery, modifiers ...string) *WithStmt + func WithRecursive(t *Table, build BuildSubQuery) *WithStmt + func (w *WithStmt) Ex(ctx context.Context) *Ex + func (w *WithStmt) IsNil() bool + func (w WithStmt) Exec(statement func(tables ...*Table) SqlExpr) *WithStmt + func (w WithStmt) With(t *Table, build BuildSubQuery) *WithStmt + type WithTableDescription interface + TableDescription func() []string + type WithUniqueIndexes interface + UniqueIndexes func() Indexes