encoding

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2014 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const TagName = "gorethink"

Variables

This section is empty.

Functions

func Decode

func Decode(dst interface{}, src interface{}) (err error)

Decode decodes map[string]interface{} into a struct. The first parameter must be a pointer.

func Encode

func Encode(v interface{}) (ev interface{}, err error)

Encode returns the encoded value of v.

Encode traverses the value v recursively and looks for structs. If a struct is found then it is checked for tagged fields and convert to map[string]interface{}

func RegisterEncodeHook added in v0.3.2

func RegisterEncodeHook(hook EncodeHook)

Types

type DecodeFieldError

type DecodeFieldError struct {
	Key   string
	Type  reflect.Type
	Field reflect.StructField
}

An DecodeFieldError describes a object key that led to an unexported (and therefore unwritable) struct field. (No longer used; kept for compatibility.)

func (*DecodeFieldError) Error

func (e *DecodeFieldError) Error() string

type DecodeTypeError

type DecodeTypeError struct {
	Value string       // description of value - "bool", "array", "number -5"
	Type  reflect.Type // type of Go value it could not be assigned to
}

An DecodeTypeError describes a value that was not appropriate for a value of a specific Go type.

func (*DecodeTypeError) Error

func (e *DecodeTypeError) Error() string

type EncodeHook added in v0.3.2

type EncodeHook func(src reflect.Value) (success bool, ret reflect.Value, err error)

type FieldMapper

type FieldMapper interface {
	FieldMap() map[string]string
}

type InvalidDecodeError

type InvalidDecodeError struct {
	Type reflect.Type
}

An InvalidDecodeError describes an invalid argument passed to Decode. (The argument to Decode must be a non-nil pointer.)

func (*InvalidDecodeError) Error

func (e *InvalidDecodeError) Error() string

type UnsupportedTypeError

type UnsupportedTypeError struct {
	Type reflect.Type
}

An UnsupportedTypeError is returned by Marshal when attempting to encode an unsupported value type.

func (*UnsupportedTypeError) Error

func (e *UnsupportedTypeError) Error() string

type UnsupportedValueError

type UnsupportedValueError struct {
	Value reflect.Value
	Str   string
}

func (*UnsupportedValueError) Error

func (e *UnsupportedValueError) Error() string

Jump to

Keyboard shortcuts

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