server

package
v0.0.0-...-3b48e0c Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccessDenied = errors.New("access denied")

Functions

func AuthRequired

func AuthRequired(apiAuth string) gin.HandlerFunc

func GetClient

func GetClient(ctx context.Context, projectId string) *firestore.Client

func Last12Months

func Last12Months() [12]string

func Last24Hours

func Last24Hours() [24]string

func Last4Years

func Last4Years() [4]string

func Last5Weeks

func Last5Weeks() [5]string

func Last60Minutes

func Last60Minutes() [60]string

func Last7Days

func Last7Days() [7]string

func SecurityMiddleware

func SecurityMiddleware(dev bool) gin.HandlerFunc

Types

type DBDataPoint

type DBDataPoint struct {
	Counter           int64   `json:"c",firestore:"counter"`
	Meters            float32 `json:"m",firestore:"meters"`
	MetersPerSecond   float32 `json:"mps",firestore:"mps"`
	KilometersPerHour float32 `json:"kph",firestore:"kph"`
}

Timestamp is key, need counter for updating averages

type EventsResponse

type EventsResponse struct {
	Events []ResponseDataPoint `json:"events"`
}

type LastEventContainer

type LastEventContainer struct {
	Events []ResponseDataPoint `firestore:"events"`
}

type ResponseDataPoint

type ResponseDataPoint struct {
	Counter           int64   `json:"c"`
	Timestamp         string  `json:"ts"`
	Meters            float32 `json:"m"`
	MetersPerSecond   float32 `json:"mps"`
	KilometersPerHour float32 `json:"kph"`
}

type Server

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

func NewServer

func NewServer(dev bool, projectId string, apiAuth string) *Server

func (*Server) Run

func (s *Server) Run(listenAddr string, fakeData bool)

type StatsResponse

type StatsResponse struct {
	EventTimestamps []string            `json:"eventTimestamps"`
	DataPoints      []ResponseDataPoint `json:"dataPoints"`
}

Jump to

Keyboard shortcuts

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