models

package
v0.0.0-...-5927b00 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB()

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

func CreateBwTestTable

func CreateBwTestTable()

CreateBwTestTable operates on the DB to create the bwtests table.

func DeleteBwTestItemsBefore

func DeleteBwTestItemsBefore(before string) int64

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)

InitDB controls the opening connection to 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)

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
}

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

func ReadBwTestItemsSince

func ReadBwTestItemsSince(since string) []BwTestGraph

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 // ms
	ActualDuration int   // ms
	CIa            string
	CAddr          string
	CPort          int
	SIa            string
	SAddr          string
	SPort          int
	CSDuration     int // ms
	CSPackets      int // packets
	CSPktSize      int // bytes
	CSBandwidth    int // bps
	CSThroughput   int // bps
	CSArrVar       int // ms
	CSArrAvg       int // ms
	CSArrMin       int // ms
	CSArrMax       int // ms
	SCDuration     int // ms
	SCPackets      int // packets
	SCPktSize      int // bytes
	SCBandwidth    int // bps
	SCThroughput   int // bps
	SCArrVar       int // ms
	SCArrAvg       int // ms
	SCArrMin       int // ms
	SCArrMax       int // ms
	Error          string
}

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

func ReadBwTestItemsAll

func ReadBwTestItemsAll() []BwTestItem

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.

Jump to

Keyboard shortcuts

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