entity

package
v0.0.310 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	EntityIDKey = "entity_id"
	ReadersKey  = "readers"
	WritersKey  = "writers"
	OwnersKey   = "owners"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Comp

type Comp struct{}

type Core

type Core struct {
	EntityID *contract.ID    `json:"entity_id" validate:"nnpt,nz"`
	Readers  *[]*contract.ID `json:"readers" validate:"nnpt,nz"`
	Writers  *[]*contract.ID `json:"writers" validate:"nnpt,nz"`
	Owners   *[]*contract.ID `json:"owners" validate:"nnpt,nz"`
}

func ApplyCore

func ApplyCore(c *Core, modifiers ...CoreOption) Core

func (*Core) GetEntityID

func (c *Core) GetEntityID() contract.ID

func (*Core) GetOwners

func (c *Core) GetOwners() []*contract.ID

func (*Core) GetReaders

func (c *Core) GetReaders() []*contract.ID

func (*Core) GetWriters

func (c *Core) GetWriters() []*contract.ID

func (*Core) SetEntityID

func (c *Core) SetEntityID(x contract.ID)

func (*Core) SetOwners

func (c *Core) SetOwners(x []*contract.ID)

func (*Core) SetReaders

func (c *Core) SetReaders(x []*contract.ID)

func (*Core) SetWriters

func (c *Core) SetWriters(x []*contract.ID)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithEntityID

func WithEntityID(x contract.ID) CoreOption

func WithOwners

func WithOwners(x []*contract.ID) CoreOption

func WithReaders

func WithReaders(x []*contract.ID) CoreOption

func WithWriters

func WithWriters(x []*contract.ID) CoreOption

type Entity

type Entity struct {
	Meta `bson:",inline" validate:"recurse"`
	Comp `bson:",inline" validate:"recurse"`
	Core `bson:",inline" validate:"recurse"`
}

Entity represents an entity with its authorization data.

func Mock added in v0.0.42

func Mock() *Entity

func New added in v0.0.15

func New(m Meta, cr Core) *Entity

type Meta

type Meta struct {
	common.Common `bson:",inline" validate:"recurse"`
}

func ApplyMeta

func ApplyMeta(m *Meta, modifiers ...MetaOption) Meta

type MetaOption

type MetaOption = contract.MetaOption[Meta]

func WithCommon

func WithCommon(x common.Common) MetaOption

Jump to

Keyboard shortcuts

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