entity

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEntityAlreadyExists = errors.New("entity already exists")
View Source
var ErrEntityNotFound = errors.New("entity not found")
View Source
var ErrIdNotEmpty = fmt.Errorf("id is not empty")
View Source
var ErrResourceIdNotEmpty = fmt.Errorf("resource id is not empty")
View Source
var ErrResourceIdNotSupported = fmt.Errorf("resource id is not supported")

Functions

This section is empty.

Types

type Entity

type Entity interface {
	GetId() Id
	SetId(Id) error
	GetResourceId() (string, error)
	SetResourceId(string) error
	PreCreate() error
	PreUpdate() error
}

type Id

type Id string

func NewIdFromObjectId

func NewIdFromObjectId(id primitive.ObjectID) Id

func NewIdFromObjectIds

func NewIdFromObjectIds(ids map[string]Id) Id

func NewIdFromString

func NewIdFromString(id string) Id

func (Id) Equals

func (i Id) Equals(i2 Id) bool

func (Id) GetCompoundIds

func (i Id) GetCompoundIds() map[string]Id

func (Id) IsCompound

func (i Id) IsCompound() bool

func (Id) IsEmpty

func (i Id) IsEmpty() bool

func (Id) String

func (i Id) String() string

func (Id) ToMustObjectId

func (i Id) ToMustObjectId() primitive.ObjectID

func (Id) TryObjectId

func (i Id) TryObjectId() *primitive.ObjectID

Jump to

Keyboard shortcuts

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