date

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DayKey           = "day"
	MonthKey         = "month"
	YearKey          = "year"
	HourKey          = "hour"
	ProcessedDateKey = "processed_date"
)
View Source
const (
	DateKey = "date"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Comp

type Comp struct {
	ProcessedDate *time.Time `json:"processed_date" validate:"nnpt,nz,utc"`
	Day           *uint      `json:"day" validate:"nnpt,nz,dayrange"`
	Month         *uint      `json:"month" validate:"nnpt,nz,monthrange"`
	Year          *uint      `json:"year" validate:"nnpt,nz"`
	Hour          *uint      `json:"hour" validate:"nnpt"`
}

func ApplyComp

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

func (*Comp) GetDay

func (c *Comp) GetDay() uint

func (*Comp) GetHour

func (c *Comp) GetHour() uint

func (*Comp) GetMonth

func (c *Comp) GetMonth() uint

func (*Comp) GetProcessedDate

func (c *Comp) GetProcessedDate() time.Time

func (*Comp) GetYear

func (c *Comp) GetYear() uint

func (*Comp) SetDay

func (c *Comp) SetDay(x uint)

func (*Comp) SetHour

func (c *Comp) SetHour(x uint)

func (*Comp) SetMonth

func (c *Comp) SetMonth(x uint)

func (*Comp) SetProcessedDate

func (c *Comp) SetProcessedDate(x time.Time)

func (*Comp) SetYear

func (c *Comp) SetYear(x uint)

type CompOption

type CompOption = contracti.CompOption[Comp]

func WithDay

func WithDay(x uint) CompOption

func WithHour

func WithHour(x uint) CompOption

func WithMonth

func WithMonth(x uint) CompOption

func WithProcessedDate

func WithProcessedDate(x time.Time) CompOption

func WithProcessing

func WithProcessing(timezone string, toUTC, toMidnight bool, originalDate time.Time, c contract.Geocoder) (CompOption, error)

func WithYear

func WithYear(x uint) CompOption

type Core

type Core struct {
	Date *time.Time `json:"date" validate:"nnpt,nz"`
}

func ApplyCore

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

func (*Core) GetDate

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

func (*Core) SetDate

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

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithDate

func WithDate(x time.Time) CoreOption

type Date

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

Date represents a date optimized for handling multiple time zones, and query parameter filtering.

func New added in v0.0.15

func New(m Meta, c Comp, cr Core) *Date

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