registry

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *registry

func Register

func Register(reg Registry, v Registrable, s Serializer, d Deserializer, os []BuildOption) error

func RegisterFactory

func RegisterFactory(reg Registry, key string, fn func() interface{}, s Serializer, d Deserializer,
	os []BuildOption,
) error

func RegisterKey

func RegisterKey(reg Registry, key string, v interface{}, s Serializer, d Deserializer, os []BuildOption) error

Types

type AlreadyRegisteredKey

type AlreadyRegisteredKey string

func (AlreadyRegisteredKey) Error

func (key AlreadyRegisteredKey) Error() string

type BuildOption

type BuildOption func(v interface{}) error

func ValidateImplements

func ValidateImplements(checkV interface{}) BuildOption

type Deserializer

type Deserializer func([]byte, interface{}) error

type Registrable

type Registrable interface {
	Key() string
}

type Registry

type Registry interface {
	Serialize(string, interface{}) ([]byte, error)
	MustSerialize(string, interface{}) []byte
	Build(string, ...BuildOption) (interface{}, error)
	MustBuild(string, ...BuildOption) interface{}
	Deserialize(string, []byte, ...BuildOption) (interface{}, error)
	MustDeserialize(string, []byte, ...BuildOption) interface{}
	// contains filtered or unexported methods
}

type Serde

type Serde interface {
	Register(v Registrable, options ...BuildOption) error
	RegisterKey(key string, v interface{}, options ...BuildOption) error
	RegisterFactory(key string, fn func() interface{}, options ...BuildOption) error
}

type Serializer

type Serializer func(interface{}) ([]byte, error)

type UnregisteredKey

type UnregisteredKey string

func (UnregisteredKey) Error

func (key UnregisteredKey) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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