common

package
v0.0.10 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: 1

Documentation

Index

Constants

View Source
const (
	IDKey        = contract.IDKey
	UpdatedAtKey = "updated_at"
	CreatedAtKey = "created_at"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Common

type Common struct {
	Meta `bson:",inline"`
	Comp `bson:",inline"`
	Core `bson:",inline"`
}

Common defines shared fields for all documents.

func NewCommon

func NewCommon(m Meta, c Comp, cr Core) *Common

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 {
	ID        *contract.ID `json:"id"`
	UpdatedAt *time.Time   `json:"updated_at" validate:"nnpt,nz"`
	CreatedAt *time.Time   `json:"created_at" validate:"nnpt,nz"`
}

func ApplyCore

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

func (*Core) GetCreatedAt

func (c *Core) GetCreatedAt() time.Time

func (*Core) GetID

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

func (*Core) GetUpdatedAt

func (c *Core) GetUpdatedAt() time.Time

func (*Core) SetCreatedAt

func (c *Core) SetCreatedAt(x time.Time)

func (*Core) SetID

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

func (*Core) SetUpdatedAt

func (c *Core) SetUpdatedAt(x time.Time)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithCreatedAt

func WithCreatedAt(x time.Time) CoreOption

func WithID

func WithID(x contract.ID) CoreOption

func WithUpdatedAt

func WithUpdatedAt(x time.Time) CoreOption

type Meta

type Meta struct{}

func ApplyMeta

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

type MetaOption

type MetaOption = contract.MetaOption[Meta]

Jump to

Keyboard shortcuts

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