builder

package
v2.23.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 17 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ToggleMultiTable    = "MultiTable"
	ToggleNeedAutoAlias = "NeedAlias"
	ToggleUseValues     = "UseValues"
)
View Source
var (
	UpdateNeedLimitByWhere = errors.New("no where limit for update")
)

Functions

func Alias added in v2.2.0

func Alias(expr SqlExpr, name string) *exAlias

func Comment

func Comment(c string) *comment

func ContextWithToggles added in v2.13.0

func ContextWithToggles(ctx context.Context, toggles Toggles) context.Context

func CrossJoin added in v2.13.0

func CrossJoin(table SqlExpr) *join

func EachStructField added in v2.23.0

func EachStructField(ctx context.Context, tpe typesx.Type, each func(p *StructField) bool)

func Expect added in v2.14.0

func Expect() *combination

func ForEachStructFieldValue

func ForEachStructFieldValue(ctx context.Context, v interface{}, fn func(*StructFieldValue))

func FullJoin added in v2.13.0

func FullJoin(table SqlExpr) *join

func GetColumnName

func GetColumnName(fieldName, tagValue string) string

func GroupBy

func GroupBy(groups ...SqlExpr) *groupBy

func InnerJoin added in v2.13.0

func InnerJoin(table SqlExpr) *join

func Intersect added in v2.14.0

func Intersect() *combination

func IsNilExpr added in v2.13.0

func IsNilExpr(e SqlExpr) bool

func Join added in v2.13.0

func Join(table SqlExpr, prefixes ...string) *join

func LeftJoin added in v2.13.0

func LeftJoin(table SqlExpr) *join

func Limit

func Limit(rowCount int64) *limit

func MultiMayAutoAlias added in v2.13.0

func MultiMayAutoAlias(columns ...SqlExpr) *exMayAutoAlias

func OnConflict

func OnConflict(columns *Columns) *onConflict

func OrderBy

func OrderBy(orders ...*Order) *orderBy

func RangeNotNilExpr added in v2.13.0

func RangeNotNilExpr(exprs []SqlExpr, each func(e SqlExpr, i int))

func ResolveIndexNameAndMethod

func ResolveIndexNameAndMethod(n string) (name string, method string)

func RightJoin added in v2.13.0

func RightJoin(table SqlExpr) *join

func ScanDefToTable

func ScanDefToTable(table *Table, i interface{})

func TableAliasFromContext added in v2.19.0

func TableAliasFromContext(ctx context.Context) string

func TableNameFromContext added in v2.18.0

func TableNameFromContext(ctx context.Context) string

func ToMap

func ToMap(list []string) map[string]bool

func Union added in v2.14.0

func Union() *combination

func Where

func Where(c SqlCondition) *where

func WithTableAlias added in v2.19.0

func WithTableAlias(tableName string) func(ctx context.Context) context.Context

func WithTableName added in v2.18.0

func WithTableName(tableName string) func(ctx context.Context) context.Context

func WriteAdditions added in v2.13.0

func WriteAdditions(e *Ex, additions ...Addition)

func WriteAssignments added in v2.13.0

func WriteAssignments(e *Ex, assignments ...*Assignment)

Types

type Addition

type Addition interface {
	SqlExpr
	AdditionType() AdditionType
}

type AdditionType added in v2.17.2

type AdditionType int
const (
	AdditionJoin AdditionType = iota
	AdditionWhere
	AdditionGroupBy
	AdditionCombination
	AdditionOrderBy
	AdditionLimit
	AdditionOnConflict
	AdditionOther
	AdditionComment
)

type Additions

type Additions []Addition

func (Additions) Len

func (additions Additions) Len() int

func (Additions) Less

func (additions Additions) Less(i, j int) bool

func (Additions) Swap

func (additions Additions) Swap(i, j int)

type Assignment

type Assignment struct {
	SqlAssignmentMarker
	// contains filtered or unexported fields
}

func ColumnsAndValues

func ColumnsAndValues(columnOrColumns SqlExpr, values ...interface{}) *Assignment

func (*Assignment) Ex added in v2.15.0

func (a *Assignment) Ex(ctx context.Context) *Ex

func (*Assignment) IsNil

func (a *Assignment) IsNil() bool

type Assignments

type Assignments []*Assignment

type BuildSubQuery added in v2.14.0

type BuildSubQuery func(table *Table) SqlExpr

type Column

type Column struct {
	Name      string
	FieldName string
	Table     *Table

	*ColumnType
	// contains filtered or unexported fields
}

func Col

func Col(name string) *Column

func (*Column) Between

func (c *Column) Between(leftValue interface{}, rightValue interface{}) SqlCondition

func (*Column) Dec added in v2.23.10

func (c *Column) Dec(d int) SqlExpr

func (*Column) Eq

func (c *Column) Eq(v interface{}) SqlCondition

func (*Column) Ex added in v2.2.1

func (c *Column) Ex(ctx context.Context) *Ex

func (*Column) Expr

func (c *Column) Expr(query string, args ...interface{}) *Ex

func (Column) Field

func (c Column) Field(fieldName string) *Column

func (Column) Full added in v2.13.0

func (c Column) Full() *Column

func (*Column) Gt

func (c *Column) Gt(v interface{}) SqlCondition

func (*Column) Gte

func (c *Column) Gte(v interface{}) SqlCondition

func (*Column) In

func (c *Column) In(args ...interface{}) SqlCondition

func (*Column) Incr

func (c *Column) Incr(d int) SqlExpr

func (*Column) IsNil

func (c *Column) IsNil() bool

func (*Column) IsNotNull

func (c *Column) IsNotNull() SqlCondition

func (*Column) IsNull

func (c *Column) IsNull() SqlCondition

func (*Column) LeftLike

func (c *Column) LeftLike(v string) SqlCondition

func (*Column) Like

func (c *Column) Like(v string) SqlCondition

func (*Column) Lt

func (c *Column) Lt(v interface{}) SqlCondition

func (*Column) Lte

func (c *Column) Lte(v interface{}) SqlCondition

func (*Column) Neq

func (c *Column) Neq(v interface{}) SqlCondition

func (*Column) NotBetween

func (c *Column) NotBetween(leftValue interface{}, rightValue interface{}) SqlCondition

func (*Column) NotIn

func (c *Column) NotIn(args ...interface{}) SqlCondition

func (*Column) NotLike

func (c *Column) NotLike(v string) SqlCondition

func (*Column) Of added in v2.2.0

func (c *Column) Of(table *Table) *Column

func (Column) On

func (c Column) On(table *Table) *Column

func (*Column) RightLike

func (c *Column) RightLike(v string) SqlCondition

func (*Column) T

func (c *Column) T() *Table

func (Column) Type

func (c Column) Type(v interface{}, tagValue string) *Column

func (*Column) ValueBy

func (c *Column) ValueBy(v interface{}) *Assignment

type ColumnType

type ColumnType struct {
	Type              typex.Type
	DataType          string
	Length            uint64
	Decimal           uint64
	Default           *string
	OnUpdate          *string
	Null              bool
	AutoIncrement     bool
	DeprecatedActions *DeprecatedActions
	Comment           string
	Description       []string
	Relation          []string
}

func ColumnTypeFromTypeAndTag

func ColumnTypeFromTypeAndTag(typ typex.Type, nameAndFlags string) *ColumnType

type Columns

type Columns struct {
	// contains filtered or unexported fields
}

func Cols

func Cols(names ...string) *Columns

func (*Columns) Add

func (cols *Columns) Add(columns ...*Column)

func (*Columns) AutoIncrement

func (cols *Columns) AutoIncrement() (col *Column)

func (*Columns) Clone

func (cols *Columns) Clone() *Columns

func (*Columns) Col

func (cols *Columns) Col(columnName string) (col *Column)

func (*Columns) ColNames added in v2.23.0

func (cols *Columns) ColNames() []string

func (*Columns) Cols

func (cols *Columns) Cols(colNames ...string) (*Columns, error)

func (*Columns) Ex added in v2.13.0

func (cols *Columns) Ex(ctx context.Context) *Ex

func (*Columns) F

func (cols *Columns) F(structFieldName string) (col *Column)

func (*Columns) FieldNames

func (cols *Columns) FieldNames() []string

func (*Columns) Fields

func (cols *Columns) Fields(structFieldNames ...string) (*Columns, error)

func (*Columns) IsNil

func (cols *Columns) IsNil() bool

func (*Columns) Len

func (cols *Columns) Len() int

func (*Columns) List

func (cols *Columns) List() (l []*Column)

func (*Columns) MustCols added in v2.23.0

func (cols *Columns) MustCols(colNames ...string) *Columns

func (*Columns) MustFields added in v2.11.0

func (cols *Columns) MustFields(structFieldNames ...string) *Columns

func (*Columns) Range

func (cols *Columns) Range(cb func(col *Column, idx int))

type CombinationAddition added in v2.14.0

type CombinationAddition struct {
}

func (CombinationAddition) AdditionType added in v2.17.2

func (CombinationAddition) AdditionType() AdditionType

type CommentAddition added in v2.13.0

type CommentAddition struct {
}

func (CommentAddition) AdditionType added in v2.17.2

func (CommentAddition) AdditionType() AdditionType

type ComposedCondition added in v2.13.0

type ComposedCondition struct {
	SqlConditionMarker
	// contains filtered or unexported fields
}

func (*ComposedCondition) And added in v2.13.0

func (*ComposedCondition) Ex added in v2.13.0

func (c *ComposedCondition) Ex(ctx context.Context) *Ex

func (*ComposedCondition) IsNil added in v2.13.0

func (c *ComposedCondition) IsNil() bool

func (*ComposedCondition) Or added in v2.13.0

func (*ComposedCondition) Xor added in v2.13.0

type Condition

type Condition struct {
	SqlConditionMarker
	// contains filtered or unexported fields
}

func AsCond

func AsCond(ex SqlExpr) *Condition

func (*Condition) And

func (c *Condition) And(cond SqlCondition) SqlCondition

func (*Condition) Ex added in v2.13.0

func (c *Condition) Ex(ctx context.Context) *Ex

func (*Condition) IsNil

func (c *Condition) IsNil() bool

func (*Condition) Or

func (c *Condition) Or(cond SqlCondition) SqlCondition

func (*Condition) Xor

func (c *Condition) Xor(cond SqlCondition) SqlCondition

type DataTypeDescriber

type DataTypeDescriber interface {
	DataType(driverName string) string
}

type DeprecatedActions added in v2.12.0

type DeprecatedActions struct {
	RenameTo string `name:"rename"`
}

type Dialect

type Dialect interface {
	DriverName() string
	PrimaryKeyName() string
	IsErrorUnknownDatabase(err error) bool
	IsErrorConflict(err error) bool
	CreateDatabase(dbName string) SqlExpr
	CreateSchema(schemaName string) SqlExpr
	DropDatabase(dbName string) SqlExpr
	CreateTableIsNotExists(t *Table) []SqlExpr
	DropTable(t *Table) SqlExpr
	TruncateTable(t *Table) SqlExpr
	AddColumn(col *Column) SqlExpr
	RenameColumn(col *Column, target *Column) SqlExpr
	ModifyColumn(col *Column, prev *Column) SqlExpr
	DropColumn(col *Column) SqlExpr
	AddIndex(key *Key) SqlExpr
	DropIndex(key *Key) SqlExpr
	DataType(columnType *ColumnType) SqlExpr
}

type Ex

type Ex struct {
	// contains filtered or unexported fields
}

func ColumnsByStruct added in v2.18.0

func ColumnsByStruct(v interface{}) *Ex

func ExactlyExpr added in v2.23.0

func ExactlyExpr(query string, args ...interface{}) *Ex

func Expr

func Expr(query string, args ...interface{}) *Ex

func ResolveExpr added in v2.13.0

func ResolveExpr(v interface{}) *Ex

func ResolveExprContext added in v2.13.0

func ResolveExprContext(ctx context.Context, v interface{}) *Ex

func (*Ex) AppendArgs

func (e *Ex) AppendArgs(args ...interface{})

func (*Ex) Args

func (e *Ex) Args() []interface{}

func (*Ex) ArgsLen

func (e *Ex) ArgsLen() int

func (*Ex) Err

func (e *Ex) Err() error

func (*Ex) Ex added in v2.13.0

func (e *Ex) Ex(ctx context.Context) *Ex

func (*Ex) Grow added in v2.23.0

func (e *Ex) Grow(n int)

func (*Ex) IsNil

func (e *Ex) IsNil() bool

func (*Ex) Query

func (e *Ex) Query() string

func (*Ex) QueryGrow added in v2.23.0

func (e *Ex) QueryGrow(n int)

func (*Ex) SetExactly added in v2.23.0

func (e *Ex) SetExactly(exactly bool)

func (*Ex) WhiteComments

func (e *Ex) WhiteComments(comments []byte)

func (*Ex) WriteByte added in v2.23.0

func (e *Ex) WriteByte(b byte) error

func (*Ex) WriteEnd

func (e *Ex) WriteEnd()

func (*Ex) WriteExpr

func (e *Ex) WriteExpr(expr SqlExpr)

func (*Ex) WriteGroup

func (e *Ex) WriteGroup(fn func(e *Ex))

func (*Ex) WriteHolder

func (e *Ex) WriteHolder(idx int)

func (*Ex) WriteQuery added in v2.23.0

func (e *Ex) WriteQuery(s string)

func (*Ex) WriteQueryByte added in v2.23.0

func (e *Ex) WriteQueryByte(b byte)

func (*Ex) WriteString added in v2.23.0

func (e *Ex) WriteString(s string) (int, error)

type FieldValues

type FieldValues map[string]interface{}

func FieldValuesFromStructBy

func FieldValuesFromStructBy(structValue interface{}, fieldNames []string) (fieldValues FieldValues)

func FieldValuesFromStructByNonZero

func FieldValuesFromStructByNonZero(structValue interface{}, excludes ...string) (fieldValues FieldValues)

type Function

type Function struct {
	// contains filtered or unexported fields
}

func Avg

func Avg(sqlExprs ...SqlExpr) *Function

func Count

func Count(sqlExprs ...SqlExpr) *Function

func Distinct

func Distinct(sqlExprs ...SqlExpr) *Function

func First

func First(sqlExprs ...SqlExpr) *Function

func Func

func Func(name string, sqlExprs ...SqlExpr) *Function

func Last

func Last(sqlExprs ...SqlExpr) *Function

func Max

func Max(sqlExprs ...SqlExpr) *Function

func Min

func Min(sqlExprs ...SqlExpr) *Function

func Sum

func Sum(sqlExprs ...SqlExpr) *Function

func (*Function) Ex added in v2.13.0

func (f *Function) Ex(ctx context.Context) *Ex

func (*Function) IsNil

func (f *Function) IsNil() bool

type GroupByAddition added in v2.8.0

type GroupByAddition struct {
}

func (GroupByAddition) AdditionType added in v2.17.2

func (GroupByAddition) AdditionType() AdditionType

type IndexDef added in v2.23.0

type IndexDef struct {
	FieldNames []string
	ColNames   []string
	Expr       string
}

func ParseIndexDef added in v2.23.0

func ParseIndexDef(parts ...string) *IndexDef

func (IndexDef) TableExpr added in v2.23.0

func (e IndexDef) TableExpr(t *Table) *Ex

func (IndexDef) ToDefs added in v2.23.0

func (e IndexDef) ToDefs() []string

type IndexDefine added in v2.23.0

type IndexDefine struct {
	Kind   string
	Name   string
	Method string
	IndexDef
}

func ParseIndexDefine added in v2.23.0

func ParseIndexDefine(def string) *IndexDefine

ParseIndexDefine @def index i_xxx/BTREE Name @def index i_xxx USING GIST (#TEST gist_trgm_ops)

func (IndexDefine) ID added in v2.23.0

func (i IndexDefine) ID() string

type Indexes

type Indexes map[string][]string

type JoinAddition added in v2.13.0

type JoinAddition struct{}

func (JoinAddition) AdditionType added in v2.17.2

func (JoinAddition) AdditionType() AdditionType

type Key

type Key struct {
	Table *Table

	Name     string
	IsUnique bool
	Method   string
	Def      IndexDef
}

func Index

func Index(name string, columns *Columns, exprs ...string) *Key

func PrimaryKey

func PrimaryKey(columns *Columns) *Key

func UniqueIndex

func UniqueIndex(name string, columns *Columns, exprs ...string) *Key

func (*Key) IsPrimary

func (key *Key) IsPrimary() bool

func (Key) On

func (key Key) On(table *Table) *Key

func (*Key) T

func (key *Key) T() *Table

func (Key) Using

func (key Key) Using(method string) *Key

type Keys

type Keys struct {
	// contains filtered or unexported fields
}

func (*Keys) Add

func (keys *Keys) Add(nextKeys ...*Key)

func (*Keys) Clone

func (keys *Keys) Clone() *Keys

func (*Keys) IsEmpty

func (keys *Keys) IsEmpty() bool

func (*Keys) Key

func (keys *Keys) Key(keyName string) (key *Key)

func (*Keys) Len

func (keys *Keys) Len() int

func (*Keys) Range

func (keys *Keys) Range(cb func(key *Key, idx int))

type LimitAddition added in v2.8.0

type LimitAddition struct {
}

func (LimitAddition) AdditionType added in v2.17.2

func (LimitAddition) AdditionType() AdditionType

type Model

type Model interface {
	TableName() string
}

type OnConflictAddition added in v2.8.0

type OnConflictAddition struct {
}

func (OnConflictAddition) AdditionType added in v2.17.2

func (OnConflictAddition) AdditionType() AdditionType

type Order added in v2.17.0

type Order struct {
	// contains filtered or unexported fields
}

func AscOrder

func AscOrder(target SqlExpr) *Order

func DescOrder

func DescOrder(target SqlExpr) *Order

func (*Order) Ex added in v2.17.0

func (o *Order) Ex(ctx context.Context) *Ex

func (*Order) IsNil added in v2.17.0

func (o *Order) IsNil() bool

type OrderByAddition added in v2.8.0

type OrderByAddition struct {
}

func (OrderByAddition) AdditionType added in v2.17.2

func (OrderByAddition) AdditionType() AdditionType

type OtherAddition added in v2.8.0

type OtherAddition struct {
	SqlExpr
}

func AsAddition

func AsAddition(expr SqlExpr) *OtherAddition

func ForUpdate

func ForUpdate() *OtherAddition

func OnDuplicateKeyUpdate

func OnDuplicateKeyUpdate(assignments ...*Assignment) *OtherAddition

func Returning

func Returning(expr SqlExpr) *OtherAddition

func (OtherAddition) AdditionType added in v2.17.2

func (OtherAddition) AdditionType() AdditionType

func (*OtherAddition) IsNil added in v2.8.0

func (a *OtherAddition) IsNil() bool

type SelectStatement added in v2.14.3

type SelectStatement interface {
	SqlExpr
	// contains filtered or unexported methods
}

type SqlAssignment

type SqlAssignment interface {
	SqlExpr
	SqlAssignmentMarker
}

type SqlAssignmentMarker

type SqlAssignmentMarker interface {
	// contains filtered or unexported methods
}

type SqlCondition

type SqlCondition interface {
	SqlExpr
	SqlConditionMarker

	And(cond SqlCondition) SqlCondition
	Or(cond SqlCondition) SqlCondition
	Xor(cond SqlCondition) SqlCondition
}

func And

func And(conditions ...SqlCondition) SqlCondition

func EmptyCond added in v2.13.0

func EmptyCond() SqlCondition

func Or

func Or(conditions ...SqlCondition) SqlCondition

func Xor

func Xor(conditions ...SqlCondition) SqlCondition

type SqlConditionMarker

type SqlConditionMarker interface {
	// contains filtered or unexported methods
}

type SqlExpr

type SqlExpr interface {
	IsNil() bool
	Ex(ctx context.Context) *Ex
}

func ExprBy added in v2.13.0

func ExprBy(build func(ctx context.Context) *Ex) SqlExpr

func Multi added in v2.13.0

func Multi(exprs ...SqlExpr) SqlExpr

func MultiWith added in v2.13.0

func MultiWith(connector string, exprs ...SqlExpr) SqlExpr

type StmtDelete

type StmtDelete struct {
	// contains filtered or unexported fields
}

func Delete

func Delete() *StmtDelete

func (*StmtDelete) Ex added in v2.13.0

func (s *StmtDelete) Ex(ctx context.Context) *Ex

func (StmtDelete) From

func (s StmtDelete) From(table *Table, additions ...Addition) *StmtDelete

func (*StmtDelete) IsNil

func (s *StmtDelete) IsNil() bool

type StmtInsert

type StmtInsert struct {
	// contains filtered or unexported fields
}

https://dev.mysql.com/doc/refman/5.6/en/insert.html

func Insert

func Insert(modifiers ...string) *StmtInsert

func (*StmtInsert) Ex added in v2.13.0

func (s *StmtInsert) Ex(ctx context.Context) *Ex

func (StmtInsert) Into

func (s StmtInsert) Into(table *Table, additions ...Addition) *StmtInsert

func (*StmtInsert) IsNil

func (s *StmtInsert) IsNil() bool

func (StmtInsert) Values

func (s StmtInsert) Values(cols *Columns, values ...interface{}) *StmtInsert

type StmtSelect

type StmtSelect struct {
	SelectStatement
	// contains filtered or unexported fields
}

func Select

func Select(sqlExpr SqlExpr, modifiers ...string) *StmtSelect

func (*StmtSelect) Ex added in v2.13.0

func (s *StmtSelect) Ex(ctx context.Context) *Ex

func (StmtSelect) From

func (s StmtSelect) From(table *Table, additions ...Addition) *StmtSelect

func (*StmtSelect) IsNil

func (s *StmtSelect) IsNil() bool

type StmtUpdate

type StmtUpdate struct {
	// contains filtered or unexported fields
}

func Update

func Update(table *Table, modifiers ...string) *StmtUpdate

func (*StmtUpdate) Ex added in v2.13.0

func (s *StmtUpdate) Ex(ctx context.Context) *Ex

func (*StmtUpdate) IsNil

func (s *StmtUpdate) IsNil() bool

func (StmtUpdate) Set

func (s StmtUpdate) Set(assignments ...*Assignment) *StmtUpdate

func (StmtUpdate) Where

func (s StmtUpdate) Where(c SqlCondition, additions ...Addition) *StmtUpdate

type StructField added in v2.18.0

type StructField struct {
	Name       string
	FieldName  string
	Type       typesx.Type
	Field      typesx.StructField
	Tags       map[string]reflectx.StructTag
	Loc        []int
	ModelLoc   []int
	ColumnType ColumnType
}

func StructFieldsFor added in v2.23.0

func StructFieldsFor(ctx context.Context, typ typesx.Type) []*StructField

func (*StructField) FieldModelValue added in v2.23.4

func (p *StructField) FieldModelValue(structReflectValue reflect.Value) reflect.Value

func (*StructField) FieldValue added in v2.23.0

func (p *StructField) FieldValue(structReflectValue reflect.Value) reflect.Value

type StructFieldValue added in v2.23.0

type StructFieldValue struct {
	Field     StructField
	TableName string
	Value     reflect.Value
}

type StructFieldsFactory added in v2.23.0

type StructFieldsFactory struct {
	// contains filtered or unexported fields
}

func (*StructFieldsFactory) TableFieldsFor added in v2.23.0

func (tf *StructFieldsFactory) TableFieldsFor(ctx context.Context, typ typesx.Type) []*StructField

type Table

type Table struct {
	Name        string
	Description []string

	Schema    string
	ModelName string
	Model     Model

	Columns
	Keys
}

func T

func T(tableName string, tableDefinitions ...TableDefinition) *Table

func TableFromModel added in v2.13.0

func TableFromModel(model Model) *Table

func (*Table) AddCol

func (t *Table) AddCol(d *Column)

func (*Table) AddKey

func (t *Table) AddKey(key *Key)

func (*Table) AssignmentsByFieldValues

func (t *Table) AssignmentsByFieldValues(fieldValues FieldValues) (assignments Assignments)

func (*Table) ColumnsAndValuesByFieldValues

func (t *Table) ColumnsAndValuesByFieldValues(fieldValues FieldValues) (columns *Columns, args []interface{})

func (*Table) Diff

func (t *Table) Diff(prevTable *Table, dialect Dialect) (exprList []SqlExpr)

func (*Table) Ex

func (t *Table) Ex(ctx context.Context) *Ex

func (*Table) Expr

func (t *Table) Expr(query string, args ...interface{}) *Ex

func (*Table) IsNil

func (t *Table) IsNil() bool

func (*Table) TableName added in v2.13.0

func (t *Table) TableName() string

func (Table) WithSchema added in v2.2.0

func (t Table) WithSchema(schema string) *Table

type TableDefinition

type TableDefinition interface {
	T() *Table
}

type Tables

type Tables struct {
	// contains filtered or unexported fields
}

func (*Tables) Add

func (tables *Tables) Add(tabs ...*Table)

func (*Tables) Model added in v2.3.0

func (tables *Tables) Model(structName string) *Table

func (*Tables) Range added in v2.3.0

func (tables *Tables) Range(cb func(tab *Table, idx int))

func (*Tables) Remove added in v2.3.0

func (tables *Tables) Remove(name string)

func (*Tables) Table added in v2.3.0

func (tables *Tables) Table(tableName string) *Table

func (*Tables) TableNames

func (tables *Tables) TableNames() (names []string)

type Toggles added in v2.13.0

type Toggles map[string]bool

func TogglesFromContext added in v2.13.0

func TogglesFromContext(ctx context.Context) Toggles

func (Toggles) Is added in v2.13.0

func (toggles Toggles) Is(key string) bool

func (Toggles) Merge added in v2.13.0

func (toggles Toggles) Merge(next Toggles) Toggles

type ValuerExpr

type ValuerExpr interface {
	ValueEx() string
}

replace ? as some query snippet

examples: ? => ST_GeomFromText(?)

type WhereAddition added in v2.8.0

type WhereAddition struct{}

func (WhereAddition) AdditionType added in v2.17.2

func (WhereAddition) AdditionType() AdditionType

type WithColDescriptions added in v2.3.0

type WithColDescriptions interface {
	ColDescriptions() map[string][]string
}

type WithComments

type WithComments interface {
	Comments() map[string]string
}

type WithConditionFor added in v2.23.0

type WithConditionFor interface {
	ConditionFor(c *Column) SqlCondition
}

type WithIndexes

type WithIndexes interface {
	Indexes() Indexes
}

type WithPrimaryKey

type WithPrimaryKey interface {
	PrimaryKey() []string
}

type WithRelations added in v2.3.0

type WithRelations interface {
	ColRelations() map[string][]string
}

type WithStmt added in v2.13.0

type WithStmt struct {
	// contains filtered or unexported fields
}

func With added in v2.13.0

func With(t *Table, build BuildSubQuery, modifiers ...string) *WithStmt

func WithRecursive added in v2.13.0

func WithRecursive(t *Table, build BuildSubQuery) *WithStmt

func (*WithStmt) Ex added in v2.13.0

func (w *WithStmt) Ex(ctx context.Context) *Ex

func (WithStmt) Exec added in v2.14.0

func (w WithStmt) Exec(statement func(tables ...*Table) SqlExpr) *WithStmt

func (*WithStmt) IsNil added in v2.13.0

func (w *WithStmt) IsNil() bool

func (WithStmt) With added in v2.14.0

func (w WithStmt) With(t *Table, build BuildSubQuery) *WithStmt

type WithTableDescription added in v2.4.0

type WithTableDescription interface {
	TableDescription() []string
}

type WithUniqueIndexes

type WithUniqueIndexes interface {
	UniqueIndexes() Indexes
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL