timetable

package module
v0.0.1-dev.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 5 Imported by: 0

README

timetable

A data structure for columns of type Value any where each row is associated with a time.Time

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell[Value any] struct {
	// contains filtered or unexported fields
}

func NewCell

func NewCell[Value any](time time.Time, value Value) Cell[Value]

func (Cell[Value]) GoString

func (c Cell[Value]) GoString() string

func (Cell[Value]) MarshalJSON

func (c Cell[Value]) MarshalJSON() ([]byte, error)

func (Cell[Value]) Time

func (c Cell[Value]) Time() time.Time

func (*Cell[Value]) UnmarshalJSON

func (c *Cell[Value]) UnmarshalJSON(buf []byte) error

func (Cell[Value]) Value

func (c Cell[Value]) Value() Value

type Compact

type Compact[Value any] struct {
	// contains filtered or unexported fields
}

func New

func New[Value any](columns ...List[Value]) *Compact[Value]

func (*Compact[Value]) AddColumn

func (table *Compact[Value]) AddColumn(list List[Value], missing func(time.Time) Value) *Compact[Value]

func (*Compact[Value]) AddColumnFillMissingWithZero

func (table *Compact[Value]) AddColumnFillMissingWithZero(list List[Value]) *Compact[Value]

func (*Compact[Value]) Between

func (table *Compact[Value]) Between(t0, t1 time.Time) *Compact[Value]

func (*Compact[Value]) Column

func (table *Compact[Value]) Column(column int) (List[Value], bool)

func (*Compact[Value]) FirstTime

func (table *Compact[Value]) FirstTime() time.Time

func (*Compact[Value]) LastTime

func (table *Compact[Value]) LastTime() time.Time

func (*Compact[Value]) MarshalJSON

func (table *Compact[Value]) MarshalJSON() ([]byte, error)

func (*Compact[Value]) NumberOfCells

func (table *Compact[Value]) NumberOfCells() int

func (*Compact[Value]) NumberOfColumns

func (table *Compact[Value]) NumberOfColumns() int

func (*Compact[Value]) NumberOfRows

func (table *Compact[Value]) NumberOfRows() int

func (*Compact[Value]) Row

func (table *Compact[Value]) Row(t time.Time) ([]Value, bool)

func (*Compact[Value]) Times

func (table *Compact[Value]) Times() []time.Time

func (*Compact[Value]) UnderlyingTimes

func (table *Compact[Value]) UnderlyingTimes() []time.Time

func (*Compact[Value]) UnderlyingValues

func (table *Compact[Value]) UnderlyingValues() [][]Value

func (*Compact[Value]) UnmarshalJSON

func (table *Compact[Value]) UnmarshalJSON(buf []byte) error

func (*Compact[Value]) Values

func (table *Compact[Value]) Values() [][]Value

type List

type List[Value any] []Cell[Value]

func (List[Value]) Between

func (list List[Value]) Between(t0, t1 time.Time) List[Value]

Between returns a slice of a list. You may want pass result into slices.Clone() before using any mutating functions (such as Insert).

func (List[Value]) FirstTime

func (list List[Value]) FirstTime() time.Time

func (List[Value]) LastTime

func (list List[Value]) LastTime() time.Time

Jump to

Keyboard shortcuts

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