models

package
v0.0.0-...-2dfa829 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2017 License: GPL-3.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteScoutHealths

func DeleteScoutHealths(db *sql.DB, scoutId int64) error

func DeleteScoutInteractions

func DeleteScoutInteractions(db *sql.DB, scoutId int64) error

func DeleteScoutLogs

func DeleteScoutLogs(db *sql.DB, scoutId int64) error

func NumScoutHealths

func NumScoutHealths(db *sql.DB) (int64, error)

func NumScoutInteractions

func NumScoutInteractions(db *sql.DB) (int64, error)

func NumScoutLogs

func NumScoutLogs(db *sql.DB) (int64, error)

func NumScouts

func NumScouts(db *sql.DB) (int64, error)

func ScoutHealthsAsJSON

func ScoutHealthsAsJSON(db *sql.DB) (string, error)

func ScoutInteractionsAsJSON

func ScoutInteractionsAsJSON(db *sql.DB) (string, error)

func ScoutSummariesAsJSON

func ScoutSummariesAsJSON(db *sql.DB) (string, error)

func ScoutsAsJSON

func ScoutsAsJSON(db *sql.DB) ([]string, error)

Types

type Buckets

func (*Buckets) Scan

func (b *Buckets) Scan(value interface{}) error

func (Buckets) Value

func (b Buckets) Value() (driver.Value, error)

type IntBuckets

func (*IntBuckets) Scan

func (b *IntBuckets) Scan(value interface{}) error

func (IntBuckets) Value

func (b IntBuckets) Value() (driver.Value, error)

type Interaction

type Interaction struct {
	UUID     string     // The UUID for the scout that detected the interaction.
	Version  string     // The Version of the protocol used for transmitting data to the mothership
	Entered  time.Time  // The time the interaction started (rounded to nearest half hour)
	Duration float32    // The total duration of the interaction.
	Path     []Waypoint // The pathway of the interaction through the scene.
}

type Path

type Path [][2]int

func (*Path) Scan

func (p *Path) Scan(value interface{}) error

func (Path) Value

func (p Path) Value() (driver.Value, error)

type RealArray

type RealArray []float32

func (*RealArray) Scan

func (a *RealArray) Scan(value interface{}) error

func (RealArray) Value

func (a RealArray) Value() (driver.Value, error)

type Scout

type Scout struct {
	Id         int64         `json:"id"`
	UUID       string        `json:"uuid"`
	IpAddress  string        `json:"ip_address"`
	Port       int64         `json:"port"`
	Authorised bool          `json:"authorised"`
	Name       string        `json:"name"`
	State      ScoutState    `json:"state"`
	Summary    *ScoutSummary `json:"summary"`
}

func GetAllScouts

func GetAllScouts(db *sql.DB) ([]*Scout, error)

func GetScoutById

func GetScoutById(db *sql.DB, id int64) (*Scout, error)

func GetScoutByUUID

func GetScoutByUUID(db *sql.DB, uuid string) (*Scout, error)

func (*Scout) ClearCalibrationFrame

func (s *Scout) ClearCalibrationFrame(db *sql.DB) error

func (*Scout) GetCalibrationFrame

func (s *Scout) GetCalibrationFrame(db *sql.DB) ([]byte, error)

func (*Scout) Insert

func (s *Scout) Insert(db *sql.DB) error

func (*Scout) Update

func (s *Scout) Update(db *sql.DB) error

func (*Scout) UpdateCalibrationFrame

func (s *Scout) UpdateCalibrationFrame(db *sql.DB, frame []byte) error

type ScoutHealth

type ScoutHealth struct {
	ScoutId     int64
	CPU         float32
	Memory      float32
	TotalMemory float32
	Storage     float32
	CreatedAt   time.Time
}

func GetLastScoutHealth

func GetLastScoutHealth(db *sql.DB, scoutId int64) (*ScoutHealth, error)

func GetScoutHealthById

func GetScoutHealthById(db *sql.DB, scoutId int64, time time.Time) (*ScoutHealth, error)

func (*ScoutHealth) Insert

func (s *ScoutHealth) Insert(db *sql.DB) error

type ScoutInteraction

type ScoutInteraction struct {
	Id             int64
	ScoutId        int64
	Duration       float32
	Waypoints      Path
	WaypointWidths Path
	WaypointTimes  RealArray
	Processed      bool
	EnteredAt      time.Time
}

func CreateScoutInteraction

func CreateScoutInteraction(i *Interaction) ScoutInteraction

func GetLastScoutInteraction

func GetLastScoutInteraction(db *sql.DB, scoutId int64) (*ScoutInteraction, error)

func GetScoutInteractionById

func GetScoutInteractionById(db *sql.DB, id int64) (*ScoutInteraction, error)

func GetUnprocessed

func GetUnprocessed(db *sql.DB) ([]*ScoutInteraction, error)

func (*ScoutInteraction) Insert

func (si *ScoutInteraction) Insert(db *sql.DB) error

func (*ScoutInteraction) MarkProcessed

func (si *ScoutInteraction) MarkProcessed(db *sql.DB) error

type ScoutLog

type ScoutLog struct {
	ScoutId   int64
	Log       []byte
	CreatedAt time.Time
}

func GetLastScoutLog

func GetLastScoutLog(db *sql.DB, scoutId int64) (*ScoutLog, error)

func GetScoutLogById

func GetScoutLogById(db *sql.DB, scoutId int64, time time.Time) (*ScoutLog, error)

func (*ScoutLog) Insert

func (s *ScoutLog) Insert(db *sql.DB) error

type ScoutState

type ScoutState string
const (
	IDLE        ScoutState = "idle"
	CALIBRATING ScoutState = "calibrating"
	CALIBRATED  ScoutState = "calibrated"
	MEASURING   ScoutState = "measuring"
)

func (*ScoutState) Scan

func (s *ScoutState) Scan(value interface{}) error

func (ScoutState) Value

func (s ScoutState) Value() (driver.Value, error)

type ScoutSummary

type ScoutSummary struct {
	ScoutId          int64
	VisitorCount     int64
	VisitTimeBuckets Buckets
	VisitorBuckets   IntBuckets
}

func GetScoutSummaryById

func GetScoutSummaryById(db *sql.DB, scoutId int64) (*ScoutSummary, error)

func (*ScoutSummary) Clear

func (si *ScoutSummary) Clear(db *sql.DB) error

func (*ScoutSummary) Insert

func (si *ScoutSummary) Insert(db *sql.DB) error

func (*ScoutSummary) Update

func (si *ScoutSummary) Update(db *sql.DB) error

type Waypoint

type Waypoint struct {
	XPixels          int     // x-coordinate of waypoint centroid in pixels
	YPixels          int     // y-coordinate of waypoint centroid in pixels
	HalfWidthPixels  int     // Half the width of the waypoint in pixels
	HalfHeightPixels int     // Half the height of the waypoint in pixels
	T                float32 // The number of seconds elapsed since the beginning of the interaction
}

Jump to

Keyboard shortcuts

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