scanfunc

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnmarshalUnsupportedType = errors.New("only map[string]interface{} and struct pointer types are supported for unmarshalling")
View Source
var UtcCache = UnmarshalMetaCache{/* contains filtered or unexported fields */}
View Source
var UtcNoopScanner interface{} = NoOpScanner{}

Functions

func NewUnmarshalTargetSlice

func NewUnmarshalTargetSlice(target interface{}, cols []schema.DBColumnMeta) ([]interface{}, error)

Takes a pointer to a struct as well as a slice of column metadata, returning a slice of pointers which point at the tagged fields in target's type in the order provided in selectedCols param. This slice is for feeding as varargs to sql.Rows.Scan().

Types

type NoOpScanner

type NoOpScanner struct{}

Placeholder for columns which have no corresponding field in the target struct.

func (*NoOpScanner) Scan

func (s *NoOpScanner) Scan(src interface{}) error

type Placeholder

type Placeholder struct {
	Col schema.DBColumnMeta
	Val interface{}
}

placeholder implements sql.Scanner. instances of this are used as placeholder values that rows.Scan will recognize and supply each column value to them.

func (*Placeholder) Scan

func (s *Placeholder) Scan(src interface{}) error

type ScanFunc

type ScanFunc func(rows *sql.Rows) error

scanFunc deserializes rows from the ldb into another data structure

func New

func New(target interface{}, cols []schema.DBColumnMeta) (ScanFunc, error)

type UnmarshalMetaCache

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

func (*UnmarshalMetaCache) GetOrSet

func (umc *UnmarshalMetaCache) GetOrSet(typ reflect.Type, getter UtmGetterFunc) (UnmarshalTypeMeta, error)

func (*UnmarshalMetaCache) Invalidate

func (umc *UnmarshalMetaCache) Invalidate(typ reflect.Type)

type UnmarshalTypeMeta

type UnmarshalTypeMeta struct {
	Fields map[string]UnmarshalTypeMetaField
}

type UnmarshalTypeMetaField

type UnmarshalTypeMetaField struct {
	Field   reflect.StructField
	Factory unsafe.InterfaceFactory
}

type UtmGetterFunc

type UtmGetterFunc func(reflect.Type) (UnmarshalTypeMeta, error)

Jump to

Keyboard shortcuts

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