Versions in this module Expand all Collapse all v1 v1.3.0 May 27, 2024 v1.2.84 Jan 17, 2024 v1.2.50 Jan 12, 2024 v1.2.41 Jan 12, 2024 Changes in this version type Column + FieldIdx []int + func (column *Column) ReadValue(sv reflect.Value) (fv reflect.Value) v1.2.11 Dec 19, 2023 v1.2.3 Dec 17, 2023 v1.2.1 Dec 17, 2023 Changes in this version + var AND = []byte("AND") + var AS = []byte("AS") + var AT = []byte("@") + var BY = []byte("BY") + var COMMA = []byte(", ") + var CONFLICT = []byte("CONFLICT") + var COUNT = []byte("COUNT") + var DELETE = []byte("DELETE") + var DESC = []byte("DESC") + var DO = []byte("DO") + var DOT = []byte(".") + var EQ = []byte("=") + var EXISTS = []byte("EXISTS") + var FROM = []byte("FROM") + var GROUP = []byte("GROUP") + var HAVING = []byte("HAVING") + var INSERT = []byte("INSERT") + var INTO = []byte("INTO") + var LB = []byte("(") + var LIMIT = []byte("LIMIT") + var NOT = []byte("NOT") + var NOTHING = []byte("NOTHING") + var OFFSET = []byte("OFFSET") + var ON = []byte("ON") + var ORDER = []byte("ORDER") + var PLUS = []byte("+") + var RB = []byte(")") + var RETURNING = []byte("RETURNING") + var SELECT = []byte("SELECT") + var SET = []byte("SET") + var SPACE = []byte(" ") + var STAR = []byte("*") + var UPDATE = []byte("UPDATE") + var VALUES = []byte("VALUES") + var WHERE = []byte("WHERE") + func AsFloat(e any) (n float64, ok bool) + func AsInt(e any) (n int64, ok bool) + func DictSet(key string, value ...string) + func Instance[T any]() (v T) + func MaybeTable(e any) (ok bool) + func MaybeView(e any) (ok bool) + func NewBasicValueWriter(rt reflect.Type) (vw ValueWriter, ct ColumnTypeName, err error) + func RegisterDialect(dialect Dialect) + func ScanRows[T any](ctx context.Context, rows sql.Rows, fields []string) (entries []T, err error) + func TrySetupAuditCreation[T any](ctx context.Context, spec *Specification, entries []T) (err error) + func TrySetupAuditDeletion[T any](ctx context.Context, spec *Specification, entries []T) (err error) + func TrySetupAuditModification[T any](ctx context.Context, spec *Specification, entries []T) (err error) + func TrySetupAuditVersion[T any](ctx context.Context, entries []T) (err error) + func TrySetupLastInsertId[T any](ctx context.Context, entry T, id int64) (v T, err error) + func WriteInsertReturning[T any](ctx context.Context, rows sql.Rows, returning []string, entries []T) (affected int64, err error) + type BoolValue struct + func (w *BoolValue) Write(value any, rv reflect.Value) (err error) + type ByteValue struct + func (w *ByteValue) Write(value any, rv reflect.Value) (err error) + type BytesValue struct + func (w *BytesValue) Write(value any, rv reflect.Value) (err error) + type Column struct + Field string + JsonIdent string + Kind ColumnKind + Name string + Type ColumnType + ValueWriter ValueWriter + func (column *Column) Incr() bool + func (column *Column) Link() (hostField string, awayField string, mapping *Specification, ok bool) + func (column *Column) Links() (hostField string, awayField string, mapping *Specification, ...) + func (column *Column) Reference() (awayField string, mapping *Specification, ok bool) + func (column *Column) String() (s string) + func (column *Column) Valid() bool + func (column *Column) Virtual() (kind VirtualQueryKind, query string, ok bool) + func (column *Column) WriteValue(field reflect.Value, value any) (err error) + type ColumnKind int + const Acb + const Act + const Adb + const Adt + const Amb + const Amt + const Aol + const Json + const Link + const Links + const Normal + const Pk + const Reference + const Virtual + func (kind ColumnKind) String() string + type ColumnType struct + Mapping *Specification + Name ColumnTypeName + Options []string + Value reflect.Type + func (ct *ColumnType) String() string + type ColumnTypeName int + const BoolType + const ByteType + const BytesType + const DateType + const DatetimeType + const FloatType + const IntType + const JsonType + const MappingType + const ScanType + const StringType + const TimeType + const UnknownType + type Condition struct + func (cond Condition) Render(ctx Context, w io.Writer) (arguments []any, err error) + type Context interface + FormatIdent func(ident string) string + Localization func(key any) (content []string, has bool) + NextQueryPlaceholder func() (v string) + SkipNextQueryPlaceholderCursor func(n int) + func Fork(ctx Context) Context + func SwitchKey(ctx Context, key any) Context + func Todo(ctx context.Context, key any, dialect Dialect) Context + type DateValue struct + func (w *DateValue) Write(value any, rv reflect.Value) (err error) + type DatetimeValue struct + func (w *DatetimeValue) Write(value any, rv reflect.Value) (err error) + type Dialect interface + Count func(ctx Context, spec *Specification, cond Condition) (method Method, query []byte, arguments []any, err error) + Delete func(ctx Context, spec *Specification) (method Method, query []byte, fields []string, err error) + DeleteByConditions func(ctx Context, spec *Specification, cond Condition) (method Method, query []byte, audits []string, arguments []any, err error) + Exist func(ctx Context, spec *Specification, cond Condition) (method Method, query []byte, arguments []any, err error) + FormatIdent func(ident string) string + Insert func(ctx Context, spec *Specification, values int) (method Method, query []byte, fields []string, returning []string, err error) + InsertOrUpdate func(ctx Context, spec *Specification) (method Method, query []byte, fields []string, returning []string, err error) + InsertWhenExist func(ctx Context, spec *Specification, src QueryExpr) (method Method, query []byte, fields []string, arguments []any, ...) + InsertWhenNotExist func(ctx Context, spec *Specification, src QueryExpr) (method Method, query []byte, fields []string, arguments []any, ...) + Name func() string + Query func(ctx Context, spec *Specification, cond Condition, orders Orders, offset int, ...) (method Method, query []byte, arguments []any, fields []string, err error) + QueryPlaceholder func() QueryPlaceholder + Update func(ctx Context, spec *Specification) (method Method, query []byte, fields []string, err error) + UpdateFields func(ctx Context, spec *Specification, fields []FieldValue, cond Condition) (method Method, query []byte, arguments []any, err error) + View func(ctx Context, spec *Specification, cond Condition, orders Orders, ...) (method Method, query []byte, arguments []any, fields []string, err error) + func LoadDialect(ctx context.Context) (dialect Dialect, err error) + type Dict struct + func NewDict() *Dict + func (dict *Dict) Get(key ...any) (value []string, has bool) + func (dict *Dict) Set(key string, value ...string) + type FieldValue struct + Name string + Value any + type FloatValue struct + func (w *FloatValue) Write(value any, rv reflect.Value) (err error) + type Generic struct + Valid bool + Value any + func (v *Generic) Reset() + func (v *Generic) Scan(src any) (err error) + type Generics []any + func (generics Generics) WriteTo(spec *Specification, fieldNames []string, entryPtr any) (err error) + type GroupBy struct + func (group GroupBy) Exist() bool + func (group GroupBy) Render(ctx Context, w io.Writer) (argument []any, err error) + type IntValue struct + func (w *IntValue) Write(value any, rv reflect.Value) (err error) + type JsonValue struct + ValueType reflect.Type + func (w *JsonValue) Write(value any, rv reflect.Value) (err error) + type MappingValue struct + ValueType reflect.Type + func (w *MappingValue) Write(value any, rv reflect.Value) (err error) + type Method int + const ExecuteMethod + const QueryMethod + func BuildCount[T any](ctx context.Context, cond Condition) (method Method, query []byte, arguments []any, err error) + func BuildDeleteAnyByCondition(ctx context.Context, entry any, cond Condition) (method Method, query []byte, arguments []any, err error) + func BuildDeleteByCondition[T any](ctx context.Context, cond Condition) (method Method, query []byte, arguments []any, err error) + func BuildDelete[T any](ctx context.Context, entries []T) (method Method, query []byte, arguments []any, err error) + func BuildExist[T any](ctx context.Context, cond Condition) (method Method, query []byte, arguments []any, err error) + func BuildInsertOrUpdate[T any](ctx context.Context, entries []T) (method Method, query []byte, arguments []any, returning []string, err error) + func BuildInsertWhenExist[T any](ctx context.Context, entries []T, src QueryExpr) (method Method, query []byte, arguments []any, returning []string, err error) + func BuildInsertWhenNotExist[T any](ctx context.Context, entries []T, src QueryExpr) (method Method, query []byte, arguments []any, returning []string, err error) + func BuildInsert[T any](ctx context.Context, entries []T) (method Method, query []byte, arguments []any, returning []string, err error) + func BuildQuery[T any](ctx context.Context, cond Condition, orders Orders, offset int, length int) (method Method, query []byte, arguments []any, columns []string, err error) + func BuildUpdateFields[T any](ctx context.Context, fields []FieldValue, cond Condition) (method Method, query []byte, arguments []any, err error) + func BuildUpdate[T any](ctx context.Context, entries []T) (method Method, query []byte, arguments []any, err error) + func BuildView[T any](ctx context.Context, cond Condition, orders Orders, groupBy GroupBy, ...) (method Method, query []byte, arguments []any, columns []string, err error) + type Orders orders.Orders + func (o Orders) Render(ctx Context, w io.Writer) (argument []any, err error) + type Page struct + No int + Size int + func PG(no int, size int) Page + func (p Page) Range() (rng Range) + type Predicate struct + func (p Predicate) Render(ctx Context, w io.Writer) (argument []any, err error) + type QueryExpr struct + func (expr QueryExpr) Render(ctx Context, w io.Writer) (argument []any, err error) + type QueryPlaceholder interface + Current func() (v string) + Next func() (v string) + SkipCursor func(n int) + type Range struct + Length int + Offset int + func RNG(offset int, length int) Range + func (rng Range) Page() (page Page) + type Render interface + Render func(ctx Context, w io.Writer) (argument []any, err error) + type ScanValue struct + func (w *ScanValue) Write(value any, rv reflect.Value) (err error) + type Specification struct + Columns []*Column + Conflicts []string + Key string + Name string + Schema string + Type reflect.Type + View bool + ViewBase *Specification + func GetSpecification(ctx context.Context, e any) (spec *Specification, err error) + func ScanTable(ctx context.Context, table any) (spec *Specification, err error) + func ScanView(ctx context.Context, view any) (spec *Specification, err error) + func (spec *Specification) ArgumentByField(instance any, field string) (argument any, err error) + func (spec *Specification) Arguments(instance any, fieldNames []string) (arguments []any, err error) + func (spec *Specification) AuditCreation() (by *Column, at *Column, has bool) + func (spec *Specification) AuditDeletion() (by *Column, at *Column, has bool) + func (spec *Specification) AuditModification() (by *Column, at *Column, has bool) + func (spec *Specification) AuditVersion() (v *Column, has bool) + func (spec *Specification) ColumnByField(fieldName string) (column *Column, has bool) + func (spec *Specification) ConflictColumns() (columns []*Column, err error) + func (spec *Specification) Instance() (v any) + func (spec *Specification) Pk() (v *Column, has bool) + func (spec *Specification) String() (s string) + type StringValue struct + func (w *StringValue) Write(value any, rv reflect.Value) (err error) + type TableInfo struct + func GetTableInfo(e any) (info TableInfo, err error) + type TimeValue struct + func (w *TimeValue) Write(value any, rv reflect.Value) (err error) + type ValueWriter interface + Write func(value any, field reflect.Value) (err error) + type ViewInfo struct + func GetViewInfo(e any) (info ViewInfo, err error) + type VirtualQueryKind int + const AggregateVirtualQuery + const ArrayVirtualQuery + const BasicVirtualQuery + const ObjectVirtualQuery + const UnknownVirtualQueryKind