metric

package
v0.0.0-...-b5f797f Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Collection store.CollectionName = "metricConfigurations"

Functions

func AdjustToStartOfWeek

func AdjustToStartOfWeek(t time.Time) time.Time

func Calculate

func Calculate(metricStore, activityStore store.Store) http.HandlerFunc

func Create

func Create(metricStore store.Store) http.HandlerFunc

func Delete

func Delete(metricStore store.Store) http.HandlerFunc

func List

func List(metricStore store.Store) http.HandlerFunc

func Load

func Load(metricStore store.Store) http.HandlerFunc

func Update

func Update(metricStore store.Store) http.HandlerFunc

Types

type ByDate

type ByDate []Value

func (ByDate) Len

func (a ByDate) Len() int

func (ByDate) Less

func (a ByDate) Less(i, j int) bool

func (ByDate) Swap

func (a ByDate) Swap(i, j int)

type Configuration

type Configuration struct {
	Id        primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	UserId    string             `json:"userId" bson:"userId"`
	Name      string             `json:"name" bson:"name"`
	Tags      []string           `json:"tags" bson:"tags"`
	Threshold float64            `json:"threshold" bson:"threshold"`
}

func (Configuration) ObjectId

func (c Configuration) ObjectId() primitive.ObjectID

func (Configuration) SetObjectId

func (c Configuration) SetObjectId(id primitive.ObjectID)

type Result

type Result struct {
	Id                       string        `json:"id,omitempty" bson:"_id,omitempty"`
	Name                     string        `json:"name,omitempty" bson:"_id,omitempty"`
	TotalExceedingDuration   time.Duration `json:"totalExceedingDuration" bson:"totalExceedingDuration"`
	CurrentExceedingDuration time.Duration `json:"currentExceedingDuration" bson:"currentExceedingDuration"`
	Threshold                float64       `json:"threshold,omitempty" bson:"threshold,omitempty"`
	Values                   []Value       `json:"values,omitempty" bson:"values,omitempty"`
}

type Value

type Value struct {
	Duration time.Duration `json:"duration" bson:"duration"`
	Date     time.Time     `json:"date" bson:"date"`
}

Jump to

Keyboard shortcuts

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