Documentation ¶
Index ¶
- func ALL[T Table](ctx context.Context, options ...QueryOption) (entries []T, err error)
- func Asc(name string) orders.Orders
- func Begin(ctx context.Context, options ...databases.TransactionOption) (err error)
- func Between(field string, left any, right any) conditions.Condition
- func Bool(b bool) conditions.Literal
- func Commit(ctx context.Context) (err error)
- func Count[T Table](ctx context.Context, cond conditions.Condition) (count int64, err error)
- func Delete[T Table](ctx context.Context, entry T) (v T, ok bool, err error)
- func DeleteByCondition[T Table](ctx context.Context, cond conditions.Condition) (affected int64, err error)
- func Desc(name string) orders.Orders
- func Dialect(ctx context.Context) (dialect string, err error)
- func Disuse(ctx context.Context) context.Context
- func Eq(field string, expression any) conditions.Condition
- func Exist[T Table](ctx context.Context, cond conditions.Condition) (has bool, err error)
- func Float(f float32) conditions.Literal
- func Float64(f float64) conditions.Literal
- func ForceDialect(ctx context.Context, dialect string) context.Context
- 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 Insert[T Table](ctx context.Context, entry T) (v T, ok bool, err error)
- func InsertMulti[T Table](ctx context.Context, entries []T) (affected int64, err error)
- func InsertOrUpdate[T Table](ctx context.Context, entry T) (v T, ok bool, err error)
- func InsertWhenExist[T Table](ctx context.Context, entry T, source conditions.QueryExpr) (v T, ok bool, err error)
- func InsertWhenNotExist[T Table](ctx context.Context, entry T, source conditions.QueryExpr) (v T, ok bool, err error)
- func Int(n int) conditions.Literal
- func Int64(n int64) conditions.Literal
- func Like(field string, expression string) conditions.Condition
- 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 NotEq(field string, expression any) conditions.Condition
- func NotIn(field string, expression ...any) conditions.Condition
- func One[T Table](ctx context.Context, options ...QueryOption) (entry T, has bool, err error)
- func Query[T Table](ctx context.Context, offset int, length int, options ...QueryOption) (entries []T, 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 Update[T Table](ctx context.Context, entry T) (v T, ok bool, err error)
- func UpdateFields[T Table](ctx context.Context, fields FieldValues, cond conditions.Condition) (affected int64, 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)
- type Audit
- type AuditCreation
- type AuditDeletion
- type AuditModification
- type AuditVersion
- type AuditWithoutDeletion
- type AuditWithoutModificationAndDeletion
- type FieldValues
- type IncrPkAudit
- type IncrPkAuditWithoutDeletion
- type IncrPkAuditWithoutModificationAndDeletion
- type Pager
- type QueryOption
- type QueryOptions
- type SID
- type Table
- type TableInfo
- type TableInfoOption
- type TableInfoOptions
- type UID
- type View
- type ViewInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
func Bool(b bool) conditions.Literal
func DeleteByCondition ¶
func Float ¶
func Float(f float32) conditions.Literal
func Float64 ¶
func Float64(f float64) conditions.Literal
func InsertMulti ¶
func InsertOrUpdate ¶
func InsertWhenExist ¶
func InsertWhenNotExist ¶
func Int ¶
func Int(n int) conditions.Literal
func Int64 ¶
func Int64(n int64) conditions.Literal
func LikeContains ¶
func LikeContains(field string, expression string) conditions.Condition
func Lit ¶
func Lit(v string) conditions.Literal
func LitSubQuery ¶
func LitSubQuery(query string) conditions.QueryExpr
func String ¶
func String(s string) conditions.Literal
func SubQuery ¶
func SubQuery(query any, field string, cond conditions.Condition) conditions.QueryExpr
func Trees ¶
func Trees[T Table](ctx context.Context, options ...QueryOption) (entries []T, err error)
func UpdateFields ¶
func UpdateFields[T Table](ctx context.Context, fields FieldValues, cond conditions.Condition) (affected int64, err error)
func ViewALL ¶
func ViewALL[V View](ctx context.Context, options ...QueryOption) (entries []V, err error)
Types ¶
type Audit ¶
type Audit struct { UID AuditCreation[string] AuditModification[string] AuditDeletion[string] AuditVersion }
func (Audit) WithCreation ¶
func (Audit) WithDeletion ¶
func (Audit) WithModification ¶
type AuditCreation ¶
type AuditCreation[Id ~string | ~int64] struct { CreateBY Id `column:"CREATE_BY,ACB" json:"createBY"` CreateAT time.Time `column:"CREATE_AT,ACT" json:"createAT"` }
func NewAuditCreation ¶
func NewAuditCreation[Id ~string | ~int64](id Id) AuditCreation[Id]
type AuditDeletion ¶
type AuditDeletion[Id ~string | ~int64] struct { DeleteBY Id `column:"DELETE_BY,ADB" json:"deleteBY"` DeleteAT time.Time `column:"DELETE_AT,ADT" json:"deleteAT"` }
func NewAuditDeletion ¶
func NewAuditDeletion[Id ~string | ~int64](id Id) AuditDeletion[Id]
type AuditModification ¶
type AuditModification[Id ~string | ~int64] struct { ModifyBY Id `column:"MODIFY_BY,AMB" json:"modifyBY"` ModifyAT time.Time `column:"MODIFY_AT,AMT" json:"modifyAT"` }
func NewAuditModification ¶
func NewAuditModification[Id ~string | ~int64](id Id) AuditModification[Id]
type AuditVersion ¶
type AuditVersion struct {
Version int64 `column:"VERSION,AOL" json:"version"`
}
type AuditWithoutDeletion ¶
type AuditWithoutDeletion struct { UID AuditCreation[string] AuditModification[string] AuditVersion }
func NewAuditWithoutDeletion ¶
func NewAuditWithoutDeletion(id string) AuditWithoutDeletion
func (AuditWithoutDeletion) WithCreation ¶
func (audit AuditWithoutDeletion) WithCreation(id string) AuditWithoutDeletion
func (AuditWithoutDeletion) WithModification ¶
func (audit AuditWithoutDeletion) WithModification(id string) AuditWithoutDeletion
type AuditWithoutModificationAndDeletion ¶
type AuditWithoutModificationAndDeletion struct { UID AuditCreation[string] }
func NewAuditWithoutModificationAndDeletion ¶
func NewAuditWithoutModificationAndDeletion(id string) AuditWithoutModificationAndDeletion
func (AuditWithoutModificationAndDeletion) WithCreation ¶
func (audit AuditWithoutModificationAndDeletion) WithCreation(id string) AuditWithoutModificationAndDeletion
type FieldValues ¶
type FieldValues []specifications.FieldValue
func Field ¶
func Field(name string, value any) FieldValues
func (FieldValues) Field ¶
func (fields FieldValues) Field(name string, value any) FieldValues
type IncrPkAudit ¶
type IncrPkAudit struct { SID AuditCreation[int64] AuditModification[int64] AuditDeletion[int64] AuditVersion }
func NewAuditWithIncrPk ¶
func NewAuditWithIncrPk(id int64) IncrPkAudit
func (IncrPkAudit) WithCreation ¶
func (audit IncrPkAudit) WithCreation(id int64) IncrPkAudit
func (IncrPkAudit) WithDeletion ¶
func (audit IncrPkAudit) WithDeletion(id int64) IncrPkAudit
func (IncrPkAudit) WithModification ¶
func (audit IncrPkAudit) WithModification(id int64) IncrPkAudit
type IncrPkAuditWithoutDeletion ¶
type IncrPkAuditWithoutDeletion struct { SID AuditCreation[int64] AuditModification[int64] AuditVersion }
func NewIncrPkAuditWithoutDeletion ¶
func NewIncrPkAuditWithoutDeletion(id int64) IncrPkAuditWithoutDeletion
func (IncrPkAuditWithoutDeletion) WithCreation ¶
func (audit IncrPkAuditWithoutDeletion) WithCreation(id int64) IncrPkAuditWithoutDeletion
func (IncrPkAuditWithoutDeletion) WithModification ¶
func (audit IncrPkAuditWithoutDeletion) WithModification(id int64) IncrPkAuditWithoutDeletion
type IncrPkAuditWithoutModificationAndDeletion ¶
type IncrPkAuditWithoutModificationAndDeletion struct { SID AuditCreation[int64] }
func NewIncrPkAuditWithoutModificationAndDeletion ¶
func NewIncrPkAuditWithoutModificationAndDeletion(id int64) IncrPkAuditWithoutModificationAndDeletion
func (IncrPkAuditWithoutModificationAndDeletion) WithCreation ¶
func (audit IncrPkAuditWithoutModificationAndDeletion) WithCreation(id int64) IncrPkAuditWithoutModificationAndDeletion
type Pager ¶
type Pager[T Table] struct { // No // @title no // @description no of page No int `json:"no"` // Pages // @title pages // @description total pages Pages int64 `json:"pages"` // Total // @title total // @description total entries Total int64 `json:"total"` // Entries // @title entries // @description entries of page Entries []T `json:"entries"` }
type QueryOption ¶
type QueryOption func(options *QueryOptions)
func Conditions ¶
func Conditions(cond conditions.Condition) QueryOption
func GroupBy ¶
func GroupBy(by groups.GroupBy) QueryOption
func Orders ¶
func Orders(orders orders.Orders) QueryOption
type QueryOptions ¶
type QueryOptions struct {
// contains filtered or unexported fields
}
type Table ¶
type Table interface {
TableInfo() TableInfo
}
Table the recv of TableInfo method must be value, can not be ptr
type TableInfo ¶
type TableInfo struct {
// contains filtered or unexported fields
}
func Info ¶
func Info(name string, options ...TableInfoOption) TableInfo
type TableInfoOption ¶
type TableInfoOption func(options *TableInfoOptions)
func Conflicts ¶
func Conflicts(conflicts ...string) TableInfoOption
Conflicts params are field not column
func Schema ¶
func Schema(schema string) TableInfoOption
type TableInfoOptions ¶
type TableInfoOptions struct {
// contains filtered or unexported fields
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.