import "github.com/byte-mug/golibs/serializer"
func Cast(t reflect.Type, i interface{}) (v reflect.Value)
-
func CastV(t reflect.Type, v reflect.Value) reflect.Value
-
func Deserialize(ce CodecElement, r preciseio.PreciseReader) (interface{}, error)
-
func GetInterface(v reflect.Value) interface{}
-
func Serialize(ce CodecElement, w *preciseio.PreciseWriter, i interface{}) error
-
type CodecElement interface { Read(r preciseio.PreciseReader, v reflect.Value) error Write(w *preciseio.PreciseWriter, v reflect.Value) error }
-
func AddPtr(i interface{}) CodecElement
-
func AddPtrWith(i interface{}, ce CodecElement) CodecElement
-
func ForContainerWith(i interface{}, ce CodecElement) CodecElement
Obtains the serializer for reflect.TypeOf(i) and ce as the serializer for the contained elements.
func ForContainerWithDepth(i interface{}, depth int, ce CodecElement) CodecElement
Obtains the serializer for reflect.TypeOf(i) and ce as the serializer for the contained elements (after depth).
For example:
ForContainerWithDepth([][]*Bar{},2,fooBar)
is equivalent to:
ForContainerWith([][]*Bar{},ForContainerWith([]*Bar{},fooBar)))
func ForContainerWithDepthP(i interface{}, depth int, ce CodecElement) CodecElement
Obtains the serializer for reflect.TypeOf(i).Elem() and ce as the serializer for the contained elements (after depth).
For example:
ForContainerWithDepthP(new([2][2]*Bar),2,fooBar)
is equivalent to:
ForContainerWithP(new([2][2]*Bar),ForContainerWithP(new([2]*Bar),fooBar))
func ForContainerWithP(i interface{}, ce CodecElement) CodecElement
Obtains the serializer for reflect.TypeOf(i).Elem() and ce as the serializer for the contained elements.
func ForType(i interface{}) CodecElement
Obtains the serializer for reflect.TypeOf(i)
func ForTypeP(i interface{}) CodecElement
Obtains the serializer for reflect.TypeOf(i).Elem()
func StripawayPtr(i interface{}) CodecElement
-
func StripawayPtrWith(i interface{}, ce CodecElement) CodecElement
-
type StructBuilder struct { // contains filtered or unexported fields }
-
func With(i interface{}) *StructBuilder
-
func WithInline(i interface{}) *StructBuilder
-
func (s *StructBuilder) Field(name string) *StructBuilder
-
func (s *StructBuilder) FieldContainerWith(name string, ce CodecElement) *StructBuilder
-
func (s *StructBuilder) FieldContainerWithDepth(name string, depth int, ce CodecElement) *StructBuilder
-
func (s *StructBuilder) FieldWith(name string, ce CodecElement) *StructBuilder
-
func (s *StructBuilder) Read(r preciseio.PreciseReader, v reflect.Value) error
-
func (s *StructBuilder) Write(w *preciseio.PreciseWriter, v reflect.Value) error
-
type TypeSwitch struct { // contains filtered or unexported fields }
Creates a type-mapping for up to 255 different types. The type is indicated by the first byte.
func Switch(def byte) *TypeSwitch
Starts a new type switching. A default key must be specified.
func (t *TypeSwitch) AddType(b byte, i interface{}) *TypeSwitch
-
func (t *TypeSwitch) AddTypeContainerWith(b byte, i interface{}, ce CodecElement) *TypeSwitch
-
func (t *TypeSwitch) AddTypeContainerWithDepth(b byte, i interface{}, depth int, ce CodecElement) *TypeSwitch
-
func (t *TypeSwitch) AddTypeContainerWithDepthP(b byte, i interface{}, depth int, ce CodecElement) *TypeSwitch
-
func (t *TypeSwitch) AddTypeContainerWithP(b byte, i interface{}, ce CodecElement) *TypeSwitch
-
func (t *TypeSwitch) AddTypeP(b byte, i interface{}) *TypeSwitch
-
func (t *TypeSwitch) AddTypeWith(b byte, i interface{}, ce CodecElement) *TypeSwitch
-
func (t *TypeSwitch) AddTypeWithP(b byte, i interface{}, ce CodecElement) *TypeSwitch
-
func (t *TypeSwitch) Read(r preciseio.PreciseReader, v reflect.Value) error
-
func (t *TypeSwitch) Write(w *preciseio.PreciseWriter, v reflect.Value) error
-
import "fmt"
import "github.com/byte-mug/golibs/preciseio"
import "reflect"
import "sync"