Documentation
¶
Index ¶
Constants ¶
View Source
const ( IDKey = contract.IDKey UpdatedAtKey = "updated_at" CreatedAtKey = "created_at" )
Variables ¶
This section is empty.
Functions ¶
func Idx ¶ added in v0.0.30
func Idx() []contract.IndexEntry
func IdxSrch ¶ added in v0.0.30
func IdxSrch() []contract.SearchIndexEntry
func IdxTTL ¶ added in v0.0.54
func IdxTTL(sec int32) []contract.IndexEntry
IdxTTL returns default index entries with TTL on updated_at.
Types ¶
type Common ¶
type Common struct {
Meta `bson:",inline" validate:"recurse"`
Core `bson:",inline" validate:"recurse"`
}
Common defines shared fields for all documents.
func NewGET ¶ added in v0.0.45
func NewGET() *Common
NewGET returns a new Common object for a GET request when applying a default document.
func NewPATCH ¶ added in v0.0.17
func NewPATCH(opts NewPatchOptions) *Common
NewPATCH returns a new Common object for a PATCH request when updating an existing document.
type Commonable ¶ added in v0.0.18
type Commonable interface {
WithCommon(x Common)
}
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 (*Core) GetUpdatedAt ¶
func (*Core) SetCreatedAt ¶
func (*Core) SetUpdatedAt ¶
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]
Click to show internal directories.
Click to hide internal directories.