codec

package
v0.0.0-...-a09fd22 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = make(Map)
View Source
var DefaultField = Default.
	RegisterMap("field", 50, make(Map))
View Source
var DefaultStruct = Default.
	RegisterMap("struct", 100, make(Map))
View Source
var DefaultTemplate = make(Map)
View Source
var DefaultTemplateField = DefaultTemplate.
	RegisterMap("field", 50, make(Map))

Functions

func TemplateWithContext

func TemplateWithContext(ctx context.Context, t Template) context.Context

Types

type Field

type Field struct {
	Type    string
	Convert func(bool, interface{}) (interface{}, error)
}

func (Field) Decode

func (f Field) Decode(_ context.Context, key string, o big.Struct) error

func (Field) Encode

func (f Field) Encode(_ context.Context, key string, o big.Struct) error

func (Field) GoString

func (f Field) GoString() string

type Func

type Func func(typ string, m Map) error

type Map

type Map map[string]struct {
	Codec    big.Codec
	Priority int
	Children Map
}

func (Map) Codec

func (m Map) Codec(typ string) big.Codec

func (Map) Decode

func (m Map) Decode(ctx context.Context, key string, o big.Struct) error

func (Map) Encode

func (m Map) Encode(ctx context.Context, key string, o big.Struct) error

func (Map) GoString

func (m Map) GoString() string

func (Map) Keys

func (m Map) Keys() []string

func (Map) Register

func (m Map) Register(name string, priority int, c big.Codec) Map

func (Map) RegisterMap

func (m Map) RegisterMap(name string, priority int, cm Map) Map

func (Map) String

func (m Map) String() string

func (Map) Walk

func (m Map) Walk(fn Func) error

func (Map) WriteTab

func (m Map) WriteTab(w io.Writer) (n int64, err error)

func (Map) WriteTo

func (m Map) WriteTo(w io.Writer) (int64, error)

type Recursive

type Recursive struct {
	Codec big.Codec
}

func (Recursive) Decode

func (r Recursive) Decode(ctx context.Context, key string, o big.Struct) error

func (Recursive) Encode

func (r Recursive) Encode(ctx context.Context, key string, o big.Struct) error

func (Recursive) GoString

func (r Recursive) GoString() string

type Struct

type Struct struct {
	Type      string
	Marshal   func(interface{}) ([]byte, error)
	Unmarshal func([]byte, interface{}) error
}

func (Struct) Decode

func (s Struct) Decode(_ context.Context, key string, o big.Struct) error

func (Struct) Encode

func (s Struct) Encode(_ context.Context, key string, o big.Struct) error

func (Struct) GoString

func (s Struct) GoString() string

type Template

type Template struct {
	Data  interface{}
	Funcs map[string]interface{}
}

func TemplateFromContext

func TemplateFromContext(ctx context.Context) (Template, bool)

func (Template) Decode

func (Template) Encode

func (t Template) Encode(ctx context.Context, key string, s big.Struct) error

func (Template) GoString

func (Template) GoString() string

Jump to

Keyboard shortcuts

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