period

package
v0.0.310 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeriodKey     = "period"
	PeriodYearKey = "period_year"
)
View Source
const (
	PeriodIndexKey = "period_index"
)

Variables

View Source
var (
	PeriodKeyFn     = contract.PathKeyFn(PeriodKey)
	PeriodYearKeyFn = contract.PathKeyFn(PeriodYearKey)
)
View Source
var PeriodIndexKeyFn = contract.PathKeyFn(PeriodIndexKey)

Functions

func Idx

func Idx(p ...string) []contract.IndexEntry

func IdxSrch

func IdxSrch(p ...string) []contract.SearchIndexEntry

func PeriodFromIndex added in v0.0.249

func PeriodFromIndex(idx int64) int64

func Rules

func YearFromIndex added in v0.0.249

func YearFromIndex(idx int64) int64

Types

type Comp added in v0.0.244

type Comp struct {
	PeriodIndex *int64 `json:"period_index" validate:"nnpt,nz"`
}

func (*Comp) GetPeriodIndex added in v0.0.244

func (c *Comp) GetPeriodIndex() int64

func (*Comp) SetPeriodIndex added in v0.0.244

func (c *Comp) SetPeriodIndex(x int64)

type Core

type Core struct {
	Period     *int64 `json:"period" validate:"nnpt,nz,weekrange"`
	PeriodYear *int64 `json:"period_year" validate:"nnpt,nz"`
}

func ApplyCore

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

func (*Core) GetPeriod

func (c *Core) GetPeriod() int64

func (*Core) GetPeriodYear added in v0.0.243

func (c *Core) GetPeriodYear() int64

func (*Core) SetPeriod

func (c *Core) SetPeriod(x int64)

func (*Core) SetPeriodYear added in v0.0.243

func (c *Core) SetPeriodYear(x int64)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithPeriod

func WithPeriod(x int64) CoreOption

func WithPeriodYear added in v0.0.243

func WithPeriodYear(x int64) CoreOption

type Meta

type Meta struct{}

func ApplyMeta

func ApplyMeta(m *Meta, modifiers ...MetaOption) Meta

type MetaOption

type MetaOption = contract.MetaOption[Meta]

type Period

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

Period represents a payroll period within a fiscal year typically ranging from week 1 to 53.

func FromIndex added in v0.0.249

func FromIndex(idx int64) *Period

func Mock

func Mock() *Period

func MockWithComp added in v0.0.305

func MockWithComp() *Period

func New

func New(m Meta, cr Core) *Period

func (*Period) Compute added in v0.0.244

func (r *Period) Compute(ctx context.Context) error

func (*Period) Index added in v0.0.245

func (r *Period) Index() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL