schema

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, store entity.Store) error

func IndexHash added in v0.4.0

func IndexHash() string

IndexHash computes a deterministic blake2b-256 hash of all indexed attribute IDs from the in-memory schema registry, encoded as base58. The hash changes when indexes are added or removed, enabling detection of schema changes at startup.

func Indexed

func Indexed(b *attrBuilder)

func IndexedAttributeIDs added in v0.4.0

func IndexedAttributeIDs() []entity.Id

IndexedAttributeIDs returns a sorted list of all attribute IDs that are marked as indexed in the in-memory schema registry. This inspects the attribute entities registered via Builder/Register, not etcd.

func Many

func Many(b *attrBuilder)

func Register

func Register(domain string, version string, fn func(schema *SchemaBuilder))

func RegisterEncodedSchema

func RegisterEncodedSchema(domain, version string, data []byte)

func Required

func Required(b *attrBuilder)

func Session

func Session(b *attrBuilder)

Types

type AttrOption

type AttrOption func(*attrBuilder)

func AdditionalAttrs

func AdditionalAttrs(attrs ...entity.Attr) AttrOption

func Choices

func Choices(choices ...entity.Id) AttrOption

func Doc

func Doc(doc string) AttrOption

func Tags

func Tags(tags ...string) AttrOption

type SchemaBuilder

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

func Builder

func Builder(domain, version string) *SchemaBuilder

func (*SchemaBuilder) Apply

func (b *SchemaBuilder) Apply(ctx context.Context, store entity.Store) error

func (*SchemaBuilder) Attr

func (s *SchemaBuilder) Attr(name, id string, typ entity.Id, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Bool

func (s *SchemaBuilder) Bool(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Builder

func (b *SchemaBuilder) Builder(name string) *SchemaBuilder

func (*SchemaBuilder) Bytes

func (s *SchemaBuilder) Bytes(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Component

func (s *SchemaBuilder) Component(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Duration

func (s *SchemaBuilder) Duration(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Enum

func (s *SchemaBuilder) Enum(name, id string, values any, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Float

func (s *SchemaBuilder) Float(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Id

func (b *SchemaBuilder) Id(name string) entity.Id

func (*SchemaBuilder) Int64

func (s *SchemaBuilder) Int64(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Keyword

func (s *SchemaBuilder) Keyword(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Label

func (s *SchemaBuilder) Label(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Ref

func (s *SchemaBuilder) Ref(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Singleton

func (s *SchemaBuilder) Singleton(id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) String

func (s *SchemaBuilder) String(name, id string, opts ...AttrOption) entity.Id

func (*SchemaBuilder) Time

func (s *SchemaBuilder) Time(name, id string, opts ...AttrOption) entity.Id

type SchemaRegistry

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

Jump to

Keyboard shortcuts

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