Documentation ¶
Overview ¶
Package encoding handles Tezos binary encoding
Index ¶
- func Ctx(ctx *Context) func(*[]flag, *Context)
- func Decode(data []byte, v any, opt ...Option) (rest []byte, err error)
- func Dynamic() func(*[]flag, *Context)
- func Encode(out io.Writer, v any, opt ...Option) error
- func Enums(er *EnumRegistry) func(*[]flag, *Context)
- func ListVariants[T any]() []T
- func Optional() func(*[]flag, *Context)
- func RegisterEnum[T any](enum *Enum[T])
- func RegisterType[T any](decoder func([]byte, *Context) (T, []byte, error))
- func Types(tr *TypeRegistry) func(*[]flag, *Context)
- type Context
- type Decoder
- type Encoder
- type Enum
- type EnumRegistry
- type ErrBuffer
- type Error
- type ErrorPath
- type FieldSelector
- type IndexSelector
- type Option
- type PathSeg
- type TypeRegistry
- type TypeSelector
- type Variants
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enums ¶
func Enums(er *EnumRegistry) func(*[]flag, *Context)
func ListVariants ¶
func ListVariants[T any]() []T
func RegisterEnum ¶
RegisterEnum registers enum type in the global registry
func RegisterType ¶
RegisterType registers user interface type in the global registry
func Types ¶
func Types(tr *TypeRegistry) func(*[]flag, *Context)
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
func (*Context) Enums ¶
func (ctx *Context) Enums(er *EnumRegistry)
func (*Context) Types ¶
func (ctx *Context) Types(tr *TypeRegistry)
type EnumRegistry ¶
type EnumRegistry struct {
// contains filtered or unexported fields
}
EnumRegistry stores variant types
func NewEnumRegistry ¶
func NewEnumRegistry() *EnumRegistry
NewEnumRegistry returns new empty EnumRegistry
func (*EnumRegistry) ListVariants ¶
func (e *EnumRegistry) ListVariants(typ any) []any
func (*EnumRegistry) RegisterEnum ¶
func (v *EnumRegistry) RegisterEnum(variants, def any)
type FieldSelector ¶
type FieldSelector reflect.StructField
func (FieldSelector) SegSelector ¶
func (FieldSelector) SegSelector()
func (*FieldSelector) String ¶
func (f *FieldSelector) String() string
type IndexSelector ¶
type IndexSelector int
func (IndexSelector) SegSelector ¶
func (IndexSelector) SegSelector()
func (IndexSelector) String ¶
func (i IndexSelector) String() string
type TypeRegistry ¶
type TypeRegistry struct {
// contains filtered or unexported fields
}
TypeRegistry stores uses interface type constructors (decoders)
func NewTypeRegistry ¶
func NewTypeRegistry() *TypeRegistry
NewTypeRegistry returns new empty TypeRegistry
func (*TypeRegistry) RegisterType ¶
func (r *TypeRegistry) RegisterType(fn any)
type TypeSelector ¶
func (TypeSelector) SegSelector ¶
func (TypeSelector) SegSelector()
func (TypeSelector) String ¶
func (t TypeSelector) String() string
Click to show internal directories.
Click to hide internal directories.