Documentation ¶
Overview ¶
+gengo:runtimedoc=false
Index ¶
- Constants
- Variables
- func Alias(expr sqlfrag.Fragment, name string) sqlfrag.Fragment
- func CompareAddition(a Addition, b Addition) int
- func ContextWithToggles(ctx context.Context, toggles Toggles) context.Context
- func GetColumnComputed(col Column) sqlfrag.Fragment
- func GetColumnName(fieldName, tagValue string) string
- func MatchColumn(col Column, name string) bool
- func MultiMayAutoAlias(columns ...sqlfrag.Fragment) sqlfrag.Fragment
- func ResolveIndexNameAndMethod(n string) (name string, method string)
- type Addition
- type AdditionType
- type Additions
- type Assignment
- type Assignments
- type BuildSubQuery
- type ColOptionFunc
- type Column
- type ColumnCollection
- type ColumnCollectionManger
- type ColumnDef
- type ColumnPicker
- type ColumnSeq
- type ColumnSetter
- type ColumnValuer
- func AsValue[T any](v TypedColumn[T]) ColumnValuer[T]
- func Between[T comparable](leftValue T, rightValue T) ColumnValuer[T]
- func Des[T any](v T) ColumnValuer[T]
- func Eq[T comparable](expect T) ColumnValuer[T]
- func EqCol[T comparable](expect TypedColumn[T]) ColumnValuer[T]
- func Gt[T comparable](min T) ColumnValuer[T]
- func Gte[T comparable](min T) ColumnValuer[T]
- func In[T any](values ...T) ColumnValuer[T]
- func Incr[T any](v T) ColumnValuer[T]
- func IsNotNull[T any]() ColumnValuer[T]
- func IsNull[T any]() ColumnValuer[T]
- func LeftLike[T ~string](s T) ColumnValuer[T]
- func Like[T ~string](s T) ColumnValuer[T]
- func Lt[T comparable](max T) ColumnValuer[T]
- func Lte[T comparable](max T) ColumnValuer[T]
- func Neq[T any](expect T) ColumnValuer[T]
- func NeqCol[T comparable](expect TypedColumn[T]) ColumnValuer[T]
- func NotBetween[T comparable](leftValue T, rightValue T) ColumnValuer[T]
- func NotIn[T any](values ...T) ColumnValuer[T]
- func NotLike[T ~string](s T) ColumnValuer[T]
- func RightLike[T ~string](s T) ColumnValuer[T]
- func Value[T any](v T) ColumnValuer[T]
- type ColumnWithComputed
- type ColumnWithDef
- type ColumnWrapper
- type CombinationAddition
- type ComposedCondition
- func (c *ComposedCondition) And(cond SqlCondition) SqlCondition
- func (c *ComposedCondition) Frag(ctx context.Context) iter.Seq2[string, []any]
- func (c *ComposedCondition) IsNil() bool
- func (c *ComposedCondition) Or(cond SqlCondition) SqlCondition
- func (c *ComposedCondition) Xor(cond SqlCondition) SqlCondition
- type Condition
- type DataTypeDescriber
- type DeprecatedActions
- type Function
- func AnyValue(fragments ...sqlfrag.Fragment) *Function
- func Avg(fragments ...sqlfrag.Fragment) *Function
- func Count(fragments ...sqlfrag.Fragment) *Function
- func Distinct(fragments ...sqlfrag.Fragment) *Function
- func First(fragments ...sqlfrag.Fragment) *Function
- func Func(name string, args ...sqlfrag.Fragment) *Function
- func Last(fragments ...sqlfrag.Fragment) *Function
- func Max(fragments ...sqlfrag.Fragment) *Function
- func Min(fragments ...sqlfrag.Fragment) *Function
- func Sum(fragments ...sqlfrag.Fragment) *Function
- type GroupByAddition
- type IndexDefine
- type IndexOptionFunc
- type Indexes
- type JoinAddition
- func CrossJoin(table sqlfrag.Fragment) JoinAddition
- func FullJoin(table sqlfrag.Fragment) JoinAddition
- func InnerJoin(table sqlfrag.Fragment) JoinAddition
- func Join(table sqlfrag.Fragment, prefixes ...string) JoinAddition
- func LeftJoin(table sqlfrag.Fragment) JoinAddition
- func RightJoin(table sqlfrag.Fragment) JoinAddition
- type Key
- type KeyCollection
- type KeyCollectionManager
- type KeyDef
- type KeyPicker
- type KeySeq
- type LimitAddition
- type Model
- type ModelNewer
- type OnConflictAddition
- type Order
- type OtherAddition
- type ReturningAddition
- type SelectStatement
- type SqlCondition
- type SqlConditionMarker
- type StmtDelete
- type StmtInsert
- func (s *StmtInsert) Frag(ctx context.Context) iter.Seq2[string, []any]
- func (s StmtInsert) Into(table Table, additions ...Addition) *StmtInsert
- func (s *StmtInsert) IsNil() bool
- func (s StmtInsert) Values(cols ColumnCollection, values ...any) *StmtInsert
- func (s StmtInsert) ValuesCollect(cols ColumnCollection, seq iter.Seq[any]) *StmtInsert
- type StmtSelect
- type StmtUpdate
- func (s *StmtUpdate) Frag(ctx context.Context) iter.Seq2[string, []any]
- func (s StmtUpdate) From(table Table, additions ...Addition) *StmtUpdate
- func (s *StmtUpdate) IsNil() bool
- func (s StmtUpdate) Set(assignments ...Assignment) *StmtUpdate
- func (s StmtUpdate) SetBy(assignments iter.Seq[Assignment]) *StmtUpdate
- func (s StmtUpdate) Where(c sqlfrag.Fragment, additions ...Addition) *StmtUpdate
- type Table
- type TableCanFragment
- type TableWithTableName
- type Tables
- type Toggles
- type TypedColumn
- type WithColDescriptions
- type WithComments
- type WithIndexes
- type WithPrimaryKey
- type WithRelations
- type WithStmt
- type WithTable
- type WithTableDescription
- type WithUniqueIndexes
Constants ¶
View Source
const ( ToggleMultiTable = "MultiTable" ToggleNeedAutoAlias = "NeedAlias" ToggleUseValues = "UseValues" ToggleInProject = "InProject" )
Variables ¶
View Source
var UpdateNeedLimitByWhere = errors.New("no where limit for update")
Functions ¶
func CompareAddition ¶
func ContextWithToggles ¶
func GetColumnComputed ¶
func GetColumnName ¶
func MatchColumn ¶
Types ¶
type Addition ¶
type Addition interface { sqlfrag.Fragment AdditionType() AdditionType }
type AdditionType ¶
type AdditionType int
const ( AdditionJoin AdditionType = iota AdditionWhere AdditionGroupBy AdditionCombination AdditionOrderBy AdditionOnConflict AdditionReturning AdditionLimit AdditionOther AdditionComment )
type Assignment ¶
func ColumnsAndCollect ¶
func ColumnsAndValues ¶
func ColumnsAndValues(columnOrColumns sqlfrag.Fragment, values ...any) Assignment
type Assignments ¶
type Assignments []Assignment
func (Assignments) IsNil ¶
func (assignments Assignments) IsNil() bool
type BuildSubQuery ¶
type ColOptionFunc ¶
type ColOptionFunc func(c ColumnSetter)
func ColComputedBy ¶
func ColComputedBy(aggregate sqlfrag.Fragment) ColOptionFunc
func ColDef ¶
func ColDef(def ColumnDef) ColOptionFunc
func ColField ¶
func ColField(fieldName string) ColOptionFunc
func ColTypeOf ¶
func ColTypeOf(v any, tagValue string) ColOptionFunc
type Column ¶
type Column interface { sqlfrag.Fragment Fragment(query string, args ...any) sqlfrag.Fragment Of(table Table) Column Name() string FieldName() string }
func Col ¶
func Col(name string, fns ...ColOptionFunc) Column
type ColumnCollection ¶
type ColumnCollection interface { sqlfrag.Fragment ColumnSeq ColumnPicker Col(name string) Column AllCols() iter.Seq2[int, Column] Of(t Table) ColumnCollection Len() int }
func Cols ¶
func Cols(names ...string) ColumnCollection
func ColumnCollect ¶
func ColumnCollect(cols iter.Seq[Column]) ColumnCollection
func PickColsByFieldNames ¶
func PickColsByFieldNames(picker ColumnPicker, names ...string) ColumnCollection
type ColumnCollectionManger ¶
type ColumnCollectionManger interface {
AddCol(cols ...Column)
}
type ColumnDef ¶
func GetColumnDef ¶
type ColumnPicker ¶
type ColumnSetter ¶
type ColumnValuer ¶
+gengo:runtimedoc=false
func AsValue ¶
func AsValue[T any](v TypedColumn[T]) ColumnValuer[T]
func Between ¶
func Between[T comparable](leftValue T, rightValue T) ColumnValuer[T]
func Des ¶
func Des[T any](v T) ColumnValuer[T]
func Eq ¶
func Eq[T comparable](expect T) ColumnValuer[T]
func EqCol ¶
func EqCol[T comparable](expect TypedColumn[T]) ColumnValuer[T]
func Gt ¶
func Gt[T comparable](min T) ColumnValuer[T]
func Gte ¶
func Gte[T comparable](min T) ColumnValuer[T]
func In ¶
func In[T any](values ...T) ColumnValuer[T]
func Incr ¶
func Incr[T any](v T) ColumnValuer[T]
func IsNotNull ¶
func IsNotNull[T any]() ColumnValuer[T]
func IsNull ¶
func IsNull[T any]() ColumnValuer[T]
func LeftLike ¶
func LeftLike[T ~string](s T) ColumnValuer[T]
func Like ¶
func Like[T ~string](s T) ColumnValuer[T]
func Lt ¶
func Lt[T comparable](max T) ColumnValuer[T]
func Lte ¶
func Lte[T comparable](max T) ColumnValuer[T]
func Neq ¶
func Neq[T any](expect T) ColumnValuer[T]
func NeqCol ¶
func NeqCol[T comparable](expect TypedColumn[T]) ColumnValuer[T]
func NotBetween ¶
func NotBetween[T comparable](leftValue T, rightValue T) ColumnValuer[T]
func NotIn ¶
func NotIn[T any](values ...T) ColumnValuer[T]
func NotLike ¶
func NotLike[T ~string](s T) ColumnValuer[T]
func RightLike ¶
func RightLike[T ~string](s T) ColumnValuer[T]
func Value ¶
func Value[T any](v T) ColumnValuer[T]
type ColumnWithComputed ¶
type ColumnWithDef ¶
type ColumnWithDef interface {
Def() ColumnDef
}
type ColumnWrapper ¶
type ColumnWrapper interface {
Unwrap() Column
}
type CombinationAddition ¶
type CombinationAddition interface { Addition All(stmtSelect SelectStatement) CombinationAddition Distinct(stmtSelect SelectStatement) CombinationAddition }
func Expect ¶
func Expect() CombinationAddition
func Intersect ¶
func Intersect() CombinationAddition
func Union ¶
func Union() CombinationAddition
type ComposedCondition ¶
type ComposedCondition struct { SqlConditionMarker // contains filtered or unexported fields }
func (*ComposedCondition) And ¶
func (c *ComposedCondition) And(cond SqlCondition) SqlCondition
func (*ComposedCondition) IsNil ¶
func (c *ComposedCondition) IsNil() bool
func (*ComposedCondition) Or ¶
func (c *ComposedCondition) Or(cond SqlCondition) SqlCondition
func (*ComposedCondition) Xor ¶
func (c *ComposedCondition) Xor(cond SqlCondition) SqlCondition
type Condition ¶
type Condition struct { SqlConditionMarker // contains filtered or unexported fields }
type DataTypeDescriber ¶
type DeprecatedActions ¶
type DeprecatedActions = columndef.DeprecatedActions
type GroupByAddition ¶
type GroupByAddition interface { Addition Having(cond sqlfrag.Fragment) GroupByAddition }
func GroupBy ¶
func GroupBy(groups ...sqlfrag.Fragment) GroupByAddition
type IndexDefine ¶
func ParseIndexDefine ¶
func ParseIndexDefine(def string) *IndexDefine
ParseIndexDefine @def index i_xxx/BTREE Name @def index i_xxx/GIST TEST/gist_trgm_ops
func (IndexDefine) ID ¶
func (i IndexDefine) ID() string
type IndexOptionFunc ¶
type IndexOptionFunc func(k *key)
func IndexColNameAndOptions ¶
func IndexColNameAndOptions(colNameAndOptions ...string) IndexOptionFunc
func IndexUnique ¶
func IndexUnique(unique bool) IndexOptionFunc
func IndexUsing ¶
func IndexUsing(method string) IndexOptionFunc
type JoinAddition ¶
type JoinAddition interface { Addition On(joinCondition sqlfrag.Fragment) JoinAddition Using(joinColumnList ...Column) JoinAddition }
func CrossJoin ¶
func CrossJoin(table sqlfrag.Fragment) JoinAddition
func FullJoin ¶
func FullJoin(table sqlfrag.Fragment) JoinAddition
func InnerJoin ¶
func InnerJoin(table sqlfrag.Fragment) JoinAddition
func LeftJoin ¶
func LeftJoin(table sqlfrag.Fragment) JoinAddition
func RightJoin ¶
func RightJoin(table sqlfrag.Fragment) JoinAddition
type Key ¶
type Key interface { sqlfrag.Fragment Of(table Table) Key Name() string IsPrimary() bool IsUnique() bool ColumnSeq }
func Index ¶
func Index(name string, columns ColumnCollection, optFns ...IndexOptionFunc) Key
func PrimaryKey ¶
func PrimaryKey(columns ColumnCollection, optFns ...IndexOptionFunc) Key
func UniqueIndex ¶
func UniqueIndex(name string, columns ColumnCollection, optFns ...IndexOptionFunc) Key
type KeyCollection ¶
type KeyCollection interface { KeyPicker KeySeq Of(t Table) KeyCollection Len() int }
type KeyCollectionManager ¶
type KeyCollectionManager interface {
AddKey(keys ...Key)
}
type LimitAddition ¶
type LimitAddition interface { Addition Offset(offset int64) LimitAddition }
func Limit ¶
func Limit(rowCount int64) LimitAddition
type ModelNewer ¶
type ModelNewer[M Model] internal.ModelNewer[M]
type OnConflictAddition ¶
type OnConflictAddition interface { Addition DoNothing() OnConflictAddition DoUpdateSet(assignments ...Assignment) OnConflictAddition }
func OnConflict ¶
func OnConflict(columns ColumnSeq) OnConflictAddition
type OtherAddition ¶
func AsAddition ¶
func AsAddition(fragment sqlfrag.Fragment) *OtherAddition
func ForUpdate ¶
func ForUpdate() *OtherAddition
func (OtherAddition) AdditionType ¶
func (OtherAddition) AdditionType() AdditionType
func (*OtherAddition) IsNil ¶
func (a *OtherAddition) IsNil() bool
type ReturningAddition ¶
type ReturningAddition interface { Addition }
func Returning ¶
func Returning(project sqlfrag.Fragment) ReturningAddition
type SelectStatement ¶
type SqlCondition ¶
type SqlCondition interface { sqlfrag.Fragment SqlConditionMarker }
func And ¶
func And(conditions ...sqlfrag.Fragment) SqlCondition
func EmptyCond ¶
func EmptyCond() SqlCondition
func Or ¶
func Or(conditions ...sqlfrag.Fragment) SqlCondition
func Xor ¶
func Xor(conditions ...sqlfrag.Fragment) SqlCondition
type SqlConditionMarker ¶
type SqlConditionMarker interface {
// contains filtered or unexported methods
}
type StmtDelete ¶
type StmtDelete struct {
// contains filtered or unexported fields
}
func Delete ¶
func Delete() *StmtDelete
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
}
func Insert ¶
func Insert(modifiers ...string) *StmtInsert
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 ColumnCollection, values ...any) *StmtInsert
func (StmtInsert) ValuesCollect ¶
func (s StmtInsert) ValuesCollect(cols ColumnCollection, seq iter.Seq[any]) *StmtInsert
type StmtSelect ¶
type StmtSelect struct { SelectStatement // contains filtered or unexported fields }
func (StmtSelect) From ¶
func (s StmtSelect) From(table sqlfrag.Fragment, 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) From ¶
func (s StmtUpdate) From(table Table, additions ...Addition) *StmtUpdate
func (*StmtUpdate) IsNil ¶
func (s *StmtUpdate) IsNil() bool
func (StmtUpdate) Set ¶
func (s StmtUpdate) Set(assignments ...Assignment) *StmtUpdate
func (StmtUpdate) SetBy ¶
func (s StmtUpdate) SetBy(assignments iter.Seq[Assignment]) *StmtUpdate
func (StmtUpdate) Where ¶
func (s StmtUpdate) Where(c sqlfrag.Fragment, additions ...Addition) *StmtUpdate
type Table ¶
type Table interface { TableName() string KeyPicker KeySeq ColumnPicker ColumnSeq sqlfrag.Fragment }
func GetColumnTable ¶
func GetKeyTable ¶
func TableFromModel ¶
type TableCanFragment ¶
type TableWithTableName ¶
type Tables ¶
type Tables struct {
// contains filtered or unexported fields
}
func (*Tables) TableNames ¶
type TypedColumn ¶
type TypedColumn[T any] interface { Column V(op ColumnValuer[T]) sqlfrag.Fragment By(ops ...ColumnValuer[T]) Assignment }
func CastColumn ¶
func CastColumn[T any](col Column, fns ...ColOptionFunc) TypedColumn[T]
func TypedCol ¶
func TypedCol[T any](name string, fns ...ColOptionFunc) TypedColumn[T]
func TypedColOf ¶
func TypedColOf[T any](t Table, name string) TypedColumn[T]
type WithColDescriptions ¶
type WithComments ¶
type WithIndexes ¶
type WithIndexes interface {
Indexes() Indexes
}
type WithPrimaryKey ¶
type WithPrimaryKey interface {
PrimaryKey() []string
}
type WithRelations ¶
type WithStmt ¶
type WithStmt struct {
// contains filtered or unexported fields
}
func WithRecursive ¶
func WithRecursive(t Table, build BuildSubQuery) *WithStmt
type WithTableDescription ¶
type WithTableDescription interface {
TableDescription() []string
}
type WithUniqueIndexes ¶
type WithUniqueIndexes interface {
UniqueIndexes() Indexes
}
Source Files ¶
- addition.go
- addition_combination.go
- addition_comment.go
- addition_group_by.go
- addition_join.go
- addition_limit.go
- addition_on_conflict.go
- addition_order_by.go
- addition_returning.go
- addition_where.go
- alias.go
- assignment.go
- column_type.go
- condition.go
- def_column.go
- def_column__typed.go
- def_column_collection.go
- def_key.go
- def_key_collection.go
- def_table.go
- doc.go
- functions.go
- interfaces.go
- stmt_delete.go
- stmt_insert.go
- stmt_select.go
- stmt_update.go
- stmt_with.go
- toggles.go
- utils.go
Directories ¶
Path | Synopsis |
---|---|
columndef
Package columndef GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
|
Package columndef GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE |
+gengo:runtimedoc=false
|
+gengo:runtimedoc=false |
Package structs GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE
|
Package structs GENERATED BY gengo:runtimedoc DON'T EDIT THIS FILE |
Click to show internal directories.
Click to hide internal directories.