datasource

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	v1.Datasource `json:",inline" yaml:",inline"`
}

func New

func New(name string, options ...Option) (Builder, error)

type Option

type Option func(datasource *Builder) error

func Default

func Default(isDefault bool) Option

func Name

func Name(name string) Option

func Plugin

func Plugin(plugin plugin.Plugin) Option

func ProjectName

func ProjectName(name string) Option

type Selector

type Selector struct {
	Static   *StaticSelector
	Variable *VariableSelector
}

Selector identifies a datasource either by a concrete static reference or by a Perses variable reference. Exactly one of Static or Variable must be set.

A variable selector serializes as a plain JSON/YAML string (e.g. "$myDatasource"), which Perses resolves at runtime. A static selector serializes as a structured object {"kind":"...","name":"..."}.

func NewSelector added in v0.55.0

func NewSelector(kind, name string) (*Selector, error)

NewSelector returns a Selector for name, automatically detecting whether name is a variable reference (starts with "$" or "${...}"). kind is only used for static selectors. Returns an error if name is a variable reference with an invalid name.

func NewStaticSelector added in v0.55.0

func NewStaticSelector(kind, name string) *Selector

NewStaticSelector returns a Selector for a concrete, named datasource.

func NewVariableSelector added in v0.55.0

func NewVariableSelector(name string) (*Selector, error)

NewVariableSelector returns a Selector for a Perses variable reference. name may be "foo", "$foo", or "${foo}"; Variable.Name stores the bare name without "$". Returns an error if the name is not a valid Perses variable name.

func (Selector) MarshalJSON added in v0.55.0

func (s Selector) MarshalJSON() ([]byte, error)

func (Selector) MarshalYAML added in v0.55.0

func (s Selector) MarshalYAML() (interface{}, error)

func (*Selector) UnmarshalJSON added in v0.55.0

func (s *Selector) UnmarshalJSON(data []byte) error

func (*Selector) UnmarshalYAML added in v0.55.0

func (s *Selector) UnmarshalYAML(value *yaml.Node) error

type StaticSelector added in v0.55.0

type StaticSelector struct {
	Kind string `json:"kind" yaml:"kind"`
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
}

StaticSelector identifies a concrete datasource by kind and name.

type VariableSelector added in v0.55.0

type VariableSelector struct {
	Name string
}

VariableSelector identifies a datasource via a Perses variable reference. Name holds the bare variable name without the leading "$".

Jump to

Keyboard shortcuts

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