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 ¶
const ( UsePrimaryKey = "primaryKey" UseUniqueKey = "uniqueKey" UseTenantPolicy = "tenantPolicy" UseFieldACL = "fieldACL" // entity-level, by role UseRowPolicy = "rowPolicy" // entity-level, by role UseRelationship = "relationship" )
The kinds of FieldUse: what in an entity's definition names a field.
Variables ¶
This section is empty.
Functions ¶
func FieldUses ¶ added in v0.1.21
FieldUses calls fn for every field e's definition names, in one order: its relationships' join columns on both sides (the target as resolve finds it, none when it names no single entity), its keys, its tenant policy, and its entity-level access. Grants, which name fields of the entities they are on, are their own.
func FilterFields ¶
FilterFields lists the fields a row filter (decoded YAML or JSON) names: a condition {op, field, value} names its field, an and/or those of its items, and a not those of its filter.
func Retarget ¶
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 FieldUse ¶ added in v0.1.21
type FieldUse struct {
// Entity is the ID of the entity whose field it is.
Entity, Field, Kind string
// Relationship names the relationship, for UseRelationship.
Relationship string
}
FieldUse is a field an entity's definition names: one of its own, or the target's a relationship joins on.
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.