Documentation
¶
Overview ¶
Package codec will hold public codec contracts.
Index ¶
- type Column
- type ColumnsSource
- type Config
- type Factory
- type Instance
- type Option
- func WithColumnsSource(columnSource ColumnsSource) Option
- func WithOptions(options ...interface{}) Option
- func WithRecord(record interface{}) Option
- func WithResourceFS(resources fs.FS) Option
- func WithSelector(selector Selector) Option
- func WithTypeLookup(fn func(name string) (reflect.Type, error)) Option
- func WithValueGetter(valueGetter ValueGetter) Option
- func WithValueLookup(fn func(ctx context.Context, name string) (interface{}, error)) Option
- type Options
- type Selector
- type ValueGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnsSource ¶
type ColumnsSource interface {
Column(key string) (Column, bool)
ColumnName(key string) (string, error)
}
ColumnsSource is the reduced public column metadata ask surface.
type Config ¶
type Config struct {
Body string
SourceType reflect.Type `json:"-" yaml:"-"`
DestinationType reflect.Type `json:"-" yaml:"-"`
Args []string
OutputTypeExpression string
}
Config describes the exact source and destination contract for a codec.
type Instance ¶
type Instance interface {
Value(ctx context.Context, raw interface{}, options ...Option) (interface{}, error)
}
Instance is the reduced public codec execution contract. Registered instances may be shared by concurrent invocations: Value must be concurrency-safe and must not retain invocation context, record pointers, or lookup options.
type Option ¶
type Option func(o *Options)
Option mutates codec options.
func WithColumnsSource ¶
func WithColumnsSource(columnSource ColumnsSource) Option
func WithOptions ¶
func WithOptions(options ...interface{}) Option
func WithRecord ¶
func WithRecord(record interface{}) Option
func WithResourceFS ¶ added in v1.0.0
WithResourceFS supplies package resources to codecs that compile external assets such as StructQL. The original fs.FS, including embed.FS, is retained.
func WithSelector ¶
func WithValueGetter ¶
func WithValueGetter(valueGetter ValueGetter) Option
type Options ¶
type Options struct {
LookupType func(name string) (reflect.Type, error)
Record interface{}
LookupValue func(ctx context.Context, name string) (interface{}, error)
ResourceFS fs.FS
ColumnsSource
Selector
ValueGetter
Options []interface{}
}
Options is the reduced public codec option bag.
It exists to support codec construction and execution only. It must not turn into a general-purpose runtime dependency transport for unrelated services.
func NewOptions ¶
NewOptions creates a new option bag from option functions.