Versions in this module Expand all Collapse all v1 v1.2.84 Jan 17, 2024 v1.2.50 Jan 12, 2024 v1.2.11 Dec 19, 2023 Changes in this version + func WithTLS(fn RegisterTLSFunc) sql.Option + type RegisterTLSFunc func(config *tls.Config) (err error) v1.2.3 Dec 17, 2023 v1.2.1 Dec 17, 2023 Changes in this version + func ALL[T Table](ctx context.Context, options ...QueryOption) (entries []T, err error) + func Begin(ctx context.Context, options ...databases.TransactionOption) (err error) + func Bool(b bool) conditions.Literal + func Commit(ctx context.Context) (err error) + func DeleteByCondition[T Table](ctx context.Context, cond conditions.Condition) (affected int64, err error) + func Disuse(ctx context.Context) context.Context + func FAG() []modules.FnAnnotationCodeWriter + func Float(f float32) conditions.Literal + func Float64(f float64) conditions.Literal + func Gt(field string, expression any) conditions.Condition + func Gte(field string, expression any) conditions.Condition + func In(field string, expression ...any) conditions.Condition + func InsertMulti[T Table](ctx context.Context, entries []T) (affected int64, err error) + func Int(n int) conditions.Literal + func Int64(n int64) conditions.Literal + func LikeContains(field string, expression string) conditions.Condition + func LikeLast(field string, expression string) conditions.Condition + func Lit(v string) conditions.Literal + func LitSubQuery(query string) conditions.QueryExpr + func Lt(field string, expression any) conditions.Condition + func Lte(field string, expression any) conditions.Condition + func Named(name string, value any) sql.NamedArg + func New(options ...sql.Option) services.Service + func One[T Table](ctx context.Context, options ...QueryOption) (entry T, has bool, err error) + func Rollback(ctx context.Context) + func String(s string) conditions.Literal + func SubQuery(query any, field string, cond conditions.Condition) conditions.QueryExpr + func Time(t time.Time) conditions.Literal + func Tree[T Table](ctx context.Context, options ...QueryOption) (entry T, err error) + func Trees[T Table](ctx context.Context, options ...QueryOption) (entries []T, err error) + func UpdateFields[T Table](ctx context.Context, fields FieldValues, cond conditions.Condition) (affected int64, err error) + func Update[T Table](ctx context.Context, entry T) (v T, ok bool, err error) + func Use(ctx context.Context, endpointName []byte) context.Context + func ViewALL[V View](ctx context.Context, options ...QueryOption) (entries []V, err error) + func ViewOne[V View](ctx context.Context, options ...QueryOption) (entry V, has bool, err error) + func Views[V View](ctx context.Context, offset int, length int, options ...QueryOption) (entries []V, err error) + func WithDatabase(db databases.Database) sql.Option + func WithName(name string) sql.Option + type FieldValues dac.FieldValues + func Field(name string, value any) FieldValues + func (fields FieldValues) Field(name string, value any) FieldValues + type QueryOption dac.QueryOption + func GroupBy(by groups.GroupBy) QueryOption + type QueryOptions struct + type View interface v0 v0.12.5 Jul 6, 2022 v0.12.4 Jul 5, 2022 v0.12.3 Jul 2, 2022 v0.12.2 Jul 2, 2022 v0.12.1 Jun 22, 2022 Changes in this version + func BeginTransaction(ctx context.Context) (err errors.CodeError) + func CommitTransaction(ctx context.Context) (err errors.CodeError) + func Count(ctx context.Context, cond *Conditions, table Table) (v int, err errors.CodeError) + func Delete(ctx context.Context, row interface{}) (err errors.CodeError) + func ExecuteContext(ctx context.Context, query string, args ...interface{}) (affected int64, lastInsertId int64, err errors.CodeError) + func Exist(ctx context.Context, cond *Conditions, table Table) (has bool, err errors.CodeError) + func Insert(ctx context.Context, row interface{}) (err errors.CodeError) + func InsertOrUpdate(ctx context.Context, row interface{}) (err errors.CodeError) + func InsertWhenExist(ctx context.Context, row interface{}, source Select) (err errors.CodeError) + func InsertWhenNotExist(ctx context.Context, row interface{}, source Select) (err errors.CodeError) + func LitValue(v string) *lit + func Modify(ctx context.Context, row interface{}) (err errors.CodeError) + func Query(ctx context.Context, cond *Conditions, rows interface{}) (fetched bool, err errors.CodeError) + func QueryDirect(ctx context.Context, rows interface{}, query string, args ...interface{}) (fetched bool, err error) + func QueryOne(ctx context.Context, cond *Conditions, row interface{}) (fetched bool, err errors.CodeError) + func QueryWithRange(ctx context.Context, cond *Conditions, orders *Orders, rng *Range, ...) (fetched bool, err errors.CodeError) + func RollbackTransaction(ctx context.Context) (err errors.CodeError) + type Condition struct + Column string + Operation string + Values []interface{} + func Between(column string, left interface{}, right interface{}) *Condition + func Eq(column string, value interface{}) *Condition + func GT(column string, value interface{}) *Condition + func GTE(column string, value interface{}) *Condition + func IN(column string, value interface{}) *Condition + func LT(column string, value interface{}) *Condition + func LTE(column string, value interface{}) *Condition + func Like(column string, value string) *Condition + func LikeLeft(column string, value string) *Condition + func LikeRight(column string, value string) *Condition + func NotDeleted(deletedByColumnName string) *Condition + func NotEq(column string, value interface{}) *Condition + func NotIn(column string, value interface{}) *Condition + type Conditions struct + func NewConditions(cond *Condition) *Conditions + func (c *Conditions) And(v *Condition) *Conditions + func (c *Conditions) AndConditions(v *Conditions) *Conditions + func (c *Conditions) Or(v *Condition) *Conditions + func (c *Conditions) OrConditions(v *Conditions) *Conditions + func (c *Conditions) QueryAndArguments() (query string, args []interface{}) + type LoadMakeupHook interface + Makeup func(ctx context.Context) (err errors.CodeError) + type Order struct + Column string + Desc bool + func Asc(column string) *Order + func Desc(column string) *Order + type Orders struct + func NewOrders() *Orders + func (o *Orders) Asc(column string) *Orders + func (o *Orders) Desc(column string) *Orders + type PageInfo struct + No int + Num int + Total int + func Page(ctx context.Context, cond *Conditions, orders *Orders, pageNo int, ...) (page *PageInfo, err errors.CodeError) + func (p *PageInfo) Empty() bool + type Range struct + Limit int + Offset int + func NewRange(offset int, limit int) *Range + type Row struct + func (row *Row) Column(name string, value interface{}) (has bool, err error) + func (row *Row) Empty() (ok bool) + func (row *Row) Scan(ctx context.Context, v interface{}) (err error) + type Rows struct + func QueryContext(ctx context.Context, query string, args ...interface{}) (rows *Rows, err errors.CodeError) + func (rows *Rows) Empty() (ok bool) + func (rows *Rows) Next() (v *Row, has bool) + func (rows *Rows) Scan(ctx context.Context, v interface{}) (err error) + func (rows *Rows) Size() int + type Select interface + Build func(args []interface{}) (query string) + func LitSelect(query string) Select + type Table interface + TableName func() (schema string, table string)