Help us shape the future of Go! Take the 2026 Go Developer Survey

extensionrow

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package extensionrow validates persisted model-extension identities through the same typed owner descriptors that created them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adopt

func Adopt(registry *extensions.Registry, owner extensions.OwnerName, row Identity, parts ...string) (extensions.Subject, bool, error)

Adopt verifies a row recorded under an earlier scope of its registered owner and returns the owner's current subject for it. The row's own key must match its recorded scope and subject key, and the stored key must round trip through the current codec to the same subject key; inconsistent rows fail closed. A row is adopted only when both its recorded scope and its identity's model name belong to models the owner declares (see Registry.DeclaresModel); any other row is reported as not declared (false) and left in place.

func Restore

func Restore(registry *extensions.Registry, owner extensions.OwnerName, scope string, row Identity, parts ...string) (model.Identity, error)

func ValidKey

func ValidKey(key string) bool

Types

type Identity

type Identity struct {
	Key, Owner, Scope, SubjectKey string
	Identity                      value.JSON[model.Identity]
}

type Rows

type Rows[M any, K comparable] struct {
	// contains filtered or unexported fields
}

Rows validates persisted row identities: each row must belong to the owner's current scope, and its stored identity must derive its subject key and, with its parts such as a field and locale, its row key. A row whose stored identity is the canonical identity of the owner its subject key names needs no re-derivation, because that identity derived the key; any other row, such as one recorded under a declared storage model, is validated in full. Construction performs no I/O.

func For

func For[M any, K comparable](owner extensions.Owner[M, K], references []model.Reference[M, K]) (Rows[M, K], error)

For prepares validation of rows read for references, a bounded batch.

func ForSubject

func ForSubject[M any, K comparable](owner extensions.Owner[M, K], subject extensions.Subject) Rows[M, K]

ForSubject prepares validation of rows of one subject that owner derived, through Subject or Lock, such as the owner a write locked.

func Unknown

func Unknown[M any, K comparable](owner extensions.Owner[M, K]) Rows[M, K]

Unknown prepares validation of rows whose owners are not known in advance, such as rows a search matched; each row is validated in full.

func (Rows[M, K]) Validate

func (r Rows[M, K]) Validate(row Identity, parts ...string) error

Validate checks one row with its key parts.

Jump to

Keyboard shortcuts

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