Documentation ¶
Index ¶
- Constants
- Variables
- func Aggregate[T any](fn preformShare.Aggregator, colOrString any, params ...any) iAggregateCol
- func DbFromNative(d *sql.DB, queryRunner ...preformShare.QueryRunner) *db
- func IniPrebuildQueryFactory[FPtr iPrebuildQueryFactory, B any](setter func(d FPtr)) FPtr
- func InitFactory[FPtr IFactory, B any](setter any) func() FPtr
- func InitViewFactory[FPtr IViewFactory, B any](setter any) func() FPtr
- func PrepareFactories(s ISchema)
- func PrepareQueriesAndRelation(s ...ISchema)
- type AggregateCol
- type Body
- func (b Body[T, F]) Delete(body *T, cfg ...EditConfig) (affected int64, err error)
- func (b Body[T, F]) Factory(defaultFactory F) F
- func (b Body[T, F]) Insert(body *T, cfg ...EditConfig) error
- func (b Body[T, F]) SetCol(body *T, col preformShare.ICol, value any)
- func (b Body[T, F]) UpdateByPk(body *T, cfg ...UpdateConfig) (affected int64, err error)
- type CaseStmt
- func (c *CaseStmt) Else(els any) *CaseStmt
- func (c *CaseStmt) MustSql(dialect preformShare.IDialect) (string, []interface{})
- func (c *CaseStmt) ToExpr(dialect preformShare.IDialect) (squirrel.Sqlizer, error)
- func (c *CaseStmt) ToSql(dialect preformShare.IDialect) (string, []interface{}, error)
- func (c *CaseStmt) When(cond ICond, then any) *CaseStmt
- type Column
- func (a Column[T]) Aggregate(fn preformShare.Aggregator, params ...any) iAggregateCol
- func (c Column[T]) Alias() string
- func (c Column) And(cond ...ICond) colConditioner
- func (c Column) Any(v any) colConditioner
- func (a Column[T]) ArrayAgg() iAggregateCol
- func (c *Column[T]) Asc() string
- func (a Column[T]) Avg() iAggregateCol
- func (c Column) Between(v1, v2 any) colConditioner
- func (c *Column[T]) CaseStmt(pkName string) *CaseStmt
- func (c Column) Col() ICol
- func (c Column) Concat(arrayCol any) colConditioner
- func (c Column) Contains(arrayCol any) colConditioner
- func (c Column) ContainsBy(arrayCol any) colConditioner
- func (a Column[T]) Count() iAggregateCol
- func (a Column[T]) CountDistinct() iAggregateCol
- func (c Column) DbName() string
- func (c *Column[T]) Desc() string
- func (c Column) Eq(v any) colConditioner
- func (c Column) Expr(exprWithFmt string, args ...any) colConditioner
- func (c Column[T]) Factory() IFactory
- func (c *Column[T]) GetCode() string
- func (c *Column[T]) GetCodeWithAlias() string
- func (c Column) GetPos() int
- func (c Column) GetRawPtrScanner() (vv any, toScanner func(*any) any)
- func (a Column[T]) GroupConcat(splitter string) iAggregateCol
- func (c Column) Gt(v any) colConditioner
- func (c Column) GtOrEq(v any) colConditioner
- func (c Column) HasAny(arrayCol any) colConditioner
- func (c Column[T]) IsSame(cc ICol) bool
- func (a Column[T]) JsonAgg() iAggregateCol
- func (c Column) Like(v any) colConditioner
- func (c Column) Lt(v any) colConditioner
- func (c Column) LtOrEq(v any) colConditioner
- func (a Column[T]) Max() iAggregateCol
- func (a Column[T]) Mean() iAggregateCol
- func (a Column[T]) Median() iAggregateCol
- func (a Column[T]) Min() iAggregateCol
- func (a Column[T]) Mode() iAggregateCol
- func (c Column) Name() string
- func (c Column) NewValue() any
- func (c Column) NewZero() T
- func (c Column) NoParentCode() colConditioner
- func (c Column) NotEq(v any) colConditioner
- func (c Column) Or(cond ...ICond) colConditioner
- func (c Column[T]) ParentModel() any
- func (c Column[T]) QueryFactory() IQuery
- func (c *Column[T]) SetAlias(alias string) ICol
- func (c Column) SetValue(ptr, value any)
- func (a Column[T]) StdDev() iAggregateCol
- func (a Column[T]) Sum() iAggregateCol
- func (c Column[T]) ToSql() (string, []interface{}, error)
- type ColumnSetter
- func (c ColumnSetter) And(cond ...ICond) colConditioner
- func (c ColumnSetter) Any(v any) colConditioner
- func (c *ColumnSetter[T]) AutoIncrement() *ColumnSetter[T]
- func (c ColumnSetter) Between(v1, v2 any) colConditioner
- func (c ColumnSetter) Col() ICol
- func (c ColumnSetter) Concat(arrayCol any) colConditioner
- func (c ColumnSetter) Contains(arrayCol any) colConditioner
- func (c ColumnSetter) ContainsBy(arrayCol any) colConditioner
- func (c ColumnSetter) DbName() string
- func (c ColumnSetter) Eq(v any) colConditioner
- func (c ColumnSetter) Expr(exprWithFmt string, args ...any) colConditioner
- func (c *ColumnSetter[T]) GetCol() ICol
- func (c ColumnSetter) GetPos() int
- func (c ColumnSetter) GetRawPtrScanner() (vv any, toScanner func(*any) any)
- func (c ColumnSetter) Gt(v any) colConditioner
- func (c ColumnSetter) GtOrEq(v any) colConditioner
- func (c ColumnSetter) HasAny(arrayCol any) colConditioner
- func (c ColumnSetter) Like(v any) colConditioner
- func (c ColumnSetter) Lt(v any) colConditioner
- func (c ColumnSetter) LtOrEq(v any) colConditioner
- func (c ColumnSetter) Name() string
- func (c ColumnSetter) NewValue() any
- func (c ColumnSetter) NewZero() T
- func (c ColumnSetter) NoParentCode() colConditioner
- func (c ColumnSetter) NotEq(v any) colConditioner
- func (c ColumnSetter) Or(cond ...ICond) colConditioner
- func (c *ColumnSetter[T]) PK() *ColumnSetter[T]
- func (c *ColumnSetter[T]) SetName(name string) *ColumnSetter[T]
- func (c ColumnSetter) SetValue(ptr, value any)
- type ColumnWrap
- func (c ColumnWrap[T]) Aggregate(fn preformShare.Aggregator, params ...any) iAggregateCol
- func (c ColumnWrap[C]) Alias() string
- func (c ColumnWrap) And(cond ...ICond) colConditioner
- func (c ColumnWrap) Any(v any) colConditioner
- func (c ColumnWrap[C]) ArrayAgg() iAggregateCol
- func (c ColumnWrap[C]) Avg() iAggregateCol
- func (c ColumnWrap) Between(v1, v2 any) colConditioner
- func (c *ColumnWrap[T]) CaseStmt(pkName string) *CaseStmt
- func (c ColumnWrap) Col() ICol
- func (c ColumnWrap) Concat(arrayCol any) colConditioner
- func (c ColumnWrap) Contains(arrayCol any) colConditioner
- func (c ColumnWrap) ContainsBy(arrayCol any) colConditioner
- func (c ColumnWrap[C]) Count() iAggregateCol
- func (c ColumnWrap[C]) CountDistinct() iAggregateCol
- func (c ColumnWrap) Eq(v any) colConditioner
- func (c ColumnWrap) Expr(exprWithFmt string, args ...any) colConditioner
- func (c ColumnWrap[C]) Factory() IFactory
- func (c *ColumnWrap[T]) GetCode() string
- func (c *ColumnWrap[T]) GetCodeWithAlias() string
- func (c ColumnWrap[C]) GroupConcat(splitter string) iAggregateCol
- func (c ColumnWrap) Gt(v any) colConditioner
- func (c ColumnWrap) GtOrEq(v any) colConditioner
- func (c ColumnWrap) HasAny(arrayCol any) colConditioner
- func (c ColumnWrap[C]) JsonAgg() iAggregateCol
- func (c ColumnWrap) Like(v any) colConditioner
- func (c ColumnWrap) Lt(v any) colConditioner
- func (c ColumnWrap) LtOrEq(v any) colConditioner
- func (c ColumnWrap[C]) Max() iAggregateCol
- func (c ColumnWrap[C]) Mean() iAggregateCol
- func (c ColumnWrap[C]) Median() iAggregateCol
- func (c ColumnWrap[C]) Min() iAggregateCol
- func (c ColumnWrap[C]) Mode() iAggregateCol
- func (c ColumnWrap) NoParentCode() colConditioner
- func (c ColumnWrap) NotEq(v any) colConditioner
- func (c ColumnWrap) Or(cond ...ICond) colConditioner
- func (c ColumnWrap[C]) QueryFactory() IQuery
- func (c *ColumnWrap[C]) SetAlias(alias string) ICol
- func (c ColumnWrap[C]) StdDev() iAggregateCol
- func (c ColumnWrap[C]) Sum() iAggregateCol
- func (c ColumnWrap) ToSql() (query string, args []any, err error)
- type DB
- type DeleteBuilder
- func (b DeleteBuilder[B]) Ctx(ctx context.Context) DeleteBuilder[B]
- func (b DeleteBuilder[B]) Exec(tx ...preformShare.QueryRunner) (int64, error)
- func (b DeleteBuilder[B]) LimitOffset(limit, offset uint64) DeleteBuilder[B]
- func (b DeleteBuilder[B]) ToSql() (string, []any, error)
- func (b DeleteBuilder[B]) Where(cond ICond) DeleteBuilder[B]
- type EagerLoader
- func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Columns(cols ...any) IEagerLoader
- func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Eager(relation IRelation) IEagerLoader
- func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Limit(limit uint32) IEagerLoader
- func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Offset(offset uint32) IEagerLoader
- func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) OrderBy(orderBy any) IEagerLoader
- func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Where(conds ...ICond) IEagerLoader
- type EagerLoaderMt
- type EditConfig
- type Factory
- func (f Factory[FPtr, B]) Alias() string
- func (f Factory) BodyType() reflect.Type
- func (f Factory[FPtr, B]) Clone() IFactory
- func (f Factory) CloneInstance(factory IFactory) IFactory
- func (f Factory) CodeName() string
- func (f Factory[FPtr, B]) Columns() []ICol
- func (f Factory[FPtr, B]) ColumnsByName() map[string]ICol
- func (f Factory[FPtr, B]) Count(cond ...ICond) (uint64, error)
- func (f Factory[FPtr, B]) Db() *db
- func (f *Factory[FPtr, B]) Delete() DeleteBuilder[B]
- func (f *Factory[FPtr, B]) DeleteByPk(body any, cfgs ...EditConfig) (Deleted int64, err error)
- func (f Factory) FieldsByNameNotSafeForClone() map[string]preformShare.IField
- func (f Factory[FPtr, B]) FixedCondition() ICond
- func (f Factory[FPtr, B]) GetAll(cond ...ICond) ([]B, error)
- func (f Factory[FPtr, B]) GetOne(pkLookup ...any) (*B, error)
- func (f Factory[FPtr, B]) IModelScanner() any
- func (f *Factory[FPtr, B]) Insert(body any, cfg ...EditConfig) (err error)
- func (f Factory[FPtr, B]) InsertBatch(bodies any, cfgs ...EditConfig) error
- func (f Factory[FPtr, B]) InsertMap(body map[string]any, cfgs ...EditConfig) error
- func (f Factory[FPtr, B]) InsertOne(body *B, cfgs ...EditConfig) error
- func (f Factory) NewBody() any
- func (f Factory) NewBodyPtr() any
- func (f Factory) NewModel() B
- func (f Factory) PkCondByBody(body iModelBody) squirrel.Eq
- func (f Factory) PkCondByValues(values []any) squirrel.Eq
- func (f Factory) Pks() []ICol
- func (f *Factory[FPtr, B]) Prepare(s ...ISchema)
- func (f Factory) Relations() map[string]IRelation
- func (f Factory[FPtr, B]) Schema() ISchema
- func (f *Factory[FPtr, B]) Select(cols ...any) *SelectQuery[B]
- func (f *Factory[FPtr, B]) SelectAny(cols ...any) *SelectQuery[any]
- func (f Factory[FPtr, B]) SetAlias(alias string) IQuery
- func (f *Factory[FPtr, B]) SetFixedCondition(cond IColConditioner) *Factory[FPtr, B]
- func (f Factory) SetModelScanner(scanner IModelScanner[B])
- func (f *Factory[FPtr, B]) SetSchema(schema ISchema) IFactory
- func (f *Factory[FPtr, B]) SetTableName(name string) *Factory[FPtr, B]
- func (f Factory) TableName() string
- func (f Factory[FPtr, B]) TableNames() []string
- func (f *Factory[FPtr, B]) Update() UpdateBuilder[B]
- func (f *Factory[FPtr, B]) UpdateByPk(body any, cfgs ...UpdateConfig) (updated int64, err error)
- func (f Factory) Use(fn func(factory FPtr))
- type ForeignKey
- func (c ForeignKey[T]) Alias() string
- func (c ForeignKey) And(cond ...ICond) colConditioner
- func (c ForeignKey) Any(v any) colConditioner
- func (c ForeignKey[T]) AssociatedKeys() []IColFromFactory
- func (c ForeignKey) Between(v1, v2 any) colConditioner
- func (c ForeignKey) Col() ICol
- func (c ForeignKey) Concat(arrayCol any) colConditioner
- func (c ForeignKey) Contains(arrayCol any) colConditioner
- func (c ForeignKey) ContainsBy(arrayCol any) colConditioner
- func (c ForeignKey) DbName() string
- func (c ForeignKey) Eq(v any) colConditioner
- func (c ForeignKey) Expr(exprWithFmt string, args ...any) colConditioner
- func (c *ForeignKey[T]) GetCode() string
- func (c *ForeignKey[T]) GetCodeWithAlias() string
- func (c ForeignKey) GetPos() int
- func (c ForeignKey) GetRawPtrScanner() (vv any, toScanner func(*any) any)
- func (c ForeignKey) Gt(v any) colConditioner
- func (c ForeignKey) GtOrEq(v any) colConditioner
- func (c ForeignKey) HasAny(arrayCol any) colConditioner
- func (c *ForeignKey[T]) Join(col ...IColFromFactory) iForeignKeyJoin
- func (c ForeignKey) Like(v any) colConditioner
- func (c ForeignKey) Lt(v any) colConditioner
- func (c ForeignKey) LtOrEq(v any) colConditioner
- func (c ForeignKey) Name() string
- func (c ForeignKey) NewValue() any
- func (c ForeignKey) NewZero() T
- func (c ForeignKey) NoParentCode() colConditioner
- func (c ForeignKey) NotEq(v any) colConditioner
- func (c ForeignKey) Or(cond ...ICond) colConditioner
- func (c *ForeignKey[T]) SetAlias(alias string) ICol
- func (c ForeignKey) SetValue(ptr, value any)
- func (c ForeignKey[T]) TargetFactory() IFactory
- func (c ForeignKey[T]) ToJoinSql(queryFactory IQuery) (IQuery, string, []interface{}, error)
- func (c ForeignKey[T]) ToSql() (string, []interface{}, error)
- type ForeignKeyJoin
- type ForeignKeySetter
- func (c ForeignKeySetter) And(cond ...ICond) colConditioner
- func (c ForeignKeySetter) Any(v any) colConditioner
- func (c ForeignKeySetter) Between(v1, v2 any) colConditioner
- func (c ForeignKeySetter) Col() ICol
- func (c ForeignKeySetter) Concat(arrayCol any) colConditioner
- func (c ForeignKeySetter) Contains(arrayCol any) colConditioner
- func (c ForeignKeySetter) ContainsBy(arrayCol any) colConditioner
- func (c ForeignKeySetter) DbName() string
- func (c ForeignKeySetter) Eq(v any) colConditioner
- func (c ForeignKeySetter) Expr(exprWithFmt string, args ...any) colConditioner
- func (c ForeignKeySetter) GetPos() int
- func (c ForeignKeySetter) GetRawPtrScanner() (vv any, toScanner func(*any) any)
- func (c ForeignKeySetter) Gt(v any) colConditioner
- func (c ForeignKeySetter) GtOrEq(v any) colConditioner
- func (c ForeignKeySetter) HasAny(arrayCol any) colConditioner
- func (c ForeignKeySetter) Like(v any) colConditioner
- func (c ForeignKeySetter) Lt(v any) colConditioner
- func (c ForeignKeySetter) LtOrEq(v any) colConditioner
- func (c ForeignKeySetter) Name() string
- func (c ForeignKeySetter) NewValue() any
- func (c ForeignKeySetter) NewZero() T
- func (c ForeignKeySetter) NoParentCode() colConditioner
- func (c ForeignKeySetter) NotEq(v any) colConditioner
- func (c ForeignKeySetter) Or(cond ...ICond) colConditioner
- func (s *ForeignKeySetter[T]) SetRelation(related IRelation, col ...IColFromFactory) *ForeignKeySetter[T]
- func (c ForeignKeySetter) SetValue(ptr, value any)
- type ICol
- type IColConditioner
- type IColFromFactory
- type IColWrap
- type ICond
- type IEagerLoader
- type IFactory
- type IForeignKey
- type IModelScanner
- type IQuery
- type IRelation
- type IRow
- type IRows
- type ISchema
- type IStmt
- type ITracer
- type IViewFactory
- type MiddleTable
- func (r MiddleTable) Columns(cols ...any) IEagerLoader
- func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) Eager(relation IRelation) IEagerLoader
- func (r *MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) ExtraCond(cond ICond) IRelation
- func (r MiddleTable) ForeignKeys() []IColFromFactory
- func (r MiddleTable) Index() uint32
- func (r *MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) InitMtRelation(middleTable IFactory, ...) IRelation
- func (r *MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) InitRelation(localAndForeignKeyPairs ...IColFromFactory) IRelation
- func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) IsMiddleTable() bool
- func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) JoinClause() ForeignKeyJoin
- func (r MiddleTable) Limit(limit uint32) IEagerLoader
- func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) LinkModels(bodies ...MiddleBody) error
- func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) Load(body SrcBody) error
- func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) LoadQuery(body SrcBody) *SelectQuery[TargetBody]
- func (r MiddleTable) LocalFactory() IFactory
- func (r MiddleTable) LocalKeys() []IColFromFactory
- func (r MiddleTable) Name() string
- func (r MiddleTable) Offset(offset uint32) IEagerLoader
- func (r MiddleTable) OrderBy(orderBy any) IEagerLoader
- func (r *MiddleTable) TargetBody() TargetBody
- func (r MiddleTable) TargetFactory() IFactory
- func (r MiddleTable) Where(conds ...ICond) IEagerLoader
- type NoAggregation
- type PrebuildQueryCol
- type PrebuildQueryFactory
- func (f PrebuildQueryFactory[FPtr, B]) AddRelation(r IRelation) uint32
- func (f PrebuildQueryFactory[FPtr, B]) Alias() string
- func (f PrebuildQueryFactory[FPtr, B]) BodyType() reflect.Type
- func (f PrebuildQueryFactory[FPtr, B]) CodeName() string
- func (f PrebuildQueryFactory[FPtr, B]) Columns() []ICol
- func (f PrebuildQueryFactory[FPtr, B]) ColumnsByName() map[string]ICol
- func (f *PrebuildQueryFactory[FPtr, B]) Db() *db
- func (f *PrebuildQueryFactory[FPtr, B]) DefineCols(cols ...any) *PrebuildQueryFactory[FPtr, B]
- func (f *PrebuildQueryFactory[FPtr, B]) GroupBy(group ...any) *PrebuildQueryFactory[FPtr, B]
- func (f *PrebuildQueryFactory[FPtr, B]) Having(cond any, extra ...any) *PrebuildQueryFactory[FPtr, B]
- func (f *PrebuildQueryFactory[FPtr, B]) Insert(body any, cfg ...EditConfig) error
- func (f *PrebuildQueryFactory[FPtr, B]) Join(join string, factory IFactory, cond ...ICond) *PrebuildQueryFactory[FPtr, B]
- func (f PrebuildQueryFactory[FPtr, B]) NewBody() any
- func (f PrebuildQueryFactory[FPtr, B]) NewBodyPtr() any
- func (f *PrebuildQueryFactory[FPtr, B]) NewModel() B
- func (f *PrebuildQueryFactory[FPtr, B]) OrderBy(order ...string) *PrebuildQueryFactory[FPtr, B]
- func (f PrebuildQueryFactory[FPtr, B]) Parent() string
- func (f PrebuildQueryFactory[FPtr, B]) PkAndValues(body iModelBody) squirrel.Eq
- func (f PrebuildQueryFactory[FPtr, B]) Pks() []ICol
- func (f *PrebuildQueryFactory[FPtr, B]) PreSetWhere(cond any, extra ...any) *PrebuildQueryFactory[FPtr, B]
- func (f *PrebuildQueryFactory[FPtr, B]) Prepare(schemas ...ISchema)
- func (f *PrebuildQueryFactory[FPtr, B]) Select(overwrittenCols ...any) *SelectQuery[B]
- func (f *PrebuildQueryFactory[FPtr, B]) SetAlias(alias string) IQuery
- func (f *PrebuildQueryFactory[FPtr, B]) SetModelScanner(scanner IModelScanner[B])
- func (f *PrebuildQueryFactory[FPtr, B]) SetSrc(factory IFactory) *PrebuildQueryFactory[FPtr, B]
- func (f PrebuildQueryFactory[FPtr, B]) TableName() string
- func (f PrebuildQueryFactory[FPtr, B]) TableNames() []string
- type PrimaryKey
- func (c PrimaryKey) And(cond ...ICond) colConditioner
- func (c PrimaryKey) Any(v any) colConditioner
- func (c PrimaryKey) Between(v1, v2 any) colConditioner
- func (c PrimaryKey) Col() ICol
- func (c PrimaryKey) Concat(arrayCol any) colConditioner
- func (c PrimaryKey) Contains(arrayCol any) colConditioner
- func (c PrimaryKey) ContainsBy(arrayCol any) colConditioner
- func (c PrimaryKey) DbName() string
- func (c PrimaryKey) Eq(v any) colConditioner
- func (c PrimaryKey) Expr(exprWithFmt string, args ...any) colConditioner
- func (c PrimaryKey) GetPos() int
- func (c PrimaryKey) GetRawPtrScanner() (vv any, toScanner func(*any) any)
- func (c PrimaryKey) Gt(v any) colConditioner
- func (c PrimaryKey) GtOrEq(v any) colConditioner
- func (c PrimaryKey) HasAny(arrayCol any) colConditioner
- func (c PrimaryKey) Like(v any) colConditioner
- func (c PrimaryKey) Lt(v any) colConditioner
- func (c PrimaryKey) LtOrEq(v any) colConditioner
- func (c PrimaryKey) Name() string
- func (c PrimaryKey) NewValue() any
- func (c PrimaryKey) NewZero() T
- func (c PrimaryKey) NoParentCode() colConditioner
- func (c PrimaryKey) NotEq(v any) colConditioner
- func (c PrimaryKey) Or(cond ...ICond) colConditioner
- func (c PrimaryKey) SetValue(ptr, value any)
- type QueryBody
- type RowsWithCols
- type RowsWithTrace
- type Schema
- func (s Schema[TPtr, T]) BeginTx(ctx context.Context) (*Tx, error)
- func (s *Schema[TPtr, T]) Db() *db
- func (s *Schema[TPtr, T]) DbName() string
- func (s Schema[TPtr, T]) FactoriesByBodyType() map[reflect.Type]IFactory
- func (s Schema[TPtr, T]) FactoriesByName() map[string]IFactory
- func (s *Schema[TPtr, T]) Inherit(schema ISchema)
- func (s *Schema[TPtr, T]) Init(schemaName string, instance any, conn *sql.DB, ...)
- func (s Schema[TPtr, T]) Name() string
- func (s *Schema[TPtr, T]) PrepareFactories(schemas []ISchema)
- func (s Schema[TPtr, T]) RunTx(fn func(t TPtr) error) error
- func (s *Schema[TPtr, T]) SetConn(conn *sql.DB, queryRunner ...preformShare.QueryRunner)
- func (s *Schema[TPtr, T]) SetTracerToDb(tracerNilToOff ITracer)
- func (s *Schema[TPtr, T]) Use(fn func(s TPtr))
- type SelectQuery
- func (b *SelectQuery[B]) AsSubQuery(alias string) squirrel.Sqlizer
- func (b *SelectQuery[B]) Column(column interface{}, args ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) Columns(cols ...any) *SelectQuery[B]
- func (b SelectQuery[B]) Count(col ...string) (uint64, error)
- func (b *SelectQuery[B]) CrossJoin(join string, rest ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) CrossJoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
- func (b *SelectQuery[B]) CrossRelation(rel IRelation) *SelectQuery[B]
- func (b *SelectQuery[B]) Ctx(ctx context.Context) *SelectQuery[B]
- func (b *SelectQuery[B]) Distinct() *SelectQuery[B]
- func (b *SelectQuery[B]) Eager(relation ...IRelation) *SelectQuery[B]
- func (b *SelectQuery[B]) From(from any) *SelectQuery[B]
- func (b *SelectQuery[B]) FromSelect(from preformShare.SelectBuilder, alias string) *SelectQuery[B]
- func (b *SelectQuery[B]) FromSubQuery(from *subQueryCol, alias string) *SelectQuery[B]
- func (b SelectQuery[B]) GetAll(cond ...ICond) ([]B, error)
- func (b SelectQuery[B]) GetAllFast(cond ...ICond) ([]B, error)
- func (b SelectQuery[B]) GetOne(pkLookup ...any) (*B, error)
- func (b *SelectQuery[B]) GroupBy(groupBys ...any) *SelectQuery[B]
- func (b *SelectQuery[B]) Having(pred interface{}, rest ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) InnerJoin(join string, rest ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) InnerJoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
- func (b *SelectQuery[B]) InnerRelation(rel IRelation) *SelectQuery[B]
- func (b *SelectQuery[B]) Join(join string, rest ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) JoinClause(pred interface{}, args ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) JoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
- func (b *SelectQuery[B]) JoinRelation(rel IRelation) *SelectQuery[B]
- func (b *SelectQuery[B]) LeftJoin(join string, rest ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) LeftJoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
- func (b *SelectQuery[B]) LeftRelation(rel IRelation) *SelectQuery[B]
- func (b *SelectQuery[B]) Limit(limit uint64) *SelectQuery[B]
- func (b SelectQuery[B]) MustSql() (string, []interface{})
- func (b *SelectQuery[B]) Offset(offset uint64) *SelectQuery[B]
- func (b *SelectQuery[B]) Options(options ...string) *SelectQuery[B]
- func (b *SelectQuery[B]) OrderBy(orderBys ...string) *SelectQuery[B]
- func (b *SelectQuery[B]) OrderByClause(pred interface{}, args ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) PlaceholderFormat(f squirrel.PlaceholderFormat) *SelectQuery[B]
- func (b *SelectQuery[B]) Prefix(sql string, args ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) PrefixExpr(expr ICond) *SelectQuery[B]
- func (b *SelectQuery[B]) Prepare() (*SelectQuery[B], error)
- func (b SelectQuery[B]) Query() (*sql.Rows, error)
- func (b SelectQuery[B]) QueryAnys() ([]any, error)
- func (b SelectQuery[B]) QueryBodies() ([]B, error)
- func (b SelectQuery[B]) QueryBodiesFast() ([]B, error)
- func (b SelectQuery[B]) QueryBody() (*B, error)
- func (b SelectQuery[B]) QueryRaw() (*RowsWithCols, error)
- func (b SelectQuery[B]) QueryRow() *sqlRow
- func (b SelectQuery[B]) QueryRowx() *sqlRow
- func (b SelectQuery[B]) QueryStructs(s any) error
- func (b SelectQuery[B]) Queryx() (*sqlx.Rows, error)
- func (b *SelectQuery[B]) QuoteIdentifier(id string) string
- func (b *SelectQuery[B]) RemoveColumns() *SelectQuery[B]
- func (b *SelectQuery[B]) RemoveLimit() *SelectQuery[B]
- func (b *SelectQuery[B]) RemoveOffset() *SelectQuery[B]
- func (b *SelectQuery[B]) RightJoin(join string, rest ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) RightJoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
- func (b *SelectQuery[B]) RightRelation(rel IRelation) *SelectQuery[B]
- func (b *SelectQuery[B]) Suffix(sql string, args ...interface{}) *SelectQuery[B]
- func (b *SelectQuery[B]) SuffixExpr(expr squirrel.Sqlizer) *SelectQuery[B]
- func (b SelectQuery[B]) ToSql() (string, []interface{}, error)
- func (b *SelectQuery[B]) Where(pred interface{}, args ...interface{}) *SelectQuery[B]
- type StmtWithTrace
- func (s *StmtWithTrace) Exec(args ...interface{}) (res sql.Result, err error)
- func (s *StmtWithTrace) ExecContext(ctx context.Context, args ...interface{}) (res sql.Result, err error)
- func (s *StmtWithTrace) Query(args ...interface{}) (rows IRows, err error)
- func (s *StmtWithTrace) QueryContext(ctx context.Context, args ...interface{}) (rows IRows, err error)
- func (s *StmtWithTrace) QueryRow(args ...interface{}) (row *sql.Row)
- func (s *StmtWithTrace) QueryRowContext(ctx context.Context, args ...interface{}) (row *sql.Row)
- type ToMany
- func (r ToMany) Columns(cols ...any) IEagerLoader
- func (r *ToMany) Eager(relation IRelation) IEagerLoader
- func (r *ToMany[SrcBody, TargetFactory, TargetBody]) ExtraCond(cond ICond) IRelation
- func (r ToMany) ForeignKeys() []IColFromFactory
- func (r ToMany) Index() uint32
- func (r *ToMany[SrcBody, TargetFactory, TargetBody]) InitRelation(localAndForeignKeyPairs ...IColFromFactory) IRelation
- func (r ToMany) IsMiddleTable() bool
- func (r ToMany) JoinClause() ForeignKeyJoin
- func (r ToMany) Limit(limit uint32) IEagerLoader
- func (r ToMany) Load(body SrcBody) error
- func (r ToMany) LoadQuery(body SrcBody) *SelectQuery[TargetBody]
- func (r ToMany) LocalFactory() IFactory
- func (r ToMany) LocalKeys() []IColFromFactory
- func (r ToMany) Name() string
- func (r ToMany) Offset(offset uint32) IEagerLoader
- func (r ToMany) OrderBy(orderBy any) IEagerLoader
- func (r *ToMany) TargetBody() TargetBody
- func (r ToMany) TargetFactory() IFactory
- func (r ToMany) Where(conds ...ICond) IEagerLoader
- type ToOne
- func (r ToOne) Columns(cols ...any) IEagerLoader
- func (r *ToOne) Eager(relation IRelation) IEagerLoader
- func (r *ToOne[SrcBody, TargetFactory, TargetBody]) ExtraCond(cond ICond) IRelation
- func (r ToOne) ForeignKeys() []IColFromFactory
- func (r ToOne) Index() uint32
- func (r *ToOne[SrcBody, TargetFactory, TargetBody]) InitRelation(localAndForeignKeyPairs ...IColFromFactory) IRelation
- func (r ToOne) IsMiddleTable() bool
- func (r ToOne) JoinClause() ForeignKeyJoin
- func (r ToOne) Limit(limit uint32) IEagerLoader
- func (r ToOne) Load(body SrcBody) error
- func (r ToOne) LoadQuery(body SrcBody) *SelectQuery[TargetBody]
- func (r ToOne) LocalFactory() IFactory
- func (r ToOne) LocalKeys() []IColFromFactory
- func (r ToOne) Name() string
- func (r ToOne) Offset(offset uint32) IEagerLoader
- func (r ToOne) OrderBy(orderBy any) IEagerLoader
- func (r *ToOne) TargetBody() TargetBody
- func (r ToOne) TargetFactory() IFactory
- func (r ToOne) Where(conds ...ICond) IEagerLoader
- type Tx
- func (t *Tx) Commit() error
- func (t *Tx) Db() *db
- func (t *Tx) Error(msg string, err error)
- func (t *Tx) GetDialect() preformShare.IDialect
- func (t *Tx) PrepareTrace(ctx context.Context, query string) (IStmt, error)
- func (t *Tx) QueryTraceScan(ctx context.Context, query string, args ...interface{}) (rows IRows, err error)
- func (t *Tx) Rollback() error
- type UpdateBuilder
- func (b UpdateBuilder[B]) Columns(cols ...ICol) UpdateBuilder[B]
- func (b UpdateBuilder[B]) Ctx(ctx context.Context) UpdateBuilder[B]
- func (b UpdateBuilder[B]) Exec(tx ...preformShare.QueryRunner) (int64, error)
- func (b UpdateBuilder[B]) LimitOffset(limit, offset uint64) UpdateBuilder[B]
- func (b UpdateBuilder[B]) Set(col any, value any) UpdateBuilder[B]
- func (b UpdateBuilder[B]) SetBodies(body ...*B) UpdateBuilder[B]
- func (b UpdateBuilder[B]) SetMap(clause map[string]any) UpdateBuilder[B]
- func (b UpdateBuilder[B]) ToSql() (string, []any, error)
- func (b UpdateBuilder[B]) Where(cond ICond) UpdateBuilder[B]
- type UpdateConfig
- type ViewFactory
- func (f ViewFactory) BodyType() reflect.Type
- func (f ViewFactory[FPtr, B]) Clone() IFactory
- func (f ViewFactory) CloneInstance(factory IFactory) IFactory
- func (f ViewFactory) CodeName() string
- func (f *ViewFactory[FPtr, B]) DeleteByPk(body any, cfg ...EditConfig) (int64, error)
- func (f ViewFactory) FieldsByNameNotSafeForClone() map[string]preformShare.IField
- func (f *ViewFactory[FPtr, B]) Insert(body any, cfg ...EditConfig) error
- func (f ViewFactory[FPtr, B]) IsView()
- func (f ViewFactory) NewBody() any
- func (f ViewFactory) NewBodyPtr() any
- func (f ViewFactory) NewModel() B
- func (f ViewFactory) PkCondByBody(body iModelBody) squirrel.Eq
- func (f ViewFactory) PkCondByValues(values []any) squirrel.Eq
- func (f ViewFactory) Pks() []ICol
- func (f ViewFactory) Relations() map[string]IRelation
- func (f ViewFactory[FPtr, B]) SetAlias(alias string) IQuery
- func (f ViewFactory) SetModelScanner(scanner IModelScanner[B])
- func (f *ViewFactory[FPtr, B]) SetSchema(schema ISchema) IFactory
- func (f *ViewFactory[FPtr, B]) SetTableName(name string) *ViewFactory[FPtr, B]
- func (f ViewFactory) TableName() string
- func (f *ViewFactory[FPtr, B]) UpdateByPk(body any, cfg ...UpdateConfig) (int64, error)
- func (f ViewFactory) Use(fn func(factory FPtr))
Constants ¶
View Source
const (
INSERT_CHUNK_SIZE = 1000
)
Variables ¶
View Source
var Aggr = aggr{}
View Source
var (
DefaultDB *db
)
Functions ¶
func Aggregate ¶
func Aggregate[T any](fn preformShare.Aggregator, colOrString any, params ...any) iAggregateCol
func DbFromNative ¶
func DbFromNative(d *sql.DB, queryRunner ...preformShare.QueryRunner) *db
func IniPrebuildQueryFactory ¶
func IniPrebuildQueryFactory[FPtr iPrebuildQueryFactory, B any](setter func(d FPtr)) FPtr
func InitFactory ¶
func InitViewFactory ¶
func InitViewFactory[FPtr IViewFactory, B any](setter any) func() FPtr
func PrepareFactories ¶
func PrepareFactories(s ISchema)
func PrepareQueriesAndRelation ¶
func PrepareQueriesAndRelation(s ...ISchema)
Types ¶
type AggregateCol ¶
type AggregateCol[T any] struct { ICol Aggregator preformShare.Aggregator // contains filtered or unexported fields }
implements ICol
func (*AggregateCol[T]) GetRawPtrScanner ¶
func (a *AggregateCol[T]) GetRawPtrScanner() (vv any, toScanner func(*any) any)
func (*AggregateCol[T]) SetAlias ¶
func (a *AggregateCol[T]) SetAlias(alias string) ICol
func (AggregateCol[T]) WithDialect ¶
func (a AggregateCol[T]) WithDialect(d preformShare.IDialect) ICond
type Body ¶
type Body[T hasFactory[F], F IFactory] struct { QueryBody[T, F] // contains filtered or unexported fields }
func (Body[T, F]) Delete ¶
func (b Body[T, F]) Delete(body *T, cfg ...EditConfig) (affected int64, err error)
func (Body[T, F]) Insert ¶
func (b Body[T, F]) Insert(body *T, cfg ...EditConfig) error
func (Body[T, F]) UpdateByPk ¶
func (b Body[T, F]) UpdateByPk(body *T, cfg ...UpdateConfig) (affected int64, err error)
type CaseStmt ¶
type CaseStmt struct {
// contains filtered or unexported fields
}
func (*CaseStmt) MustSql ¶
func (c *CaseStmt) MustSql(dialect preformShare.IDialect) (string, []interface{})
type Column ¶
type Column[T any] struct { // contains filtered or unexported fields }
func (Column[T]) Aggregate ¶
func (a Column[T]) Aggregate(fn preformShare.Aggregator, params ...any) iAggregateCol
func (Column) ContainsBy ¶
func (c Column) ContainsBy(arrayCol any) colConditioner
func (Column[T]) CountDistinct ¶
func (a Column[T]) CountDistinct() iAggregateCol
func (*Column[T]) GetCodeWithAlias ¶
func (Column) GetRawPtrScanner ¶
func (Column[T]) GroupConcat ¶
func (Column) NoParentCode ¶
func (c Column) NoParentCode() colConditioner
func (Column[T]) ParentModel ¶
func (Column[T]) QueryFactory ¶
type ColumnSetter ¶
func SetColumn ¶
func SetColumn[T any](c *Column[T]) *ColumnSetter[T]
func (*ColumnSetter[T]) AutoIncrement ¶
func (c *ColumnSetter[T]) AutoIncrement() *ColumnSetter[T]
func (ColumnSetter) ContainsBy ¶
func (c ColumnSetter) ContainsBy(arrayCol any) colConditioner
func (*ColumnSetter[T]) GetCol ¶
func (c *ColumnSetter[T]) GetCol() ICol
func (ColumnSetter) GetRawPtrScanner ¶
func (ColumnSetter) NoParentCode ¶
func (c ColumnSetter) NoParentCode() colConditioner
func (*ColumnSetter[T]) PK ¶
func (c *ColumnSetter[T]) PK() *ColumnSetter[T]
func (*ColumnSetter[T]) SetName ¶
func (c *ColumnSetter[T]) SetName(name string) *ColumnSetter[T]
type ColumnWrap ¶
func (ColumnWrap[T]) Aggregate ¶
func (c ColumnWrap[T]) Aggregate(fn preformShare.Aggregator, params ...any) iAggregateCol
func (ColumnWrap[C]) Alias ¶
func (c ColumnWrap[C]) Alias() string
func (ColumnWrap[C]) ArrayAgg ¶
func (c ColumnWrap[C]) ArrayAgg() iAggregateCol
func (ColumnWrap[C]) Avg ¶
func (c ColumnWrap[C]) Avg() iAggregateCol
func (*ColumnWrap[T]) CaseStmt ¶
func (c *ColumnWrap[T]) CaseStmt(pkName string) *CaseStmt
func (ColumnWrap) ContainsBy ¶
func (c ColumnWrap) ContainsBy(arrayCol any) colConditioner
func (ColumnWrap[C]) Count ¶
func (c ColumnWrap[C]) Count() iAggregateCol
func (ColumnWrap[C]) CountDistinct ¶
func (c ColumnWrap[C]) CountDistinct() iAggregateCol
func (ColumnWrap[C]) Factory ¶
func (c ColumnWrap[C]) Factory() IFactory
func (*ColumnWrap[T]) GetCode ¶
func (c *ColumnWrap[T]) GetCode() string
func (*ColumnWrap[T]) GetCodeWithAlias ¶
func (c *ColumnWrap[T]) GetCodeWithAlias() string
func (ColumnWrap[C]) GroupConcat ¶
func (c ColumnWrap[C]) GroupConcat(splitter string) iAggregateCol
func (ColumnWrap[C]) JsonAgg ¶
func (c ColumnWrap[C]) JsonAgg() iAggregateCol
func (ColumnWrap[C]) Max ¶
func (c ColumnWrap[C]) Max() iAggregateCol
func (ColumnWrap[C]) Mean ¶
func (c ColumnWrap[C]) Mean() iAggregateCol
func (ColumnWrap[C]) Median ¶
func (c ColumnWrap[C]) Median() iAggregateCol
func (ColumnWrap[C]) Min ¶
func (c ColumnWrap[C]) Min() iAggregateCol
func (ColumnWrap[C]) Mode ¶
func (c ColumnWrap[C]) Mode() iAggregateCol
func (ColumnWrap) NoParentCode ¶
func (c ColumnWrap) NoParentCode() colConditioner
func (ColumnWrap[C]) QueryFactory ¶
func (c ColumnWrap[C]) QueryFactory() IQuery
func (*ColumnWrap[C]) SetAlias ¶
func (c *ColumnWrap[C]) SetAlias(alias string) ICol
func (ColumnWrap[C]) StdDev ¶
func (c ColumnWrap[C]) StdDev() iAggregateCol
func (ColumnWrap[C]) Sum ¶
func (c ColumnWrap[C]) Sum() iAggregateCol
type DeleteBuilder ¶
type DeleteBuilder[B any] struct { Builder preformShare.DeleteBuilder // contains filtered or unexported fields }
func (DeleteBuilder[B]) Ctx ¶
func (b DeleteBuilder[B]) Ctx(ctx context.Context) DeleteBuilder[B]
func (DeleteBuilder[B]) Exec ¶
func (b DeleteBuilder[B]) Exec(tx ...preformShare.QueryRunner) (int64, error)
func (DeleteBuilder[B]) LimitOffset ¶
func (b DeleteBuilder[B]) LimitOffset(limit, offset uint64) DeleteBuilder[B]
func (DeleteBuilder[B]) Where ¶
func (b DeleteBuilder[B]) Where(cond ICond) DeleteBuilder[B]
type EagerLoader ¶
type EagerLoader[SB iModelRelatedBody, TF IFactory, TB any] struct { IRelation // contains filtered or unexported fields }
func (*EagerLoader[SrcBody, TargetFactory, TargetBody]) Columns ¶
func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Columns(cols ...any) IEagerLoader
func (*EagerLoader[SrcBody, TargetFactory, TargetBody]) Eager ¶
func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Eager(relation IRelation) IEagerLoader
func (*EagerLoader[SrcBody, TargetFactory, TargetBody]) Limit ¶
func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Limit(limit uint32) IEagerLoader
func (*EagerLoader[SrcBody, TargetFactory, TargetBody]) Offset ¶
func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Offset(offset uint32) IEagerLoader
func (*EagerLoader[SrcBody, TargetFactory, TargetBody]) OrderBy ¶
func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) OrderBy(orderBy any) IEagerLoader
func (*EagerLoader[SrcBody, TargetFactory, TargetBody]) Where ¶
func (loader *EagerLoader[SrcBody, TargetFactory, TargetBody]) Where(conds ...ICond) IEagerLoader
type EagerLoaderMt ¶
type EagerLoaderMt[SB iModelRelatedBody, TF IFactory, TB, MTB any] struct { *EagerLoader[SB, TF, TB] }
type EditConfig ¶
type Factory ¶
type Factory[FPtr IFactory, B any] struct { Definition FPtr // contains filtered or unexported fields }
func (Factory) CloneInstance ¶
func (Factory[FPtr, B]) ColumnsByName ¶
func (*Factory[FPtr, B]) Delete ¶
func (f *Factory[FPtr, B]) Delete() DeleteBuilder[B]
func (*Factory[FPtr, B]) DeleteByPk ¶
func (f *Factory[FPtr, B]) DeleteByPk(body any, cfgs ...EditConfig) (Deleted int64, err error)
func (Factory) FieldsByNameNotSafeForClone ¶
func (f Factory) FieldsByNameNotSafeForClone() map[string]preformShare.IField
func (Factory[FPtr, B]) FixedCondition ¶
func (Factory[FPtr, B]) IModelScanner ¶
func (*Factory[FPtr, B]) Insert ¶
func (f *Factory[FPtr, B]) Insert(body any, cfg ...EditConfig) (err error)
Insert body bodies map maps with cascading and insert id
func (Factory[FPtr, B]) InsertBatch ¶
func (f Factory[FPtr, B]) InsertBatch(bodies any, cfgs ...EditConfig) error
for []*B, []B insert not require insert id and cascading
func (Factory[FPtr, B]) InsertMap ¶
func (f Factory[FPtr, B]) InsertMap(body map[string]any, cfgs ...EditConfig) error
func (Factory[FPtr, B]) InsertOne ¶
func (f Factory[FPtr, B]) InsertOne(body *B, cfgs ...EditConfig) error
func (Factory) NewBodyPtr ¶
func (f Factory) NewBodyPtr() any
func (Factory) PkCondByBody ¶
func (Factory) PkCondByValues ¶
func (*Factory[FPtr, B]) Select ¶
func (f *Factory[FPtr, B]) Select(cols ...any) *SelectQuery[B]
func (*Factory[FPtr, B]) SelectAny ¶
func (f *Factory[FPtr, B]) SelectAny(cols ...any) *SelectQuery[any]
func (*Factory[FPtr, B]) SetFixedCondition ¶
func (f *Factory[FPtr, B]) SetFixedCondition(cond IColConditioner) *Factory[FPtr, B]
func (Factory) SetModelScanner ¶
func (f Factory) SetModelScanner(scanner IModelScanner[B])
func (*Factory[FPtr, B]) SetTableName ¶
func (Factory[FPtr, B]) TableNames ¶
func (*Factory[FPtr, B]) Update ¶
func (f *Factory[FPtr, B]) Update() UpdateBuilder[B]
func (*Factory[FPtr, B]) UpdateByPk ¶
func (f *Factory[FPtr, B]) UpdateByPk(body any, cfgs ...UpdateConfig) (updated int64, err error)
UpdateByPk update body by pk, can cascade, will skip pk columns
type ForeignKey ¶
func (ForeignKey[T]) Alias ¶
func (c ForeignKey[T]) Alias() string
func (ForeignKey[T]) AssociatedKeys ¶
func (c ForeignKey[T]) AssociatedKeys() []IColFromFactory
func (ForeignKey) ContainsBy ¶
func (c ForeignKey) ContainsBy(arrayCol any) colConditioner
func (*ForeignKey[T]) GetCode ¶
func (c *ForeignKey[T]) GetCode() string
func (*ForeignKey[T]) GetCodeWithAlias ¶
func (c *ForeignKey[T]) GetCodeWithAlias() string
func (ForeignKey) GetRawPtrScanner ¶
func (*ForeignKey[T]) Join ¶
func (c *ForeignKey[T]) Join(col ...IColFromFactory) iForeignKeyJoin
func (ForeignKey) NoParentCode ¶
func (c ForeignKey) NoParentCode() colConditioner
func (*ForeignKey[T]) SetAlias ¶
func (c *ForeignKey[T]) SetAlias(alias string) ICol
func (ForeignKey[T]) TargetFactory ¶
func (c ForeignKey[T]) TargetFactory() IFactory
func (ForeignKey[T]) ToJoinSql ¶
func (c ForeignKey[T]) ToJoinSql(queryFactory IQuery) (IQuery, string, []interface{}, error)
func (ForeignKey[T]) ToSql ¶
func (c ForeignKey[T]) ToSql() (string, []interface{}, error)
type ForeignKeyJoin ¶
type ForeignKeyJoin struct {
// contains filtered or unexported fields
}
func (ForeignKeyJoin) Join ¶
func (c ForeignKeyJoin) Join(col ...IColFromFactory) iForeignKeyJoin
func (ForeignKeyJoin) TargetFactory ¶
func (c ForeignKeyJoin) TargetFactory() IFactory
type ForeignKeySetter ¶
type ForeignKeySetter[T any] struct { *ColumnSetter[T] // contains filtered or unexported fields }
func SetForeignKey ¶
func SetForeignKey[T any](c *ForeignKey[T]) *ForeignKeySetter[T]
func (ForeignKeySetter) Between ¶
func (c ForeignKeySetter) Between(v1, v2 any) colConditioner
Between
func (ForeignKeySetter) ContainsBy ¶
func (c ForeignKeySetter) ContainsBy(arrayCol any) colConditioner
func (ForeignKeySetter) GetRawPtrScanner ¶
func (ForeignKeySetter) NoParentCode ¶
func (c ForeignKeySetter) NoParentCode() colConditioner
func (*ForeignKeySetter[T]) SetRelation ¶
func (s *ForeignKeySetter[T]) SetRelation(related IRelation, col ...IColFromFactory) *ForeignKeySetter[T]
type ICol ¶
type ICol interface { preformShare.ICol IColConditioner SetAlias(alias string) ICol Alias() string QueryFactory() IQuery Asc() string Desc() string Aggregate(fn preformShare.Aggregator, params ...any) iAggregateCol Sum() iAggregateCol Avg() iAggregateCol Max() iAggregateCol Min() iAggregateCol Count() iAggregateCol CountDistinct() iAggregateCol Mean() iAggregateCol Median() iAggregateCol Mode() iAggregateCol StdDev() iAggregateCol JsonAgg() iAggregateCol ArrayAgg() iAggregateCol GroupConcat(splitter string) iAggregateCol CaseStmt(pkName string) *CaseStmt IsSame(ICol) bool // contains filtered or unexported methods }
type IColConditioner ¶
type IColConditioner interface { ICond Col() ICol Expr(exprWithFmt string, args ...any) colConditioner Eq(v any) colConditioner NotEq(v any) colConditioner Like(v any) colConditioner Gt(v any) colConditioner GtOrEq(v any) colConditioner Lt(v any) colConditioner LtOrEq(v any) colConditioner Between(v1, v2 any) colConditioner And(cond ...ICond) colConditioner Or(cond ...ICond) colConditioner Contains(arrCol any) colConditioner ContainsBy(arrCol any) colConditioner HasAny(arrCol any) colConditioner Any(v any) colConditioner Concat(arrCol any) colConditioner NoParentCode() colConditioner }
type IColFromFactory ¶
type IColWrap ¶
type IColWrap interface { preformShare.ICol SetAlias(alias string) ICol QueryFactory() IQuery Asc() string Desc() string Aggregate(fn preformShare.Aggregator, params ...any) iAggregateCol Sum() iAggregateCol Avg() iAggregateCol Max() iAggregateCol Min() iAggregateCol Count() iAggregateCol Mean() iAggregateCol Median() iAggregateCol Mode() iAggregateCol StdDev() iAggregateCol CountDistinct() iAggregateCol JsonAgg() iAggregateCol ArrayAgg() iAggregateCol GroupConcat(splitter string) iAggregateCol IsSame(col ICol) bool // contains filtered or unexported methods }
type IEagerLoader ¶
type IEagerLoader interface { IRelation // contains filtered or unexported methods }
type IFactory ¶
type IFactory interface { IQuery Schema() ISchema Pks() []ICol PkCondByBody(body iModelBody) squirrel.Eq Insert(body any, cfg ...EditConfig) error UpdateByPk(body any, cfg ...UpdateConfig) (int64, error) DeleteByPk(body any, cfg ...EditConfig) (int64, error) SetSchema(schema ISchema) IFactory Relations() map[string]IRelation SelectAny(cols ...any) *SelectQuery[any] Clone() IFactory CloneInstance(factory IFactory) IFactory FixedCondition() ICond IModelScanner() any // contains filtered or unexported methods }
type IForeignKey ¶
type IForeignKey interface { ICol AssociatedKeys() []IColFromFactory }
type IModelScanner ¶
type IModelScanner[B any] interface { ScanCount(rows IRows) (uint64, error) ScanAny(rows IRows, cols []ICol, max uint64) ([]any, error) ScanBodies(rows IRows, cols []ICol, max uint64) ([]B, error) ScanBodiesFast(rows IRows, cols []ICol, max uint64) ([]B, error) ScanBody(row IRow, cols []ICol) (*B, error) ScanRaw(rows IRows, colValTpl []func() (any, func(*any) any), max uint64) (*RowsWithCols, error) ScanStructs(rows IRows, s any) error ToAnyScanner() IModelScanner[any] }
type IQuery ¶
type IQuery interface { preformShare.IQueryFactory CodeName() string TableName() string Alias() string SetAlias(alias string) IQuery Db() *db BodyType() reflect.Type Prepare(s ...ISchema) Columns() []ICol ColumnsByName() map[string]ICol NewBodyPtr() any NewBody() any // contains filtered or unexported methods }
type IRelation ¶
type IRelation interface { InitRelation(localAndForeignKeyPairs ...IColFromFactory) IRelation ExtraCond(cond ICond) IRelation TargetFactory() IFactory LocalFactory() IFactory LocalKeys() []IColFromFactory ForeignKeys() []IColFromFactory Index() uint32 Eager(IRelation) IEagerLoader Columns(...any) IEagerLoader Where(...ICond) IEagerLoader Limit(uint32) IEagerLoader Offset(uint32) IEagerLoader OrderBy(any) IEagerLoader Name() string JoinClause() ForeignKeyJoin IsMiddleTable() bool // contains filtered or unexported methods }
type ISchema ¶
type ISchema interface { Name() string Clone(name string, db ...*sql.DB) ISchema Factories() []IFactory FactoriesByName() map[string]IFactory Init(schemaName string, instance any, db *sql.DB, queryRunner ...preformShare.QueryRunner) PrepareFactories(schemas []ISchema) Inherit(s ISchema) DbName() string Db() *db SetTracerToDb(tracer ITracer) // contains filtered or unexported methods }
type IStmt ¶
type IStmt interface { Exec(args ...interface{}) (sql.Result, error) Query(args ...interface{}) (IRows, error) QueryRow(args ...interface{}) *sql.Row QueryRowContext(ctx context.Context, args ...interface{}) *sql.Row ExecContext(ctx context.Context, args ...interface{}) (sql.Result, error) QueryContext(ctx context.Context, args ...interface{}) (IRows, error) Close() error }
type ITracer ¶
type ITracer interface { Error(driver, msg string, err error) Trace(ctx context.Context, driver, query, txId string, args ...any) (context.Context, func(err error) func(fetched bool, err error)) TraceExec(ctx context.Context, driver, query, txId string, args ...any) (context.Context, func(res sql.Result, err error)) HealthLoop(ctx context.Context, db DB) SetLv(logLv preformShare.LogLv) }
type IViewFactory ¶
type IViewFactory interface { IFactory IsView() }
type MiddleTable ¶
type MiddleTable[SB iModelRelatedBody, TF IFactory, TB any, MTB any] struct { // contains filtered or unexported fields }
func (MiddleTable) Columns ¶
func (r MiddleTable) Columns(cols ...any) IEagerLoader
func (MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) Eager ¶
func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) Eager(relation IRelation) IEagerLoader
func (*MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) ExtraCond ¶
func (r *MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) ExtraCond(cond ICond) IRelation
func (MiddleTable) ForeignKeys ¶
func (r MiddleTable) ForeignKeys() []IColFromFactory
func (*MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) InitMtRelation ¶
func (r *MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) InitMtRelation(middleTable IFactory, localKeys, localKeyRefs, foreignKey, foreignKeyRefs []IColFromFactory) IRelation
func (*MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) InitRelation ¶
func (r *MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) InitRelation(localAndForeignKeyPairs ...IColFromFactory) IRelation
deprecated use InitMtRelation
func (MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) IsMiddleTable ¶
func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) IsMiddleTable() bool
func (MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) JoinClause ¶
func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) JoinClause() ForeignKeyJoin
func (MiddleTable) Limit ¶
func (r MiddleTable) Limit(limit uint32) IEagerLoader
func (MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) LinkModels ¶
func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) LinkModels(bodies ...MiddleBody) error
func (MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) Load ¶
func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) Load(body SrcBody) error
func (MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) LoadQuery ¶
func (r MiddleTable[SrcBody, TargetFactory, TargetBody, MiddleBody]) LoadQuery(body SrcBody) *SelectQuery[TargetBody]
func (MiddleTable) LocalFactory ¶
func (r MiddleTable) LocalFactory() IFactory
func (MiddleTable) LocalKeys ¶
func (r MiddleTable) LocalKeys() []IColFromFactory
func (MiddleTable) Offset ¶
func (r MiddleTable) Offset(offset uint32) IEagerLoader
func (MiddleTable) OrderBy ¶
func (r MiddleTable) OrderBy(orderBy any) IEagerLoader
func (*MiddleTable) TargetBody ¶
func (r *MiddleTable) TargetBody() TargetBody
func (MiddleTable) TargetFactory ¶
func (r MiddleTable) TargetFactory() IFactory
func (MiddleTable) Where ¶
func (r MiddleTable) Where(conds ...ICond) IEagerLoader
type NoAggregation ¶
type NoAggregation struct{}
type PrebuildQueryCol ¶
type PrebuildQueryCol[T any, A iAggregation] struct { ICol // contains filtered or unexported fields }
func SetPrebuildQueryCol ¶
func SetPrebuildQueryCol[T any, A iAggregation](f iPrebuildQueryFactory, src ICol, c *PrebuildQueryCol[T, A]) *PrebuildQueryCol[T, A]
func (PrebuildQueryCol[T, A]) Factory ¶
func (c PrebuildQueryCol[T, A]) Factory() IFactory
func (PrebuildQueryCol[T, A]) GetCodeWithAlias ¶
func (c PrebuildQueryCol[T, A]) GetCodeWithAlias() string
func (PrebuildQueryCol[T, A]) GetPos ¶
func (c PrebuildQueryCol[T, A]) GetPos() int
func (PrebuildQueryCol[T, A]) QueryFactory ¶
func (c PrebuildQueryCol[T, A]) QueryFactory() IQuery
type PrebuildQueryFactory ¶
type PrebuildQueryFactory[FPtr iPrebuildQueryFactory, B any] struct { Query preformShare.SelectBuilder SrcByAlias map[string]IFactory // contains filtered or unexported fields }
func (PrebuildQueryFactory[FPtr, B]) AddRelation ¶
func (f PrebuildQueryFactory[FPtr, B]) AddRelation(r IRelation) uint32
func (PrebuildQueryFactory[FPtr, B]) Alias ¶
func (f PrebuildQueryFactory[FPtr, B]) Alias() string
func (PrebuildQueryFactory[FPtr, B]) BodyType ¶
func (f PrebuildQueryFactory[FPtr, B]) BodyType() reflect.Type
func (PrebuildQueryFactory[FPtr, B]) CodeName ¶
func (f PrebuildQueryFactory[FPtr, B]) CodeName() string
func (PrebuildQueryFactory[FPtr, B]) Columns ¶
func (f PrebuildQueryFactory[FPtr, B]) Columns() []ICol
func (PrebuildQueryFactory[FPtr, B]) ColumnsByName ¶
func (f PrebuildQueryFactory[FPtr, B]) ColumnsByName() map[string]ICol
func (*PrebuildQueryFactory[FPtr, B]) Db ¶
func (f *PrebuildQueryFactory[FPtr, B]) Db() *db
func (*PrebuildQueryFactory[FPtr, B]) DefineCols ¶
func (f *PrebuildQueryFactory[FPtr, B]) DefineCols(cols ...any) *PrebuildQueryFactory[FPtr, B]
func (*PrebuildQueryFactory[FPtr, B]) GroupBy ¶
func (f *PrebuildQueryFactory[FPtr, B]) GroupBy(group ...any) *PrebuildQueryFactory[FPtr, B]
group by
func (*PrebuildQueryFactory[FPtr, B]) Having ¶
func (f *PrebuildQueryFactory[FPtr, B]) Having(cond any, extra ...any) *PrebuildQueryFactory[FPtr, B]
having
func (*PrebuildQueryFactory[FPtr, B]) Insert ¶
func (f *PrebuildQueryFactory[FPtr, B]) Insert(body any, cfg ...EditConfig) error
deprecated
func (*PrebuildQueryFactory[FPtr, B]) Join ¶
func (f *PrebuildQueryFactory[FPtr, B]) Join(join string, factory IFactory, cond ...ICond) *PrebuildQueryFactory[FPtr, B]
func (PrebuildQueryFactory[FPtr, B]) NewBody ¶
func (f PrebuildQueryFactory[FPtr, B]) NewBody() any
func (PrebuildQueryFactory[FPtr, B]) NewBodyPtr ¶
func (f PrebuildQueryFactory[FPtr, B]) NewBodyPtr() any
func (*PrebuildQueryFactory[FPtr, B]) NewModel ¶
func (f *PrebuildQueryFactory[FPtr, B]) NewModel() B
func (*PrebuildQueryFactory[FPtr, B]) OrderBy ¶
func (f *PrebuildQueryFactory[FPtr, B]) OrderBy(order ...string) *PrebuildQueryFactory[FPtr, B]
order by
func (PrebuildQueryFactory[FPtr, B]) Parent ¶
func (f PrebuildQueryFactory[FPtr, B]) Parent() string
func (PrebuildQueryFactory[FPtr, B]) PkAndValues ¶
func (f PrebuildQueryFactory[FPtr, B]) PkAndValues(body iModelBody) squirrel.Eq
func (PrebuildQueryFactory[FPtr, B]) Pks ¶
func (f PrebuildQueryFactory[FPtr, B]) Pks() []ICol
func (*PrebuildQueryFactory[FPtr, B]) PreSetWhere ¶
func (f *PrebuildQueryFactory[FPtr, B]) PreSetWhere(cond any, extra ...any) *PrebuildQueryFactory[FPtr, B]
func (*PrebuildQueryFactory[FPtr, B]) Prepare ¶
func (f *PrebuildQueryFactory[FPtr, B]) Prepare(schemas ...ISchema)
func (*PrebuildQueryFactory[FPtr, B]) Select ¶
func (f *PrebuildQueryFactory[FPtr, B]) Select(overwrittenCols ...any) *SelectQuery[B]
func (*PrebuildQueryFactory[FPtr, B]) SetAlias ¶
func (f *PrebuildQueryFactory[FPtr, B]) SetAlias(alias string) IQuery
func (*PrebuildQueryFactory[FPtr, B]) SetModelScanner ¶
func (f *PrebuildQueryFactory[FPtr, B]) SetModelScanner(scanner IModelScanner[B])
func (*PrebuildQueryFactory[FPtr, B]) SetSrc ¶
func (f *PrebuildQueryFactory[FPtr, B]) SetSrc(factory IFactory) *PrebuildQueryFactory[FPtr, B]
func (PrebuildQueryFactory[FPtr, B]) TableName ¶
func (f PrebuildQueryFactory[FPtr, B]) TableName() string
func (PrebuildQueryFactory[FPtr, B]) TableNames ¶
func (f PrebuildQueryFactory[FPtr, B]) TableNames() []string
type PrimaryKey ¶
type PrimaryKey[T any] struct { *ForeignKey[T] }
func (PrimaryKey) ContainsBy ¶
func (c PrimaryKey) ContainsBy(arrayCol any) colConditioner
func (PrimaryKey) GetRawPtrScanner ¶
func (PrimaryKey) NoParentCode ¶
func (c PrimaryKey) NoParentCode() colConditioner
type RowsWithCols ¶
type RowsWithCols struct { Columns []string Rows [][]any // contains filtered or unexported fields }
func (RowsWithCols) ToMap ¶
func (b RowsWithCols) ToMap() []map[string]any
type RowsWithTrace ¶
func (*RowsWithTrace) Close ¶
func (r *RowsWithTrace) Close() error
func (RowsWithTrace) Next ¶
func (r RowsWithTrace) Next() bool
type Schema ¶
type Schema[TPtr ISchema, T any] struct { DB SchemaName string // contains filtered or unexported fields }
func (Schema[TPtr, T]) FactoriesByBodyType ¶
func (Schema[TPtr, T]) FactoriesByName ¶
func (*Schema[TPtr, T]) Init ¶
func (s *Schema[TPtr, T]) Init(schemaName string, instance any, conn *sql.DB, queryRunner ...preformShare.QueryRunner)
func (*Schema[TPtr, T]) PrepareFactories ¶
func (*Schema[TPtr, T]) SetConn ¶
func (s *Schema[TPtr, T]) SetConn(conn *sql.DB, queryRunner ...preformShare.QueryRunner)
func (*Schema[TPtr, T]) SetTracerToDb ¶
type SelectQuery ¶
type SelectQuery[B any] struct { Cols []ICol ColValTpl []func() (vv any, toScanner func(*any) any) // contains filtered or unexported fields }
func SelectByFactory ¶
func SelectByFactory[B any](f IQuery, modelScanner IModelScanner[B], cols ...any) *SelectQuery[B]
func (*SelectQuery[B]) AsSubQuery ¶
func (b *SelectQuery[B]) AsSubQuery(alias string) squirrel.Sqlizer
func (*SelectQuery[B]) Column ¶
func (b *SelectQuery[B]) Column(column interface{}, args ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) Columns ¶
func (b *SelectQuery[B]) Columns(cols ...any) *SelectQuery[B]
func (*SelectQuery[B]) CrossJoin ¶
func (b *SelectQuery[B]) CrossJoin(join string, rest ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) CrossJoinForeignKey ¶
func (b *SelectQuery[B]) CrossJoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
func (*SelectQuery[B]) CrossRelation ¶
func (b *SelectQuery[B]) CrossRelation(rel IRelation) *SelectQuery[B]
func (*SelectQuery[B]) Ctx ¶
func (b *SelectQuery[B]) Ctx(ctx context.Context) *SelectQuery[B]
func (*SelectQuery[B]) Distinct ¶
func (b *SelectQuery[B]) Distinct() *SelectQuery[B]
func (*SelectQuery[B]) Eager ¶
func (b *SelectQuery[B]) Eager(relation ...IRelation) *SelectQuery[B]
func (*SelectQuery[B]) From ¶
func (b *SelectQuery[B]) From(from any) *SelectQuery[B]
func (*SelectQuery[B]) FromSelect ¶
func (b *SelectQuery[B]) FromSelect(from preformShare.SelectBuilder, alias string) *SelectQuery[B]
func (*SelectQuery[B]) FromSubQuery ¶
func (b *SelectQuery[B]) FromSubQuery(from *subQueryCol, alias string) *SelectQuery[B]
func (SelectQuery[B]) GetAll ¶
func (b SelectQuery[B]) GetAll(cond ...ICond) ([]B, error)
func (SelectQuery[B]) GetAllFast ¶
func (b SelectQuery[B]) GetAllFast(cond ...ICond) ([]B, error)
func (SelectQuery[B]) GetOne ¶
func (b SelectQuery[B]) GetOne(pkLookup ...any) (*B, error)
func (*SelectQuery[B]) GroupBy ¶
func (b *SelectQuery[B]) GroupBy(groupBys ...any) *SelectQuery[B]
func (*SelectQuery[B]) Having ¶
func (b *SelectQuery[B]) Having(pred interface{}, rest ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) InnerJoin ¶
func (b *SelectQuery[B]) InnerJoin(join string, rest ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) InnerJoinForeignKey ¶
func (b *SelectQuery[B]) InnerJoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
func (*SelectQuery[B]) InnerRelation ¶
func (b *SelectQuery[B]) InnerRelation(rel IRelation) *SelectQuery[B]
func (*SelectQuery[B]) Join ¶
func (b *SelectQuery[B]) Join(join string, rest ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) JoinClause ¶
func (b *SelectQuery[B]) JoinClause(pred interface{}, args ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) JoinForeignKey ¶
func (b *SelectQuery[B]) JoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
func (*SelectQuery[B]) JoinRelation ¶
func (b *SelectQuery[B]) JoinRelation(rel IRelation) *SelectQuery[B]
func (*SelectQuery[B]) LeftJoin ¶
func (b *SelectQuery[B]) LeftJoin(join string, rest ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) LeftJoinForeignKey ¶
func (b *SelectQuery[B]) LeftJoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
func (*SelectQuery[B]) LeftRelation ¶
func (b *SelectQuery[B]) LeftRelation(rel IRelation) *SelectQuery[B]
func (*SelectQuery[B]) Limit ¶
func (b *SelectQuery[B]) Limit(limit uint64) *SelectQuery[B]
func (SelectQuery[B]) MustSql ¶
func (b SelectQuery[B]) MustSql() (string, []interface{})
func (*SelectQuery[B]) Offset ¶
func (b *SelectQuery[B]) Offset(offset uint64) *SelectQuery[B]
func (*SelectQuery[B]) Options ¶
func (b *SelectQuery[B]) Options(options ...string) *SelectQuery[B]
func (*SelectQuery[B]) OrderBy ¶
func (b *SelectQuery[B]) OrderBy(orderBys ...string) *SelectQuery[B]
func (*SelectQuery[B]) OrderByClause ¶
func (b *SelectQuery[B]) OrderByClause(pred interface{}, args ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) PlaceholderFormat ¶
func (b *SelectQuery[B]) PlaceholderFormat(f squirrel.PlaceholderFormat) *SelectQuery[B]
func (*SelectQuery[B]) Prefix ¶
func (b *SelectQuery[B]) Prefix(sql string, args ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) PrefixExpr ¶
func (b *SelectQuery[B]) PrefixExpr(expr ICond) *SelectQuery[B]
func (*SelectQuery[B]) Prepare ¶
func (b *SelectQuery[B]) Prepare() (*SelectQuery[B], error)
func (SelectQuery[B]) QueryAnys ¶
func (b SelectQuery[B]) QueryAnys() ([]any, error)
func (SelectQuery[B]) QueryBodies ¶
func (b SelectQuery[B]) QueryBodies() ([]B, error)
func (SelectQuery[B]) QueryBodiesFast ¶
func (b SelectQuery[B]) QueryBodiesFast() ([]B, error)
func (SelectQuery[B]) QueryBody ¶
func (b SelectQuery[B]) QueryBody() (*B, error)
func (SelectQuery[B]) QueryRaw ¶
func (b SelectQuery[B]) QueryRaw() (*RowsWithCols, error)
func (SelectQuery[B]) QueryRow ¶
func (b SelectQuery[B]) QueryRow() *sqlRow
func (SelectQuery[B]) QueryRowx ¶
func (b SelectQuery[B]) QueryRowx() *sqlRow
func (SelectQuery[B]) QueryStructs ¶
func (b SelectQuery[B]) QueryStructs(s any) error
func (*SelectQuery[B]) QuoteIdentifier ¶
func (b *SelectQuery[B]) QuoteIdentifier(id string) string
func (*SelectQuery[B]) RemoveColumns ¶
func (b *SelectQuery[B]) RemoveColumns() *SelectQuery[B]
func (*SelectQuery[B]) RemoveLimit ¶
func (b *SelectQuery[B]) RemoveLimit() *SelectQuery[B]
func (*SelectQuery[B]) RemoveOffset ¶
func (b *SelectQuery[B]) RemoveOffset() *SelectQuery[B]
func (*SelectQuery[B]) RightJoin ¶
func (b *SelectQuery[B]) RightJoin(join string, rest ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) RightJoinForeignKey ¶
func (b *SelectQuery[B]) RightJoinForeignKey(joinKey iForeignKeyJoin) *SelectQuery[B]
func (*SelectQuery[B]) RightRelation ¶
func (b *SelectQuery[B]) RightRelation(rel IRelation) *SelectQuery[B]
func (*SelectQuery[B]) Suffix ¶
func (b *SelectQuery[B]) Suffix(sql string, args ...interface{}) *SelectQuery[B]
func (*SelectQuery[B]) SuffixExpr ¶
func (b *SelectQuery[B]) SuffixExpr(expr squirrel.Sqlizer) *SelectQuery[B]
func (SelectQuery[B]) ToSql ¶
func (b SelectQuery[B]) ToSql() (string, []interface{}, error)
func (*SelectQuery[B]) Where ¶
func (b *SelectQuery[B]) Where(pred interface{}, args ...interface{}) *SelectQuery[B]
type StmtWithTrace ¶
func (*StmtWithTrace) Exec ¶
func (s *StmtWithTrace) Exec(args ...interface{}) (res sql.Result, err error)
func (*StmtWithTrace) ExecContext ¶
func (*StmtWithTrace) Query ¶
func (s *StmtWithTrace) Query(args ...interface{}) (rows IRows, err error)
func (*StmtWithTrace) QueryContext ¶
func (s *StmtWithTrace) QueryContext(ctx context.Context, args ...interface{}) (rows IRows, err error)
func (*StmtWithTrace) QueryRow ¶
func (s *StmtWithTrace) QueryRow(args ...interface{}) (row *sql.Row)
func (*StmtWithTrace) QueryRowContext ¶
func (s *StmtWithTrace) QueryRowContext(ctx context.Context, args ...interface{}) (row *sql.Row)
type ToMany ¶
type ToMany[SB iModelRelatedBody, TF IFactory, TB any] struct { // contains filtered or unexported fields }
func (ToMany) Columns ¶
func (r ToMany) Columns(cols ...any) IEagerLoader
func (*ToMany) Eager ¶
func (r *ToMany) Eager(relation IRelation) IEagerLoader
func (ToMany) ForeignKeys ¶
func (r ToMany) ForeignKeys() []IColFromFactory
func (*ToMany[SrcBody, TargetFactory, TargetBody]) InitRelation ¶
func (r *ToMany[SrcBody, TargetFactory, TargetBody]) InitRelation(localAndForeignKeyPairs ...IColFromFactory) IRelation
func (ToMany) IsMiddleTable ¶
func (r ToMany) IsMiddleTable() bool
func (ToMany) JoinClause ¶
func (r ToMany) JoinClause() ForeignKeyJoin
func (ToMany) Limit ¶
func (r ToMany) Limit(limit uint32) IEagerLoader
func (ToMany) LoadQuery ¶
func (r ToMany) LoadQuery(body SrcBody) *SelectQuery[TargetBody]
func (ToMany) LocalFactory ¶
func (r ToMany) LocalFactory() IFactory
func (ToMany) LocalKeys ¶
func (r ToMany) LocalKeys() []IColFromFactory
func (ToMany) Offset ¶
func (r ToMany) Offset(offset uint32) IEagerLoader
func (ToMany) OrderBy ¶
func (r ToMany) OrderBy(orderBy any) IEagerLoader
func (*ToMany) TargetBody ¶
func (r *ToMany) TargetBody() TargetBody
func (ToMany) TargetFactory ¶
func (r ToMany) TargetFactory() IFactory
func (ToMany) Where ¶
func (r ToMany) Where(conds ...ICond) IEagerLoader
type ToOne ¶
type ToOne[SB iModelRelatedBody, TF IFactory, TB any] struct { // contains filtered or unexported fields }
func (ToOne) Columns ¶
func (r ToOne) Columns(cols ...any) IEagerLoader
func (*ToOne) Eager ¶
func (r *ToOne) Eager(relation IRelation) IEagerLoader
func (ToOne) ForeignKeys ¶
func (r ToOne) ForeignKeys() []IColFromFactory
func (*ToOne[SrcBody, TargetFactory, TargetBody]) InitRelation ¶
func (r *ToOne[SrcBody, TargetFactory, TargetBody]) InitRelation(localAndForeignKeyPairs ...IColFromFactory) IRelation
func (ToOne) IsMiddleTable ¶
func (r ToOne) IsMiddleTable() bool
func (ToOne) JoinClause ¶
func (r ToOne) JoinClause() ForeignKeyJoin
func (ToOne) Limit ¶
func (r ToOne) Limit(limit uint32) IEagerLoader
func (ToOne) LoadQuery ¶
func (r ToOne) LoadQuery(body SrcBody) *SelectQuery[TargetBody]
func (ToOne) LocalFactory ¶
func (r ToOne) LocalFactory() IFactory
func (ToOne) LocalKeys ¶
func (r ToOne) LocalKeys() []IColFromFactory
func (ToOne) Offset ¶
func (r ToOne) Offset(offset uint32) IEagerLoader
func (ToOne) OrderBy ¶
func (r ToOne) OrderBy(orderBy any) IEagerLoader
func (*ToOne) TargetBody ¶
func (r *ToOne) TargetBody() TargetBody
func (ToOne) TargetFactory ¶
func (r ToOne) TargetFactory() IFactory
func (ToOne) Where ¶
func (r ToOne) Where(conds ...ICond) IEagerLoader
type Tx ¶
type Tx struct { preformShare.QueryRunner // contains filtered or unexported fields }
func (*Tx) GetDialect ¶
func (t *Tx) GetDialect() preformShare.IDialect
func (*Tx) PrepareTrace ¶
func (*Tx) QueryTraceScan ¶
type UpdateBuilder ¶
type UpdateBuilder[B any] struct { Builder preformShare.UpdateBuilder // contains filtered or unexported fields }
func (UpdateBuilder[B]) Columns ¶
func (b UpdateBuilder[B]) Columns(cols ...ICol) UpdateBuilder[B]
func (UpdateBuilder[B]) Ctx ¶
func (b UpdateBuilder[B]) Ctx(ctx context.Context) UpdateBuilder[B]
func (UpdateBuilder[B]) Exec ¶
func (b UpdateBuilder[B]) Exec(tx ...preformShare.QueryRunner) (int64, error)
func (UpdateBuilder[B]) LimitOffset ¶
func (b UpdateBuilder[B]) LimitOffset(limit, offset uint64) UpdateBuilder[B]
func (UpdateBuilder[B]) Set ¶
func (b UpdateBuilder[B]) Set(col any, value any) UpdateBuilder[B]
func (UpdateBuilder[B]) SetBodies ¶
func (b UpdateBuilder[B]) SetBodies(body ...*B) UpdateBuilder[B]
func (UpdateBuilder[B]) SetMap ¶
func (b UpdateBuilder[B]) SetMap(clause map[string]any) UpdateBuilder[B]
func (UpdateBuilder[B]) Where ¶
func (b UpdateBuilder[B]) Where(cond ICond) UpdateBuilder[B]
type UpdateConfig ¶
type ViewFactory ¶
func (ViewFactory[FPtr, B]) Clone ¶
func (f ViewFactory[FPtr, B]) Clone() IFactory
func (ViewFactory) CloneInstance ¶
func (*ViewFactory[FPtr, B]) DeleteByPk ¶
func (f *ViewFactory[FPtr, B]) DeleteByPk(body any, cfg ...EditConfig) (int64, error)
func (ViewFactory) FieldsByNameNotSafeForClone ¶
func (f ViewFactory) FieldsByNameNotSafeForClone() map[string]preformShare.IField
func (*ViewFactory[FPtr, B]) Insert ¶
func (f *ViewFactory[FPtr, B]) Insert(body any, cfg ...EditConfig) error
func (ViewFactory[FPtr, B]) IsView ¶
func (f ViewFactory[FPtr, B]) IsView()
func (ViewFactory) NewBodyPtr ¶
func (f ViewFactory) NewBodyPtr() any
func (ViewFactory) PkCondByBody ¶
func (ViewFactory) PkCondByValues ¶
func (ViewFactory[FPtr, B]) SetAlias ¶
func (f ViewFactory[FPtr, B]) SetAlias(alias string) IQuery
func (ViewFactory) SetModelScanner ¶
func (f ViewFactory) SetModelScanner(scanner IModelScanner[B])
func (*ViewFactory[FPtr, B]) SetSchema ¶
func (f *ViewFactory[FPtr, B]) SetSchema(schema ISchema) IFactory
func (*ViewFactory[FPtr, B]) SetTableName ¶
func (f *ViewFactory[FPtr, B]) SetTableName(name string) *ViewFactory[FPtr, B]
func (*ViewFactory[FPtr, B]) UpdateByPk ¶
func (f *ViewFactory[FPtr, B]) UpdateByPk(body any, cfg ...UpdateConfig) (int64, error)
Source Files ¶
- body.go
- colConditioner.go
- column.go
- columnAggregate.go
- columnFk.go
- columnPk.go
- columnWrap.go
- db.go
- dbTracer.go
- dbTx.go
- dbWithTracer.go
- dbWrapper.go
- factory.go
- factoryDelete.go
- factoryInsert.go
- factoryUpdate.go
- factoryView.go
- factoryWrap.go
- prebuildQuery.go
- prebuildQueryCol.go
- relation.go
- relationMiddleTable.go
- schema.go
- select.go
- selectEager.go
- selectEagerJoinner.go
- selectModelScanner.go
- selectQuery.go
- util.go
Click to show internal directories.
Click to hide internal directories.