output

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFileMode      = 0644
	DateTimeLayout       = "2006/01/02 15:04:05"
	DateTimeSearchLayout = "2006-01-02 15:04:05"
)
View Source
const (
	TypeNone  = iota
	TypeJson  = iota
	TypeFile  = iota
	TypeRaw   = iota
	TypeHuman = iota
	TypeGraph = iota

	StringTypeNone  = ""
	StringTypeJson  = "json"
	StringTypeFile  = "file"
	StringTypeRaw   = "raw"
	StringTypeHuman = "human"
	StringTypeGraph = "graph"
)

Variables

This section is empty.

Functions

func DirectoryRead

func DirectoryRead(dir string, glob string) ([]string, error)

DirectoryRead -

func FileRead

func FileRead(fn string, ref interface{}) error

FileRead Retrieves data from a local file.

func FileRemove

func FileRemove(fn string) error

FileRemove Removes a file path.

func FileWrite

func FileWrite(fn string, ref interface{}, perm os.FileMode) error

FileWrite Saves data to a file path.

func GetAsString

func GetAsString(r interface{}) string

func GetEndPointString

func GetEndPointString(r interface{}) string

func GetRequestString

func GetRequestString(r interface{}) string

func PlainFileRead

func PlainFileRead(fn string) ([]byte, error)

PlainFileRead Retrieves data from a local file.

func PlainFileWrite

func PlainFileWrite(fn string, data []byte, perm os.FileMode) error

PlainFileWrite Saves data to a file path.

func SetFloat

func SetFloat(v float64) *float64

func SetInteger

func SetInteger(v int) *int

func SetString

func SetString(v string) *string

Types

type Chart

type Chart struct {
	Error error `json:"-"`
	// contains filtered or unexported fields
}

func New

func New(title string) *Chart

func (*Chart) Generate

func (c *Chart) Generate() error

func (*Chart) SetFilename

func (c *Chart) SetFilename(fn string) error

func (*Chart) SetGraphSearch

func (c *Chart) SetGraphSearch(req GraphRequest) bool

func (*Chart) SetHeight

func (c *Chart) SetHeight(v *int)

func (*Chart) SetRangeY

func (c *Chart) SetRangeY(min *float64, max *float64) bool

func (*Chart) SetTitle

func (c *Chart) SetTitle(fn string) error

func (*Chart) SetWidth

func (c *Chart) SetWidth(v *int)

func (*Chart) SetX

func (c *Chart) SetX(name string, values ...time.Time) error

func (*Chart) SetY

func (c *Chart) SetY(name string, values ...float64) error

func (*Chart) SetY2

func (c *Chart) SetY2(name string, values ...float64) error

type DataRow

type DataRow map[string]string

type DataSet

type DataSet []DataRow

type GraphRequest

type GraphRequest struct {
	Title string `json:"title"`

	TimeColumn   *int    `json:"time_column"`
	ValueColumn  *int    `json:"value_column"`
	UnitsColumn  *int    `json:"units_column"`
	NameColumn   *int    `json:"name_column"`
	SearchColumn *int    `json:"search_column"`
	SearchString *string `json:"search_string"`

	MinLeftAxis *float64 `json:"min_left_axis"`
	MaxLeftAxis *float64 `json:"max_left_axis"`

	Width  *int `json:"width"`
	Height *int `json:"height"`

	Error error `json:"-"`
}

func JsonToGraphRequest

func JsonToGraphRequest(j Json) GraphRequest

type Json

type Json string

func GetAsJson

func GetAsJson(r interface{}) Json

func GetAsPrettyJson

func GetAsPrettyJson(r interface{}) Json

func (Json) String

func (req Json) String() string

type OutputType

type OutputType int

func (*OutputType) IsFile

func (out *OutputType) IsFile() bool

func (*OutputType) IsGraph

func (out *OutputType) IsGraph() bool

func (*OutputType) IsHuman

func (out *OutputType) IsHuman() bool

func (*OutputType) IsJson

func (out *OutputType) IsJson() bool

func (*OutputType) IsNone

func (out *OutputType) IsNone() bool

func (*OutputType) IsRaw

func (out *OutputType) IsRaw() bool

func (*OutputType) IsStrFile

func (out *OutputType) IsStrFile(t string) bool

func (*OutputType) IsStrGraph

func (out *OutputType) IsStrGraph(t string) bool

func (*OutputType) IsStrHuman

func (out *OutputType) IsStrHuman(t string) bool

func (*OutputType) IsStrJson

func (out *OutputType) IsStrJson(t string) bool

func (*OutputType) IsStrNone

func (out *OutputType) IsStrNone(t string) bool

func (*OutputType) IsStrRaw

func (out *OutputType) IsStrRaw(t string) bool

func (*OutputType) SetFile

func (out *OutputType) SetFile()

func (*OutputType) SetGraph

func (out *OutputType) SetGraph()

func (*OutputType) SetHuman

func (out *OutputType) SetHuman()

func (*OutputType) SetJson

func (out *OutputType) SetJson()

func (*OutputType) SetNone

func (out *OutputType) SetNone()

func (*OutputType) SetRaw

func (out *OutputType) SetRaw()

type SearchStrings

type SearchStrings map[string]int

type Table

type Table struct {
	Error error
	// contains filtered or unexported fields
}

func NewTable

func NewTable() Table

func (Table) AddRow

func (t Table) AddRow(row ...interface{}) error

func (*Table) AllRows

func (t *Table) AllRows() []*tabular.Row

func (*Table) CreateGraph

func (t *Table) CreateGraph() error

func (*Table) FindSearchStrings

func (t *Table) FindSearchStrings() error

func (*Table) GetData

func (t *Table) GetData()

func (*Table) GetHeaders

func (t *Table) GetHeaders() []tabular.Cell

func (*Table) GetSearchColumn

func (t *Table) GetSearchColumn() SearchStrings

func (*Table) InitGraph

func (t *Table) InitGraph(req GraphRequest)

func (*Table) Print

func (t *Table) Print()

func (*Table) ProcessGraphData

func (t *Table) ProcessGraphData() error

func (*Table) SearchStrings

func (t *Table) SearchStrings() SearchStrings

func (*Table) SetFilePrefix

func (t *Table) SetFilePrefix(prefix string) error

func (*Table) SetGraph

func (t *Table) SetGraph(req GraphRequest) error

func (*Table) SetGraphFromJson

func (t *Table) SetGraphFromJson(j Json) error

func (*Table) SetHeader

func (t *Table) SetHeader(header ...interface{}) error

func (*Table) SetTitle

func (t *Table) SetTitle(title string) error

func (*Table) String

func (t *Table) String() string

func (*Table) WriteCsvFile

func (t *Table) WriteCsvFile() error

func (*Table) WriteFile

func (t *Table) WriteFile(fn string, perm os.FileMode) error

Jump to

Keyboard shortcuts

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