registry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: BSD-3-Clause Imports: 2 Imported by: 4

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

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.

Jump to

Keyboard shortcuts

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