referenceindex

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package referenceindex derives and reconciles current relationship and upload references from canonical store values. It is shared by official stores so the strict test adapter and PostgreSQL cannot silently diverge.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindReferenceField

func FindReferenceField(collection schema.Collection, fieldID schema.StableID) (reference schema.Field, root schema.Field, found bool)

FindReferenceField locates a relationship/upload field and its stored root field by stable ID.

func NullifyField

func NullifyField(field schema.Field, value store.Value, target store.DocumentReference, locale schema.LocaleCode) (store.Value, bool, error)

func NullifyTarget

func NullifyTarget(collection schema.Collection, values store.Values, target store.DocumentReference) (store.Values, bool, error)

func ReferenceFieldIDs

func ReferenceFieldIDs(root schema.Field) []schema.StableID

ReferenceFieldIDs returns every relationship/upload field ID beneath one stored root field.

func RemoveResourceTargets

func RemoveResourceTargets(collection schema.Collection, values store.Values, resources []schema.StableID) (store.Values, bool, error)

func TargetsAnyResource

func TargetsAnyResource(collection schema.Collection, resourceIDs []schema.StableID) bool

TargetsAnyResource reports whether the collection's current reference or upload topology can address one of the supplied resource IDs. Migration rollback uses this to purge version snapshots that could otherwise restore an identity after its resource is reintroduced.

Types

type Entry

type Entry struct {
	Owner      store.DocumentReference
	FieldID    schema.StableID
	Target     store.DocumentReference
	Locale     schema.LocaleCode
	Occurrence int
}

Entry is one current reference occurrence owned by a document. Occurrence is deterministic within the owner/field/target/locale tuple and permits duplicate list members without collapsing the derived index.

func Collect

func Collect(collection schema.Collection, document store.Document) ([]Entry, error)

Collect validates the complete declared envelope before deriving any index entries. A malformed or over-budget tree must never yield a partial index.

func CollectField

func CollectField(owner store.DocumentReference, field schema.Field, value store.Value, locale schema.LocaleCode) ([]Entry, error)

Jump to

Keyboard shortcuts

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