registry

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(d EntityDescriptor)

Register adds a descriptor to the global registry. Panics on empty Kind or duplicate Kind.

func Reset

func Reset()

Reset clears all registrations. Only for use in tests.

func Validate

func Validate()

Validate checks registry integrity. Panics on:

  • empty Kind or Plural on any descriptor
  • any ParentKind that references an unregistered kind
  • duplicate Plural values across descriptors

Types

type EntityDescriptor

type EntityDescriptor struct {
	Kind                   string               // discriminator value stored in Resource.Kind
	Plural                 string               // URL path segment, e.g. "channels"
	ParentKind             string               // "" for top-level entities
	SpecSchemaName         string               // OpenAPI component name for spec validation
	OnParentDelete         OnParentDeletePolicy // only meaningful when ParentKind != ""
	SearchDisallowedFields []string             // fields blocked from TSL search
}

EntityDescriptor defines everything specific to a HyperFleet entity type. Descriptors are registered at startup via Register() in plugin init() functions.

func All

func All() []EntityDescriptor

All returns a snapshot of all registered descriptors.

func ChildrenOf

func ChildrenOf(parentKind string) []EntityDescriptor

ChildrenOf returns descriptors whose ParentKind matches the given kind.

func Get

func Get(entityKind string) (EntityDescriptor, bool)

Get returns a descriptor by Kind, or (zero, false) if not found.

func MustGet

func MustGet(entityKind string) EntityDescriptor

MustGet returns a descriptor by Kind. Panics if not found.

type OnParentDeletePolicy

type OnParentDeletePolicy string

OnParentDeletePolicy determines child behavior when its parent is deleted.

const (
	OnParentDeleteRestrict OnParentDeletePolicy = "restrict"
	OnParentDeleteCascade  OnParentDeletePolicy = "cascade"
)

Jump to

Keyboard shortcuts

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