periods

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeriodIndexesKey = "period_indexes"
)
View Source
const (
	PeriodsKey = "periods"
)

Variables

View Source
var PeriodIndexesKeyFn = contract.PathKeyFn(PeriodIndexesKey)

Functions

func Idx

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

func IdxSrch

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

func Rules

Types

type Comp

type Comp struct {
	PeriodIndexes *[]int64 `json:"period_indexes" validate:"nnpt,nz"`
}

func (*Comp) GetPeriodIndexes

func (c *Comp) GetPeriodIndexes() []int64

func (*Comp) SetPeriodIndexes

func (c *Comp) SetPeriodIndexes(x []int64)

type Core

type Core struct {
	Periods *[]period.Period `json:"periods" validate:"nnpt,nz"`
}

func ApplyCore

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

func (*Core) GetPeriods

func (c *Core) GetPeriods() []period.Period

func (*Core) SetPeriods

func (c *Core) SetPeriods(x []period.Period)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithPeriods

func WithPeriods(x []period.Period) CoreOption

type Meta

type Meta struct{}

func ApplyMeta

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

type MetaOption

type MetaOption = contract.MetaOption[Meta]

type Periods

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

Periods represents a set of periods.

func Mock

func Mock() *Periods

func MockWithComp added in v0.0.307

func MockWithComp() *Periods

func New

func New(m Meta, cr Core) *Periods

func (*Periods) Compute

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

func (*Periods) Normalize

func (r *Periods) Normalize()

Normalize deduplicates and sorts the stored periods by year and period.

func (*Periods) PeriodIndexStrings added in v0.0.246

func (r *Periods) PeriodIndexStrings() []string

PeriodIndexStrings returns indexes as a slice of strings.

Jump to

Keyboard shortcuts

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