entity

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

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{}

func ApplyComp

func ApplyComp(c *Comp, modifiers ...CompOption) Comp

type CompOption

type CompOption = contract.CompOption[Comp]

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"`
	Comp `bson:",inline"`
	Core `bson:",inline"`
}

Entity represents an entity with its authorization data.

func NewEntity

func NewEntity(m Meta, c Comp, cr Core) (*Entity, error)

func (*Entity) GetID added in v0.0.11

func (r *Entity) GetID() contract.ID

func (*Entity) Owners added in v0.0.11

func (r *Entity) Owners() []contract.ID

func (*Entity) Readers added in v0.0.11

func (r *Entity) Readers() []contract.ID

func (*Entity) Rules added in v0.0.11

func (r *Entity) Rules() contract.QueryParamRules

func (*Entity) Scope added in v0.0.11

func (r *Entity) Scope() contract.Scope

func (*Entity) SearchIn added in v0.0.11

func (r *Entity) SearchIn() []string

func (*Entity) SortBy added in v0.0.11

func (r *Entity) SortBy() string

func (*Entity) Writers added in v0.0.11

func (r *Entity) Writers() []contract.ID

type Meta

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

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