configrefs

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package configrefs holds the rules for references among a configuration's entities as entities change: what an existing reference names afterwards and how it is written. The console's edits (x/admin/configapp) and plans (x/configplan) apply the same rules, each over its own representation.

The rule: a reference keeps naming the entity it named before the change, in its shortest unambiguous form when it no longer names it alone; a reference to a removed entity goes; one that named no single entity before stays as it was.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterFields

func FilterFields(v any) []string

FilterFields lists the fields a row filter (decoded YAML or JSON) names: a condition {op, field, value} names its field, and an and/or names those of its items.

func Retarget

func Retarget(ref string, before, after Index, moved map[string]string) (out string, keep bool)

Retarget is what the existing reference ref becomes once the entities changed from before to after; moved maps the IDs of renamed or moved entities to their new IDs, and of removed ones to "" (needed when another entity takes over the ID). keep is false when ref named an entity that is gone: the reference goes with it.

Types

type Index

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

Index resolves references among a set of entities.

func NewIndex

func NewIndex(entities []config.EntityConfig) Index

NewIndex indexes entities; only their names, datasources and schemas matter.

func (Index) Has

func (x Index) Has(id string) bool

Has reports whether an entity has the ID id.

func (Index) IDOf

func (x Index) IDOf(ref string) (string, bool)

IDOf is the ID of the one entity ref names.

func (Index) ShortName

func (x Index) ShortName(id string) string

ShortName is the shortest reference naming the entity id alone (its ID when none does, or when there is no such entity).

Jump to

Keyboard shortcuts

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