cuectx

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONtoCUE

func JSONtoCUE(path string, b []byte) (cue.Value, error)

JSONtoCUE attempts to decode the given []byte into a cue.Value, relying on the central Grafana cue.Context provided in this package.

The provided path argument determines the name given to the input bytes if later CUE operations (e.g. Thema validation) produce errors related to the returned cue.Value.

This is a convenience function for one-off JSON decoding. It's wasteful to call it repeatedly. Most use cases use cases should probably prefer making their own Thema/CUE decoders.

func LoadGrafanaInstancesWithThema

func LoadGrafanaInstancesWithThema(path string, cueFS fs.FS, lib thema.Library, opts ...thema.BindOption) (thema.Lineage, error)

LoadGrafanaInstancesWithThema loads CUE files containing a lineage representing some Grafana core model schema. It is expected to be used when implementing a thema.LineageFactory.

This function primarily juggles paths to make CUE's loader happy. Provide the path from the grafana root to the directory containing the lineage.cue. The lineage.cue file must be the sole contents of the provided fs.FS.

More details on underlying behavior can be found in the docs for github.com/grafana/thema/load.InstancesWithThema.

TODO this approach is complicated and confusing, refactor to something understandable

func ProvideCUEContext

func ProvideCUEContext() *cue.Context

ProvideCUEContext is a wire service provider of a central cue.Context.

func ProvideThemaLibrary

func ProvideThemaLibrary() thema.Library

ProvideThemaLibrary is a wire service provider of a central thema.Library.

Types

This section is empty.

Jump to

Keyboard shortcuts

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