serialize

package
v21.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PropertyTypeRegistry = struct{ propertyTypeRegistry }{/* contains filtered or unexported fields */}

PropertyTypeRegistry ...

Functions

This section is empty.

Types

type JSONProperties

type JSONProperties struct {
	// properties jsonProperties
	Properties map[string]*jsonProperty
	// This lock is used to make sure addition or removal of keys in JSonProperties won't collide in go routines
	sync.RWMutex
	// contains filtered or unexported fields
}

JSONProperties ...

func NewJSONProperties

func NewJSONProperties(module string) (_ *JSONProperties, ferr fail.Error)

NewJSONProperties creates a new JSonProperties instance

func (*JSONProperties) Alter

func (x *JSONProperties) Alter(key string, alterer func(data.Clonable) fail.Error) (ferr fail.Error)

Alter is used to lock an extension for write Returns a pointer to LockedEncodedExtension, on which can be applied method 'Use()' If no extension exists corresponding to the key, an empty one is created (in other words, this call can't fail because a key doesn't exist). 'alterer' can use a special error to tell the outside there was no change : fail.ErrAlteredNothing, which can be generated with fail.AlteredNothingError().

func (*JSONProperties) Count

func (x *JSONProperties) Count() uint

Count returns the number of properties available

func (*JSONProperties) Deserialize

func (x *JSONProperties) Deserialize(buf []byte) (ferr fail.Error)

Deserialize ... Returns fail.SyntaxError if an JSON syntax error happens satisfies interface data.Serializable

func (*JSONProperties) Inspect

func (x *JSONProperties) Inspect(key string, inspector func(clonable data.Clonable) fail.Error) (ferr fail.Error)

Inspect allows to consult the content of the property 'key' inside 'inspector' function Changes in the property won't be kept

func (*JSONProperties) Lookup

func (x *JSONProperties) Lookup(key string) bool

Lookup tells if a key is present in JSonProperties

func (*JSONProperties) Serialize

func (x *JSONProperties) Serialize() (_ []byte, ferr fail.Error)

Serialize ... satisfies interface data.Serializable

func (*JSONProperties) SetModule

func (x *JSONProperties) SetModule(module string) (ferr fail.Error)

SetModule allows to change the module of the JSONProperties (used to "contextualize" Property Types)

type Serializable

type Serializable interface {
	Serialize() ([]byte, error)
	Deserialize([]byte) error
}

Serializable is the interface allowing the conversion of satisfying struct to []byte (Serialize() and reverse operation (Deserialize()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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