dapegen

package module
v0.0.0-...-a9899ec Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2013 License: BSD-3-Clause Imports: 3 Imported by: 0

README

dapegen

DAte PEriod GEnerator - Golang library to process date period intervals

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GROUP

type GROUP int

Grouping enum

const (
	DAY GROUP = iota
	WEEK
	MONTH
)

type Generator

type Generator struct {
	StartDate      epochdate.Date
	EndDate        epochdate.Date
	Group          GROUP
	FirstDate      epochdate.Date
	LastDate       epochdate.Date
	CurrentDate    epochdate.Date
	FirstDayOfWeek time.Weekday
	// contains filtered or unexported fields
}

Generator object

func NewGenerator

func NewGenerator(startdate epochdate.Date, enddate epochdate.Date, group GROUP) (*Generator, error)

Creates a forward generator

func NewGeneratorBackwards

func NewGeneratorBackwards(startdate epochdate.Date, enddate epochdate.Date, group GROUP) (*Generator, error)

Creates a backwards generator

func (Generator) FirstFromDate

func (d Generator) FirstFromDate(date epochdate.Date) epochdate.Date

returns the first day from the date, depending on the group

func (*Generator) IsFinished

func (d *Generator) IsFinished() bool

Returns if is finished

func (*Generator) Next

func (d *Generator) Next() bool

Generates the next period, returns false if finished

func (*Generator) NextUntil

func (d *Generator) NextUntil(date epochdate.Date) bool

Generates the next period until the passed date, returns if have next

func (*Generator) NextUntilOrFinished

func (d *Generator) NextUntilOrFinished(date epochdate.Date) (havenext bool, isfinished bool)

Generates the next period until the passed date, returns if have next or finished

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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