datetime

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datetime

type Datetime struct {
	Day   int
	Month int
	Year  int
	// contains filtered or unexported fields
}

Datetime is a simple time construct, that is either the start point or the end point for a chart time-series.

func FromUnix

func FromUnix(timestamp int) *Datetime

FromUnix returns a new instance of Datetime from a unix timestamp.

func New

func New(t *time.Time) *Datetime

New creates a new instance of Datetime from a go time struct.

func (*Datetime) Time

func (d *Datetime) Time() *time.Time

Time returns a go time struct from a datetime.

func (*Datetime) Unix

func (d *Datetime) Unix() int

Unix returns a valid unix timestamp from Datetime fields.

type Interval

type Interval string

Interval is the aggregation of each chart bar.

const (
	// OneMin interval of 1 minute.
	OneMin Interval = "1m"
	// TwoMins interval of 2 minutes.
	TwoMins Interval = "2m"
	// FiveMins interval of 5 minutes.
	FiveMins Interval = "5m"
	// FifteenMins interval of 15 minutes.
	FifteenMins Interval = "15m"
	// ThirtyMins interval of thirty minutes.
	ThirtyMins Interval = "30m"
	// SixtyMins interval of 60 minutes.
	SixtyMins Interval = "60m"
	// NinetyMins interval of 90 minutes.
	NinetyMins Interval = "90m"
	// OneHour interval of 1 hour.
	OneHour Interval = "1h"
	// OneDay interval of 1 day.
	OneDay Interval = "1d"
	// FiveDay interval of 5 days.
	FiveDay Interval = "5d"
	// OneMonth interval of 1 month.
	OneMonth Interval = "1mo"
	// ThreeMonth interval of 3 months.
	ThreeMonth Interval = "3mo"
	// SixMonth interval of 6 months.
	SixMonth Interval = "6mo"
	// OneYear interval of 1 year.
	OneYear Interval = "1y"
	// TwoYear interval of 2 years.
	TwoYear Interval = "2y"
	// FiveYear interval of 5 years.
	FiveYear Interval = "5y"
	// TenYear interval of 10 years.
	TenYear Interval = "10y"
	// YTD interval of year-to-date.
	YTD Interval = "ytd"
	// Max interval.
	Max Interval = "max"
)

Jump to

Keyboard shortcuts

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