duration

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package duration copied as it is from github.com/senseyeio/duration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration interface {
	Add(t time.Time) time.Time
	Sub(t time.Time) time.Time
}

func ParseISO8601

func ParseISO8601(from string) (Duration, error)

ParseISO8601 parses an ISO8601 duration as well as some Rill-specific extensions. (Section 3.7 of the standard supposedly allows extensions that do not interfere with the standard.) Current extensions are, 1. "inf" for representing an unbounded duration of time 2. X-To-Date and Previous-X duration supports with a prefix of "rill-" to DAX notations. Pulled from https://www.daxpatterns.com/standard-time-related-calculations/

type InfDuration added in v0.37.0

type InfDuration struct{}

func (InfDuration) Add added in v0.37.0

func (d InfDuration) Add(t time.Time) time.Time

func (InfDuration) Sub added in v0.37.0

func (d InfDuration) Sub(t time.Time) time.Time

type StandardDuration added in v0.37.0

type StandardDuration struct {
	// Date component
	Year  int
	Month int
	Week  int
	Day   int
	// Time Component
	Hour   int
	Minute int
	Second int
}

StandardDuration represents an ISO8601 duration with Rill-specific extensions. See ParseISO8601 for details.

func (StandardDuration) Add added in v0.37.0

func (d StandardDuration) Add(t time.Time) time.Time

Add adds the duration to a timestamp

func (StandardDuration) Sub added in v0.37.0

func (d StandardDuration) Sub(t time.Time) time.Time

Sub subtracts the duration from a timestamp

type TruncToDateDuration added in v0.37.0

type TruncToDateDuration struct {
	// contains filtered or unexported fields
}

func (TruncToDateDuration) Add added in v0.37.0

func (TruncToDateDuration) Sub added in v0.37.0

Jump to

Keyboard shortcuts

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