date

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: Apache-2.0 Imports: 8 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"
	TimezoneKey = "timezone"
)

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 Rules added in v0.0.24

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 (*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 Core

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

func ApplyCore

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

func (*Core) GetDate

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

func (*Core) GetTimezone added in v0.0.33

func (c *Core) GetTimezone() string

func (*Core) SetDate

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

func (*Core) SetTimezone added in v0.0.33

func (c *Core) SetTimezone(x string)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithDate

func WithDate(x time.Time) CoreOption

func WithTimezone added in v0.0.33

func WithTimezone(x string) CoreOption

type Date

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

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, cr Core) *Date

func (*Date) Compute added in v0.0.33

func (d *Date) Compute(ctx context.Context, opts engine.ComputeOptions) error

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