entity

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	ID        ids.ID    `json:"id" bson:"_id"`
	CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
	Version   int       `json:"version" bson:"version"`
	Tenant    string    `json:"tenant,omitempty" bson:"tenant,omitempty"`
}

Metadata is the metadata for any entity.

func New

func New() Metadata

func NewAt

func NewAt(now time.Time) Metadata

func NewIn added in v0.8.0

func NewIn(ctx context.Context) Metadata

NewIn creates a new entity with the given context.

func NewInAt added in v0.8.0

func NewInAt(ctx context.Context, now time.Time) Metadata

NewInAt creates a new entity with the given context and time.

func (Metadata) Clone

func (e Metadata) Clone(now time.Time) Metadata

Clone returns a clone of the entity with a new ID and CreatedAt if necessary. Updates UpdatedAt.

func (Metadata) CloneIn added in v0.8.1

func (e Metadata) CloneIn(ctx context.Context, now time.Time) Metadata

func (Metadata) GetID

func (e Metadata) GetID() ids.ID

GetID returns the ID of the entity. Implements Identifiable interfaces.

func (Metadata) GetTenant added in v0.8.2

func (e Metadata) GetTenant() string

Jump to

Keyboard shortcuts

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