component

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrComponentNotRegistered = eris.New("component not registered")

Functions

func NewComponentMetadata

func NewComponentMetadata[T types.Component](opts ...Option[T]) (
	types.ComponentMetadata, error,
)

NewComponentMetadata creates a new component type. The function is used to create a new component of the type.

Types

type ComponentManager added in v1.5.0

type ComponentManager interface {
	RegisterComponent(compMetadata types.ComponentMetadata) error
	GetComponents() []types.ComponentMetadata
	GetComponentByName(name string) (types.ComponentMetadata, error)
}

func NewManager

func NewManager(schemaStorage SchemaStorage) ComponentManager

NewManager creates a new component manager.

type Option

type Option[T types.Component] func(c *componentMetadata[T])

Option is a type that can be passed to NewComponentMetadata to augment the creation of the component type.

func WithDefault

func WithDefault[T types.Component](defaultVal T) Option[T]

WithDefault updated the created componentMetadata with a default value.

type SchemaStorage

type SchemaStorage interface {
	GetSchema(componentName string) ([]byte, error)
	SetSchema(componentName string, schemaData []byte) error
}

Jump to

Keyboard shortcuts

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