Documentation
¶
Index ¶
- type Client
- type ClientOption
- type ClientOptions
- type DefaultTool
- func (d *DefaultTool) CloneWithOffset(ctx context.Context, x int) (contract.PeriodOperator, error)
- func (d *DefaultTool) FirstDayOfMonth(ctx context.Context, date *contract.Dt) (*contract.Dt, error)
- func (d *DefaultTool) FirstPeriodStartDate(ctx context.Context, year int) (*contract.Dt, error)
- func (d *DefaultTool) LastDayOfLastPeriod(ctx context.Context, year int) (*contract.Dt, error)
- func (d *DefaultTool) PeriodBounds(ctx context.Context, date *contract.Dt) (*contract.Dt, *contract.Dt, error)
- func (d *DefaultTool) PeriodNumber(ctx context.Context, date *contract.Dt) (int, error)
- func (d *DefaultTool) TimeOfPeriodWeekday(ctx context.Context, date *contract.Dt, weekday time.Weekday) (*contract.Dt, error)
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
contract.PeriodOperator
}
func NewClient ¶
func NewClient(opts ClientOptions) Client
type ClientOption ¶ added in v0.1.6
type ClientOption func(*ClientOptions)
func WithOffset ¶
func WithOffset(x int) ClientOption
type ClientOptions ¶ added in v0.1.6
type ClientOptions struct {
Offset int
}
func ApplyClientOptions ¶ added in v0.1.6
func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions
type DefaultTool ¶ added in v0.1.11
func NewTool ¶
func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool
func (*DefaultTool) CloneWithOffset ¶ added in v0.1.631
func (d *DefaultTool) CloneWithOffset(ctx context.Context, x int) (contract.PeriodOperator, error)
CloneWithOffset creates a new clone with the specified offset.
func (*DefaultTool) FirstDayOfMonth ¶ added in v0.1.11
FirstDayOfMonth retrieves the first day of the month for the given Dt.
func (*DefaultTool) FirstPeriodStartDate ¶ added in v0.1.11
FirstPeriodStartDate retrieves the date of the first day of the first period of the given year. INFO: The first day of the first period is the Sunday immediately before the first Monday of the year (Offset = 0).
func (*DefaultTool) LastDayOfLastPeriod ¶ added in v0.1.11
LastDayOfLastPeriod retrieves the last day of the last period of the given year.
func (*DefaultTool) PeriodBounds ¶ added in v0.1.635
func (d *DefaultTool) PeriodBounds(ctx context.Context, date *contract.Dt) (*contract.Dt, *contract.Dt, error)
PeriodBounds returns UTC [start, end] (inclusive) of the 7-day period containing date.
func (*DefaultTool) PeriodNumber ¶ added in v0.1.11
PeriodNumber retrieves the period week number for the given Dt.
Click to show internal directories.
Click to hide internal directories.