Documentation
¶
Index ¶
- Constants
- Variables
- func CT_GetObject[T attrs.Definer](identifier any) (interface{}, error)
- func CT_ListObjects[T attrs.Definer](amount, offset uint) ([]interface{}, error)
- func CT_ListObjectsByIDs[T attrs.Definer](i []interface{}) ([]interface{}, error)
- func CountObjects[T attrs.Definer](obj T) (int64, error)
- func CreateObject[T attrs.Definer](obj T) error
- func DeleteObject[T attrs.Definer](obj T) error
- func GetObject[T attrs.Definer](identifier any) (T, error)
- func ListObjects[T attrs.Definer](offset, limit uint64, ordering ...string) ([]T, error)
- func ListObjectsByIDs[T attrs.Definer, T2 any](offset, limit uint64, ids []T2) ([]T, error)
- func RegisterDriver(driver driver.Driver, database string)
- func SaveObject[T attrs.Definer](obj T) error
- func UpdateObject[T attrs.Definer](obj T) error
- type CountQuery
- type ExistsQuery
- type ExprGroup
- func (g *ExprGroup) And(exprs ...Expression) Expression
- func (g *ExprGroup) Args() []any
- func (g *ExprGroup) Clone() Expression
- func (g *ExprGroup) IsNot() bool
- func (g *ExprGroup) Not(not bool) Expression
- func (g *ExprGroup) Or(exprs ...Expression) Expression
- func (g *ExprGroup) SQL(sb *strings.Builder)
- func (g *ExprGroup) With(m attrs.Definer, quote string) Expression
- type ExprNode
- func (e *ExprNode) And(exprs ...Expression) Expression
- func (e *ExprNode) Args() []any
- func (e *ExprNode) Clone() Expression
- func (e *ExprNode) IsNot() bool
- func (e *ExprNode) Not(not bool) Expression
- func (e *ExprNode) Or(exprs ...Expression) Expression
- func (e *ExprNode) SQL(sb *strings.Builder)
- func (e *ExprNode) With(m attrs.Definer, quote string) Expression
- type Expression
- type FieldInfo
- type IterQuery
- type JoinDef
- type LogicalOp
- type OrderBy
- type Query
- type QuerySet
- func (qs *QuerySet[T]) All() Query[[]T, T]
- func (qs *QuerySet[T]) Clone() *QuerySet[T]
- func (qs *QuerySet[T]) Count() CountQuery[T]
- func (qs *QuerySet[T]) Delete() CountQuery[T]
- func (qs *QuerySet[T]) Distinct() *QuerySet[T]
- func (qs *QuerySet[T]) Exists() ExistsQuery[T]
- func (qs *QuerySet[T]) Filter(key interface{}, vals ...interface{}) *QuerySet[T]
- func (qs *QuerySet[T]) First() Query[T, T]
- func (qs *QuerySet[T]) ForUpdate() *QuerySet[T]
- func (qs *QuerySet[T]) GroupBy(fields ...string) *QuerySet[T]
- func (qs *QuerySet[T]) Having(key interface{}, vals ...interface{}) *QuerySet[T]
- func (qs *QuerySet[T]) Last() Query[T, T]
- func (qs *QuerySet[T]) Limit(n int) *QuerySet[T]
- func (qs *QuerySet[T]) Offset(n int) *QuerySet[T]
- func (qs *QuerySet[T]) OrderBy(fields ...string) *QuerySet[T]
- func (qs *QuerySet[T]) Reverse() *QuerySet[T]
- func (qs *QuerySet[T]) Select(fields ...string) *QuerySet[T]
- func (qs *QuerySet[T]) Union(f func(*QuerySet[attrs.Definer])) *QuerySet[T]
- func (qs *QuerySet[T]) Update(value T) CountQuery[T]
- func (qs *QuerySet[T]) ValuesList(fields ...string) ValuesListQuery[T]
- type RawExpr
- func (e *RawExpr) And(exprs ...Expression) Expression
- func (e *RawExpr) Args() []any
- func (e *RawExpr) Clone() Expression
- func (e *RawExpr) IsNot() bool
- func (e *RawExpr) Not(not bool) Expression
- func (e *RawExpr) Or(exprs ...Expression) Expression
- func (e *RawExpr) SQL(sb *strings.Builder)
- func (e *RawExpr) With(m attrs.Definer, quote string) Expression
- type Union
- type ValuesListQuery
Constants ¶
Variables ¶
View Source
var Quote = "`"
Functions ¶
func CT_ListObjects ¶
func CT_ListObjectsByIDs ¶
func CreateObject ¶
func DeleteObject ¶
func ListObjects ¶
func ListObjectsByIDs ¶
func RegisterDriver ¶ added in v1.0.2
RegisterDriver registers a driver with the given database name.
This is used to determine the database type when using sqlx.
If your driver is not one of: - github.com/go-sql-driver/mysql.MySQLDriver - github.com/mattn/go-sqlite3.SQLiteDriver - github.com/jackc/pgx/v5/stdlib.Driver
Then it explicitly needs to be registered here.
func SaveObject ¶
func UpdateObject ¶
Types ¶
type CountQuery ¶ added in v1.0.3
type ExistsQuery ¶ added in v1.0.3
type ExprGroup ¶
type ExprGroup struct {
// contains filtered or unexported fields
}
ExprGroup
func (*ExprGroup) And ¶
func (g *ExprGroup) And(exprs ...Expression) Expression
func (*ExprGroup) Clone ¶
func (g *ExprGroup) Clone() Expression
func (*ExprGroup) Not ¶
func (g *ExprGroup) Not(not bool) Expression
func (*ExprGroup) Or ¶
func (g *ExprGroup) Or(exprs ...Expression) Expression
type ExprNode ¶
type ExprNode struct {
// contains filtered or unexported fields
}
func (*ExprNode) And ¶
func (e *ExprNode) And(exprs ...Expression) Expression
func (*ExprNode) Clone ¶
func (e *ExprNode) Clone() Expression
func (*ExprNode) Not ¶
func (e *ExprNode) Not(not bool) Expression
func (*ExprNode) Or ¶
func (e *ExprNode) Or(exprs ...Expression) Expression
type Expression ¶
type Expression interface { SQL(sb *strings.Builder) Args() []any IsNot() bool Not(b bool) Expression And(...Expression) Expression Or(...Expression) Expression Clone() Expression With(model attrs.Definer, quote string) Expression }
func And ¶
func And(exprs ...Expression) Expression
func Or ¶
func Or(exprs ...Expression) Expression
type QuerySet ¶
func (*QuerySet[T]) ValuesList ¶ added in v1.0.3
type RawExpr ¶ added in v1.0.3
type RawExpr struct { Statement string Fields []string Params []any // contains filtered or unexported fields }
RawExpr is a function expression for SQL queries. It is used to represent a function call in SQL queries.
It can be used like so:
RawExpr{ // Represent the SQL function call, with each %s being replaced by the corresponding field in fields. sql: `SUBSTR(TRIM(%s, " "), 0, 2) = ?``, // The fields to be used in the SQL function call. Each field will be replaced by the corresponding value in args. fields: []string{"myField"}, // The arguments to be used in the SQL function call. Each argument will be replaced by the corresponding value in args. args: []any{"ab"}, }
func (*RawExpr) And ¶ added in v1.0.3
func (e *RawExpr) And(exprs ...Expression) Expression
func (*RawExpr) Clone ¶ added in v1.0.3
func (e *RawExpr) Clone() Expression
func (*RawExpr) Not ¶ added in v1.0.3
func (e *RawExpr) Not(not bool) Expression
func (*RawExpr) Or ¶ added in v1.0.3
func (e *RawExpr) Or(exprs ...Expression) Expression
type ValuesListQuery ¶ added in v1.0.3
Click to show internal directories.
Click to hide internal directories.