types

package
v9.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2021 License: BSD-2-Clause Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(b []byte, v interface{}, flags int) []byte

func AppendBytes

func AppendBytes(b []byte, bytes []byte, flags int) []byte

func AppendError

func AppendError(b []byte, err error) []byte

func AppendIdent

func AppendIdent(b []byte, field string, flags int) []byte

func AppendIdentBytes

func AppendIdentBytes(b []byte, field []byte, flags int) []byte

func AppendJSONB

func AppendJSONB(b, jsonb []byte, flags int) []byte

func AppendNull

func AppendNull(b []byte, flags int) []byte

func AppendString

func AppendString(b []byte, s string, flags int) []byte

func AppendTime

func AppendTime(b []byte, tm time.Time, flags int) []byte

func ParseTime

func ParseTime(b []byte) (time.Time, error)

func ParseTimeString

func ParseTimeString(s string) (time.Time, error)

func RegisterAppender

func RegisterAppender(value interface{}, fn AppenderFunc)

RegisterAppender registers an appender func for the type. Expecting to be used only during initialization, it panics if there is already a registered appender for the given type.

func RegisterScanner

func RegisterScanner(value interface{}, fn ScannerFunc)

RegisterScanner registers an scanner func for the type. Expecting to be used only during initialization, it panics if there is already a registered scanner for the given type.

func Scan

func Scan(v interface{}, rd Reader, n int) error

func ScanBytes

func ScanBytes(rd Reader, n int) ([]byte, error)

func ScanFloat32

func ScanFloat32(rd Reader, n int) (float32, error)

func ScanFloat64

func ScanFloat64(rd Reader, n int) (float64, error)

func ScanInt

func ScanInt(rd Reader, n int) (int, error)

func ScanInt64

func ScanInt64(rd Reader, n int) (int64, error)

func ScanString

func ScanString(rd Reader, n int) (string, error)

func ScanTime

func ScanTime(rd Reader, n int) (time.Time, error)

func ScanUint64

func ScanUint64(rd Reader, n int) (uint64, error)

func ScanValue

func ScanValue(v reflect.Value, rd Reader, n int) error

Types

type AppenderFunc

type AppenderFunc func([]byte, reflect.Value, int) []byte

func Appender

func Appender(typ reflect.Type) AppenderFunc

func ArrayAppender

func ArrayAppender(typ reflect.Type) AppenderFunc

func HstoreAppender

func HstoreAppender(typ reflect.Type) AppenderFunc

type Array

type Array struct {
	// contains filtered or unexported fields
}

func NewArray

func NewArray(vi interface{}) *Array

func (*Array) AppendValue

func (a *Array) AppendValue(b []byte, flags int) ([]byte, error)

func (*Array) ScanValue

func (a *Array) ScanValue(rd Reader, n int) error

func (*Array) Value

func (a *Array) Value() interface{}

type ArrayValueScanner

type ArrayValueScanner interface {
	BeforeScanArrayValue(rd Reader, n int) error
	ScanArrayValue(rd Reader, n int) error
	AfterScanArrayValue() error
}

type BytesReader

type BytesReader = internal.BytesReader

func NewBytesReader

func NewBytesReader(buf []byte) *BytesReader

type F

type F string

DEPRECATED. Use Ident instead.

func (F) AppendValue

func (f F) AppendValue(b []byte, flags int) ([]byte, error)

type Hstore

type Hstore struct {
	// contains filtered or unexported fields
}

func NewHstore

func NewHstore(vi interface{}) *Hstore

func (*Hstore) AppendValue

func (h *Hstore) AppendValue(b []byte, flags int) ([]byte, error)

func (*Hstore) ScanValue

func (h *Hstore) ScanValue(rd Reader, n int) error

func (*Hstore) Value

func (h *Hstore) Value() interface{}

type Ident

type Ident string

Ident represents a SQL identifier, e.g. table or column name.

func (Ident) AppendValue

func (f Ident) AppendValue(b []byte, flags int) ([]byte, error)

type NullTime

type NullTime struct {
	time.Time
}

NullTime is a time.Time wrapper that marshals zero time as JSON null and PostgreSQL NULL.

func (NullTime) AppendValue

func (tm NullTime) AppendValue(b []byte, flags int) ([]byte, error)

func (NullTime) MarshalJSON

func (tm NullTime) MarshalJSON() ([]byte, error)

func (*NullTime) Scan

func (tm *NullTime) Scan(b interface{}) error

func (*NullTime) UnmarshalJSON

func (tm *NullTime) UnmarshalJSON(b []byte) error

type Q

type Q string

DEPRECATED. Use Safe instead.

func (Q) AppendValue

func (q Q) AppendValue(b []byte, flags int) ([]byte, error)

type Reader

type Reader = internal.Reader

type Safe

type Safe string

Safe represents a safe SQL query.

func (Safe) AppendValue

func (q Safe) AppendValue(b []byte, flags int) ([]byte, error)

type ScannerFunc

type ScannerFunc func(reflect.Value, Reader, int) error

func ArrayScanner

func ArrayScanner(typ reflect.Type) ScannerFunc

func HstoreScanner

func HstoreScanner(typ reflect.Type) ScannerFunc

func Scanner

func Scanner(typ reflect.Type) ScannerFunc

type ValueAppender

type ValueAppender interface {
	AppendValue(b []byte, flags int) ([]byte, error)
}

func In

func In(slice interface{}) ValueAppender

func InMulti

func InMulti(values ...interface{}) ValueAppender

type ValueScanner

type ValueScanner interface {
	ScanValue(rd Reader, n int) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL