package registry
import "go.dedis.ch/dela/serde/registry"
Package registry defines the format registry mechanism.
It also provides a default implementation that will always return a format using an empty format when appropriate. This format will always return an error.
Documentation Last Review: 07.10.2020
Index ¶
Types ¶
type Registry ¶
type Registry interface { // Register takes a format and its engine and it registers them so that the // engine can be looked up later. Register(serde.Format, serde.FormatEngine) // Get returns the engine associated with the format. Get(serde.Format) serde.FormatEngine }
Registry is an interface to register and get format engines for a specific format.
type SimpleRegistry ¶
type SimpleRegistry struct {
// contains filtered or unexported fields
}
SimpleRegistry is a default implementation of the Registry interface. It will always return a format which means an empty one is returned if the key is unknown.
- implements registry.Registry
func NewSimpleRegistry ¶
func NewSimpleRegistry() *SimpleRegistry
NewSimpleRegistry returns a new empty registry.
func (*SimpleRegistry) Get ¶
func (r *SimpleRegistry) Get(name serde.Format) serde.FormatEngine
Get implements registry.Registry. It returns the format engine associated with the format if it exists, otherwise it returns an empty format.
func (*SimpleRegistry) Register ¶
func (r *SimpleRegistry) Register(name serde.Format, f serde.FormatEngine)
Register implements registry.Registry. It registers the engine for the given format.
Source Files ¶
registry.go simple.go
- Version
- v0.1.0 (latest)
- Published
- Apr 10, 2024
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 1 month ago –
Tools for package owners.