timeseries

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSV

type CSV struct {
	Name     string
	HasSpec  bool
	HasHead  bool
	NHeaders int
	// contains filtered or unexported fields
}

CSV gives easy access for csv writing

func (*CSV) Close

func (csv *CSV) Close()

Close flushes and closes underlying file if any

func (*CSV) SetHeaderRow

func (csv *CSV) SetHeaderRow(columns []string) error

SetHeaderRow writes header, only allows once and if specifications previously written

func (*CSV) SetSpecifications

func (csv *CSV) SetSpecifications(specs []string) error

SetSpecifications writes specifications, only allows once

func (*CSV) WriteData

func (csv *CSV) WriteData(data []string) error

WriteData writes a data row, only allows if headers have been written

type CSVCollection

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

CSVCollection hold all active csv writers

func NewCollection

func NewCollection(factory CSVFactory) CSVCollection

NewCollection returns a novel ready to use CSVCollection

func (*CSVCollection) CloseAll

func (collection *CSVCollection) CloseAll()

CloseAll closes all open streams

func (*CSVCollection) Write

func (collection *CSVCollection) Write(pkg *common.DataRecord) error

Write adds a csv row into the relevant out stream

type CSVFactory

type CSVFactory func(pkg *common.DataRecord, stream OutStream) (CSVWriter, error)

CSVFactory is a function that creates CSVWriters

type CSVWriter

type CSVWriter interface {
	Close()
	SetSpecifications(specs []string) error
	SetHeaderRow(columns []string) error
	WriteData(data []string) error
}

CSVWriter implements ease of use writing functions

func NewCSV

func NewCSV(out io.Writer, name string) CSVWriter

NewCSV returns a Timeseries CSV

type OutStream

type OutStream int

OutStream is the type for the outstream enum

const (
	// Unknown is an unregonized out stream
	Unknown OutStream = iota
	// HTR is a HTR timeseries out stream
	HTR
	// PWR is a PWR timeseries out stream
	PWR
	// CPRU is a CPRU timeseries out stream
	CPRU
	// STAT is as STAT timeseries out stream
	STAT
	// PM is a PM timeseries out stream
	PM
	// CCD is a CCD timeseries out stream
	CCD
	// TCV is a TCV timeseries out stream
	TCV
)

func OutStreamFromDataRecord

func OutStreamFromDataRecord(pkg *common.DataRecord) OutStream

OutStreamFromDataRecord infers stream based on data

func (OutStream) String

func (stream OutStream) String() string

Jump to

Keyboard shortcuts

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