common

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDKey        = "_id"
	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"`
	// ID is the identifier for the document.
	// example:123e4567-e89b-12d3-a456-426655440000
	// readOnly:true
	ID *contract.ID `bson:"id" json:"id"`
	// UpdatedAt is the last update time of the document in UTC.
	// example:2020-10-05T10:00:00Z
	// readOnly:true
	// format:date-time
	UpdatedAt *time.Time `bson:"updated_at" json:"updated_at" validate:"nonnilpointer,nonzeropointerelem"`
	// CreatedAt is the creation time of the document in UTC.
	// example:2020-10-05T10:00:00Z
	// readOnly:true
	// format:date-time
	CreatedAt *time.Time `bson:"created_at" json:"created_at" validate:"nonnilpointer,nonzeropointerelem"`
}

Common defines shared fields for all documents. swagger:model

func NewCommon

func NewCommon(m Meta, c Comp, id contract.ID, updatedAt, createdAt time.Time) *Common

func (*Common) GetCreatedAt

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

func (*Common) GetID

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

func (*Common) GetUpdatedAt

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

func (*Common) SetCreatedAt

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

func (*Common) SetID

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

func (*Common) SetUpdatedAt

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

type Comp

type Comp struct{}

func ApplyComp

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

type CompOption

type CompOption = contract.CompOption[Comp]

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