Documentation ¶
Overview ¶
The text array details were mostly rewritten based on pgtype. pgtype uses the MIT LICENSE and the Copyright (c) 2013-2021 Jack Christensen
Index ¶
- Constants
- Variables
- func ColKey(key string, t typ.Type) (string, error)
- func Exec(ctx context.Context, pc PC, sql string, args []lit.Val) error
- func FieldEncoder(oid uint32, arg lit.Val) (encoder, error)
- func Open(ctx context.Context, dsn string, logger pgx.Logger) (*pgxpool.Pool, error)
- func Query(ctx context.Context, pc PC, sql string, args []lit.Val) (pgx.Rows, error)
- func Quote(text string) string
- func ScanMany(reg lit.Regs, scal bool, mut lit.Mut, rows pgx.Rows) (err error)
- func ScanOne(reg lit.Regs, scal bool, mut lit.Mut, rows pgx.Rows) error
- func TypString(t typ.Type) (string, error)
- func Unreserved(name string) (string, bool)
- func WithTx(ctx context.Context, db DB, f func(PC) error) error
- func WriteCall(w *Writer, env exp.Env, e *exp.Call) error
- func WriteExp(w *Writer, env exp.Env, e exp.Exp) error
- func WriteIdent(w bfr.Writer, name string) (err error)
- func WriteLit(b *Writer, l *exp.Lit) error
- func WriteQuote(w *Writer, text string) error
- func WriteVal(b *Writer, t typ.Type, l lit.Val) error
- type C
- type DB
- type Decoder
- type DecoderPair
- type ExpEnv
- type PC
- type Param
- type Scanner
- type Translator
- type WrapBool
- type WrapIdxr
- type WrapInt2
- type WrapInt4
- type WrapInt8
- type WrapJSON
- type WrapJSONB
- type WrapNull
- type WrapRaw
- type WrapReal4
- type WrapReal8
- type WrapSpan
- type WrapSpanTime
- type WrapStr
- type WrapTime
- type WrapTimeDate
- type WrapTimestamp
- type WrapUUID
- type Writer
Constants ¶
const ( PrecOr PrecAnd PrecNot PrecIs // , is null, is not null, … PrecCmp // <, >, =, <=, >=, <>, != PrecIn // , between, like, ilike, similar PrecDef PrecAdd // +, - PrecMul // *, /, % )
Variables ¶
var External = fmt.Errorf("external symbol")
Functions ¶
func Unreserved ¶
Unreserved returns the lowercase key and whether it is an unreserved identifier. If unreserved returns false the key must be escaped with double quotes.
func WriteCall ¶
WriteCall writes the expression e to w using env or returns an error. Most xelf expressions with resolvers from the core or lib built-ins have a corresponding expression in postgresql. Custom resolvers can be rendered to sql by detecting and handling them before calling this function.
func WriteExp ¶
WriteExp writes the element e to w or returns an error. This is used for explicit selectors for example.
func WriteQuote ¶
WriteQuote quotes a string as a postgres string, all single quotes are use sql escaping.
Types ¶
type C ¶
type C interface { Query(context.Context, string, ...interface{}) (pgx.Rows, error) QueryRow(context.Context, string, ...interface{}) pgx.Row Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error) CopyFrom(context.Context, pgx.Identifier, []string, pgx.CopyFromSource) (int64, error) }
type Decoder ¶
Decoder is a function to decode either a text or binary postgres result to a literal.
func FieldDecoder ¶
FieldDecoder returns a decoder for the given field description fd.
type DecoderPair ¶
type DecoderPair struct{ Text, Binary Decoder }
func FieldDecoders ¶
func FieldDecoders(oid uint32) DecoderPair
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner is a simplified xelf-aware Scanner for pgx rows. it avoids some hacks on my end, alleviate many extra type checks and has better null handling for my use-case.