registry

package
v0.0.1-test Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CoremodelSet = wire.NewSet(
	NewBase,
)

CoremodelSet contains all of the wire-style providers related to coremodels.

Functions

This section is empty.

Types

type Base

type Base struct {
	// contains filtered or unexported fields
}

Base is a registry of coremodel.Interface. It provides two modes for accessing coremodels: individually via literal named methods, or as a slice returned from All().

Prefer the individual named methods for use cases where the particular coremodel(s) that are needed are known to the caller. For example, a dashboard linter can know that it specifically wants the dashboard coremodel.

Prefer All() when performing operations generically across all coremodels. For example, a validation HTTP middleware for any coremodel-schematized object type.

func NewBase

func NewBase() *Base

NewBase provides a registry of all coremodels, without any composition of plugin-defined schemas.

The returned registry will use the default Grafana thema.Library, defined in pkg/cuectx. If you need control over the thema.Library used by the coremodel lineages, use NewBaseWithLib instead.

func NewBaseWithLib

func NewBaseWithLib(lib thema.Library) *Base

NewBaseWithLib is the same as NewBase, but allows control over the thema.Library used to initialize the underlying coremodels.

Prefer NewBase unless you absolutely need this control.

func (*Base) All

func (b *Base) All() []coremodel.Interface

All returns a slice of all registered coremodels.

Prefer this method when operating generically across all coremodels.

The returned slice is sorted lexicographically by coremodel name. It should not be modified.

func (*Base) Dashboard

func (b *Base) Dashboard() *dashboard.Coremodel

Dashboard returns the dashboard coremodel. The return value is guaranteed to implement coremodel.Interface.

func (*Base) Playlist

func (b *Base) Playlist() *playlist.Coremodel

Playlist returns the playlist coremodel. The return value is guaranteed to implement coremodel.Interface.

func (*Base) Pluginmeta

func (b *Base) Pluginmeta() *pluginmeta.Coremodel

Pluginmeta returns the pluginmeta coremodel. The return value is guaranteed to implement coremodel.Interface.

Jump to

Keyboard shortcuts

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