datavalues

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package datavalues integrates the schema and data values features into the workspace, providing a means of "addressing" to specific libraries.

Index

Constants

View Source
const (
	// AnnotationDataValues is the name of the annotation that marks a YAML document as a "Data Values" overlay.
	AnnotationDataValues template.AnnotationName = "data/values"

	// AnnotationDataValuesSchema is the name of the annotation that marks a YAML document as a "Data Values Schema"
	// overlay.
	AnnotationDataValuesSchema template.AnnotationName = "data/values-schema"
)

Variables

This section is empty.

Functions

func NewEmptyDataValuesDocument

func NewEmptyDataValuesDocument() *yamlmeta.Document

NewEmptyDataValuesDocument produces a YAML document that contains an empty map: the expected result when no data values are specified.

Types

type Envelope

type Envelope struct {
	Doc         *yamlmeta.Document
	AfterLibMod bool
	// contains filtered or unexported fields
}

Envelope wraps a YAML document containing Data Values along with addressing and usage bookkeeping — for which workspace.Library are these Data Values is intended.

func NewEmptyEnvelope

func NewEmptyEnvelope() *Envelope

NewEmptyEnvelope constructs a new Envelope that contains no Data Values.

func NewEnvelope

func NewEnvelope(doc *yamlmeta.Document) (*Envelope, error)

NewEnvelope generates a new Envelope from a YAML document containing Data Values, extracting "addressing" from any ref.LibraryRef annotated on the document.

func NewEnvelopeWithLibRef

func NewEnvelopeWithLibRef(doc *yamlmeta.Document, libRefStr string) (*Envelope, error)

NewEnvelopeWithLibRef constructs a new Envelope using the given library reference for "addressing" If libRefStr is empty string, then the Envelope has no "addressing"

func (*Envelope) Desc

func (dvd *Envelope) Desc() string

Desc reports the destination library of this Envelope

func (*Envelope) IntendedForAnotherLibrary

func (dvd *Envelope) IntendedForAnotherLibrary() bool

IntendedForAnotherLibrary indicates whether this Envelope is "addressed" to some other library.

func (*Envelope) IsUsed

func (dvd *Envelope) IsUsed() bool

IsUsed reports whether this Envelope of Data Values has been "delivered"/used.

func (*Envelope) UsedInLibrary

func (dvd *Envelope) UsedInLibrary(expectedRefPiece ref.LibraryRef) *Envelope

UsedInLibrary marks this Envelope as "delivered"/used if its destination is included in expectedRefPiece.

If the Envelope should be used exactly in the specified library, returns a copy of this Envelope with no addressing (i.e. IntendedForAnotherLibrary() will indicate true). If the Envelope should be used in a _child_ of the specified library, returns a copy of this Envelope with the address of _that_ library. If the Envelope should **not** be used in the specified library or child, returns nil

type ExtractLibRefs

type ExtractLibRefs interface {
	FromStr(string) ([]ref.LibraryRef, error)
	FromAnnotation(template.NodeAnnotations) ([]ref.LibraryRef, error)
}

ExtractLibRefs constructs library references (ref.LibraryRef) from various sources.

type Schema

type Schema struct {
	Source *yamlmeta.Document

	DocType *schema.DocumentType
	// contains filtered or unexported fields
}

Schema is a definition of types and default values for Envelope.

func NewNullSchema

func NewNullSchema() *Schema

NewNullSchema provides the "Null Object" value of Schema. This is used in the case where no schema was provided.

func NewSchema

func NewSchema(doc *yamlmeta.Document) (*Schema, error)

NewSchema calculates a Schema from a YAML document containing schema.

func (*Schema) AssignType

func (s *Schema) AssignType(doc *yamlmeta.Document) schema.TypeCheck

AssignType decorates `doc` with type metadata sourced from this Schema. If `doc` does not conform to the AST structure of this Schema, the returned TypeCheck contains the violations. No other type check is performed.

func (*Schema) DeepCopy

func (s *Schema) DeepCopy() *Schema

DeepCopy produces a complete copy of this Schema.

func (*Schema) DefaultDataValues

func (s *Schema) DefaultDataValues() *yamlmeta.Document

DefaultDataValues returns a copy of the default values declared in this Schema.

func (*Schema) GetDocumentType

func (s *Schema) GetDocumentType() *schema.DocumentType

GetDocumentType returns a reference to the DocumentType that is the root of this Schema.

type SchemaEnvelope

type SchemaEnvelope struct {
	Doc *Schema
	// contains filtered or unexported fields
}

SchemaEnvelope is addressing and usage bookkeeping for a Schema — for which library this Schema is intended.

func NewSchemaEnvelope

func NewSchemaEnvelope(doc *yamlmeta.Document) (*SchemaEnvelope, error)

NewSchemaEnvelope generates a new Schema wrapped in a SchemaEnvelope form a YAML document containing schema.

func (*SchemaEnvelope) Desc

func (e *SchemaEnvelope) Desc() string

Desc reports which library the contained Schema is intended.

func (*SchemaEnvelope) IntendedForAnotherLibrary

func (e *SchemaEnvelope) IntendedForAnotherLibrary() bool

IntendedForAnotherLibrary indicates whether the contained Schema is addressed to another library.

func (*SchemaEnvelope) IsUsed

func (e *SchemaEnvelope) IsUsed() bool

IsUsed reports whether or not the contained Schema was delivered/consumed.

func (*SchemaEnvelope) Source

func (e *SchemaEnvelope) Source() *yamlmeta.Document

Source yields the original YAML document used to construct this SchemaEnvelope.

func (*SchemaEnvelope) UsedInLibrary

func (e *SchemaEnvelope) UsedInLibrary(expectedRefPiece ref.LibraryRef) (*SchemaEnvelope, bool)

UsedInLibrary marks this SchemaEnvelope as "delivered"/used if its destination is included in expectedRefPiece.

If the SchemaEnvelope should be used exactly in the specified library, returns a copy of this SchemaEnvelope with no addressing and true. If the SchemaEnvelope should be used in a _child_ of the specified library, returns a copy of this SchemaEnvelope with the address of _that_ library and true. If the SchemaEnvelope should **not** be used in the specified library or child, returns nil and false.

Jump to

Keyboard shortcuts

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