storable

package
v0.0.0-...-85902bd Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Name     string
	DataType string
	// contains filtered or unexported fields
}

Field represents a default storable field descriptor

func NewFields

func NewFields(name string, dataType string) []*Field

NewFields create new Fields

func (*Field) Init

func (f *Field) Init() (err error)

Init initialise field

func (*Field) Type

func (f *Field) Type() reflect.Type

Type returns field type

type Generic

type Generic struct {
	Value interface{}
}

Generic represents generic storable

func NewGeneric

func NewGeneric(value interface{}) *Generic

NewGeneric creates a Generic storable (for struct/map)

func (Generic) Iterator

func (s Generic) Iterator() common.Iterator

Iterator returns iterator

func (*Generic) Set

func (s *Generic) Set(iter common.Iterator) error

Set sets values

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry represents storable registry

func Singleton

func Singleton() *Registry

Singleton return fn registry

func (*Registry) Lookup

func (r *Registry) Lookup(key string) (func() common.Storable, error)

Lookup returns storable provider or error

func (*Registry) Register

func (r *Registry) Register(key string, fn func() common.Storable)

Register represents storable registry

type Slice

type Slice struct {
	Values []interface{}
	Fields []*Field
	// contains filtered or unexported fields
}

Slice represents slice registry

func New

func New(fields []*Field) *Slice

New return new storable

func (*Slice) DecodeBinary

func (s *Slice) DecodeBinary(stream *bintly.Reader) error

DecodeBinary bintly decoder

func (*Slice) EncodeBinary

func (s *Slice) EncodeBinary(stream *bintly.Writer) error

EncodeBinary bintly encoder

func (*Slice) Hash

func (s *Slice) Hash() int

Hash returns hash

func (*Slice) IsNil

func (s *Slice) IsNil() bool

IsNil returns nil

func (*Slice) Iterator

func (s *Slice) Iterator() common.Iterator

Iterator return storable iterator

func (*Slice) MarshalJSON

func (s *Slice) MarshalJSON() ([]byte, error)

MarshalJSON default json marshaler

func (*Slice) MarshalJSONObject

func (s *Slice) MarshalJSONObject(enc *gojay.Encoder)

MarshalJSONObject implement MarshalerJSONObject

func (*Slice) NKeys

func (s *Slice) NKeys() int

NKeys returns object key count

func (*Slice) Set

func (s *Slice) Set(iter common.Iterator) error

Set sets value

func (*Slice) SetHash

func (s *Slice) SetHash(hash int)

SetHash sets hash

func (*Slice) UnmarshalJSONObject

func (s *Slice) UnmarshalJSONObject(dec *gojay.Decoder, key string) error

UnmarshalJSONObject unmarshal json with gojay parser

Jump to

Keyboard shortcuts

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