dtypes

package module
v0.0.0-...-b166813 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2017 License: BSD-3-Clause Imports: 9 Imported by: 0

README

dtypes

dtypes provides the building blocks for encoding/decoding types.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(value interface{})

Register records a type, identified by a value for that type, under its internal type name. That name will identify the concrete type of a value sent or received as an interface variable. Only types that will be transferred as implementations of interface values need to be registered. Expecting to be used only during initialization, it panics if the mapping between types and names is not a bijection.

Types

type CommonType

type CommonType struct {
	Xname string
	Xid   ID
}

func (*CommonType) Descr

func (t *CommonType) Descr() []Descr

func (*CommonType) ID

func (t *CommonType) ID() ID

func (*CommonType) Kind

func (*CommonType) Kind() Kind

func (*CommonType) Name

func (t *CommonType) Name() string

type DecInstr

type DecInstr func(r io.Reader, v reflect.Value) (int, error)

type Decoder

type Decoder struct {
	Ops []DecInstr
}

type Descr

type Descr struct {
	Name string
	ID   ID
}

Descr describes a type in terms of builtins

type EncInstr

type EncInstr func(w io.Writer, v reflect.Value) (int, error)

type Encoder

type Encoder struct {
	Ops []EncInstr
}

type ID

type ID uint32

ID represents a Type as an integer that can be stored on disk or passed on the wire.

func (ID) Type

func (id ID) Type() Type

type Kind

type Kind uint

A Kind represents the specific kind of type that a Type represents. The zero Kind is not a valid kind.

const (
	Invalid Kind = iota
	Builtin
	Array
	Map
	Slice
	Struct
)

func (Kind) String

func (k Kind) String() string

type Type

type Type interface {
	ID() ID
	Name() string
	Kind() Kind
	Descr() []Descr
	// contains filtered or unexported methods
}

Type describes a serializable data type description

func New

func New(v interface{}) Type

New returns the Type of the value v.

func TypeFromID

func TypeFromID(id ID) Type

TypeFromID returns the dtypes.Type corresponding to ID. TypeFromID returns nil if no such ID is known to the runtime.

Jump to

Keyboard shortcuts

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