date

package
v0.1.38 Latest Latest
Warning

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

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

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 is the date after timezone override, normalization to midnight, and conversion to UTC. If no processing occurs, this field equals the Date field.
	// example:2021-01-01T00:00:00Z
	// readOnly:true
	ProcessedDate *time.Time `json:"processed_date" bson:"processed_date" validate:"nonnilpointer,nonzeropointerelem,isutc"`
	// Day is the day extracted from the normalized date.
	// example:1
	// readOnly:true
	Day *uint `json:"day" bson:"day" validate:"nonnilpointer,nonzeropointerelem,dayrange"`
	// Month is the month extracted from the normalized date.
	// example:1
	// readOnly:true
	Month *uint `json:"month" bson:"month" validate:"nonnilpointer,nonzeropointerelem,monthrange"`
	// Year is the year extracted from the normalized date.
	// example:2021
	// readOnly:true
	Year *uint `json:"year" bson:"year" validate:"nonnilpointer,nonzeropointerelem"`
	// Hour is the hour extracted from the normalized date.
	// example:0
	// readOnly:true
	Hour *uint `json:"hour" bson:"hour" validate:"nonnilpointer"`
}

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 = contract.CompOption[Comp]

func WithDay

func WithDay(day uint) CompOption

func WithHour

func WithHour(hour uint) CompOption

func WithMonth

func WithMonth(month uint) CompOption

func WithProcessedDate

func WithProcessedDate(date time.Time) CompOption

func WithProcessing

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

func WithYear

func WithYear(year uint) CompOption

type Date

type Date struct {
	Meta `bson:",inline"`
	Comp `bson:",inline"`
	// Date is the input date and time in RFC 3339 format to be processed.
	// example:2021-01-01T00:00:00Z
	// required:true
	// format:date-time
	Date *time.Time `json:"date" bson:"date" validate:"nonnilpointer,nonzeropointerelem"`
}

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

func NewDate

func NewDate(m Meta, c Comp, date time.Time) *Date

func (*Date) GetDate

func (d *Date) GetDate() time.Time

func (*Date) SetDate

func (d *Date) SetDate(x time.Time)

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