models

package
v0.0.0-...-42a8572 Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB() error

CloseDB will close the database, only use when app closes.

func DeleteBwTestItemsBefore

func DeleteBwTestItemsBefore(before string) (int64, error)

DeleteBwTestItemsBefore operates on the DB to remote all bwtests rows which are more older than the 'before' epoch in ms.

func InitDB

func InitDB(filepath string) error

InitDB controls the opening connection to the database.

func LoadDB

func LoadDB() error

LoadDB operates on the DB to load and/or migrate the database.

func MaintainDatabase

func MaintainDatabase()

MaintainDatabase is a goroutine that runs independanly to cleanup the database according to the defined schedule.

func StoreBwTestItem

func StoreBwTestItem(bwtest *BwTestItem) error

StoreBwTestItem operates on the DB to insert a BwTestItem.

Types

type BwTestGraph

type BwTestGraph struct {
	Inserted       int64
	ActualDuration int
	CSBandwidth    int
	CSThroughput   int
	SCBandwidth    int
	SCThroughput   int
	Error          string
	Path           string
	Log            string
}

BwTestGraph reflects one row in the bwtests table with only the necessary items to display in a graph.

func ReadBwTestItemsSince

func ReadBwTestItemsSince(since string) ([]BwTestGraph, error)

ReadBwTestItemsSince operates on the DB to return all bwtests rows which are more recent than the 'since' epoch in ms.

type BwTestItem

type BwTestItem struct {
	Inserted       int64  // v0, ms
	ActualDuration int    // v0, ms
	CIa            string // v0
	CAddr          string // v0
	CPort          int    // v0
	SIa            string // v0
	SAddr          string // v0
	SPort          int    // v0
	CSDuration     int    // v0, ms
	CSPackets      int    // v0, packets
	CSPktSize      int    // v0, bytes
	CSBandwidth    int    // v0, bps
	CSThroughput   int    // v0, bps
	CSArrVar       int    // v0, ms
	CSArrAvg       int    // v0, ms
	CSArrMin       int    // v0, ms
	CSArrMax       int    // v0, ms
	SCDuration     int    // v0, ms
	SCPackets      int    // v0, packets
	SCPktSize      int    // v0, bytes
	SCBandwidth    int    // v0, bps
	SCThroughput   int    // v0, bps
	SCArrVar       int    // v0, ms
	SCArrAvg       int    // v0, ms
	SCArrMin       int    // v0, ms
	SCArrMax       int    // v0, ms
	Error          string // v0
	Path           string // v1
	Log            string // v2
}

BwTestItem reflects one row in the bwtests table with all columns.

func ReadBwTestItemsAll

func ReadBwTestItemsAll() ([]BwTestItem, error)

ReadBwTestItemsAll operates on the DB to return all bwtests rows.

func (BwTestItem) GetHeaders

func (bwtest BwTestItem) GetHeaders() []string

GetHeaders iterates the BwTestItem and returns struct variable names.

func (BwTestItem) ToSlice

func (bwtest BwTestItem) ToSlice() []string

ToSlice iterates the BwTestItem and returns struct values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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