Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // FieldMismatch happens when the csv does not match our expectations ErrCSVFieldMismatch = errors.New("line fields mismatch in CSV") // UnsupportedType happens when a type is not supported ErrCSVUnsupportedType = errors.New("unsupported type") )
Functions ¶
This section is empty.
Types ¶
type AnnotatedBodyMetric ¶
type AnnotatedBodyMetric struct { BodyMetric BodyMetric Annotations BodyMetricAnnotations }
AnnotatedBodyMetric contains the values of BodyMetric plus some custom annotations plugins to show
type Body ¶
type Body struct { Valid bool Timestamp int Person int Kcal int Fat float32 Tbw float32 Muscle float32 Bone float32 }
Body contains a secondary measurements for a person
type BodyMetric ¶
type BodyMetric struct { Timestamp int `json:"-"` Name string `json:"name"` TimestampString string `json:"timestamp"` Weight float32 `json:"weight"` Fat float32 `json:"fat"` Muscle float32 `json:"muscle"` Bone float32 `json:"bone"` Tbw float32 `json:"tbw"` Kcal int `json:"kcal"` Bmi float32 `json:"bmi"` }
BodyMetric is a single tuple of measurements for a given person
func (*BodyMetric) ToRFC3339 ¶
func (b *BodyMetric) ToRFC3339() string
func (*BodyMetric) ToTime ¶
func (b *BodyMetric) ToTime() time.Time
type BodyMetricAnnotations ¶
type BodyMetricAnnotations struct { Time time.Time DeltaWeight float32 DeltaFat float32 DeltaMuscle float32 DeltaBone float32 DeltaTbw float32 DeltaKcal int DeltaBmi float32 }
BodyMetricAnnotations contains annotations to a given BodyMetric
type BodyMetrics ¶
type BodyMetrics []BodyMetric
BodyMetrics is shorthand for a list of BodyMetrics
func (BodyMetrics) Len ¶
func (s BodyMetrics) Len() int
func (BodyMetrics) Less ¶
func (s BodyMetrics) Less(i, j int) bool
func (BodyMetrics) Swap ¶
func (s BodyMetrics) Swap(i, j int)
type Config ¶
type Config struct { Device string ScanDuration duration DeviceID string Sub duration CsvDir string TimeOffset int Fakeit bool People map[string]PersonConfig Plugins map[string]PluginConfig }
Config contains the configuration for the application
type MailRecipient ¶
MailRecipient contains a person's name and a list of mail addresses to get updates
type PartialMetric ¶
PartialMetric contains either type of measurement sent by the scale
type PersonConfig ¶
type PersonConfig struct {
ID int
}
type PersonMetrics ¶
type PersonMetrics struct { Name string Person int Gender string Age int Size int Activity string Updated bool BodyMetrics map[int]BodyMetric }
PersonMetrics has all data about a single person, including a list of measurements (body metrics)
func (*PersonMetrics) ImportBodyMetrics ¶
func (person *PersonMetrics) ImportBodyMetrics(metrics []BodyMetric)
ImportBodyMetrics will import extra metrics to a person
func (*PersonMetrics) LastMetric ¶
func (person *PersonMetrics) LastMetric() *BodyMetric
type Plugin ¶
type Plugin interface { Name() string Initialize(c Config) Plugin ParseData(person *PersonMetrics) bool InitializeData(person *PersonMetrics) bool Logger() log.FieldLogger }
Plugin interface describes what a plugin should implement
type PluginConfig ¶
type PluginConfig struct { Server string SenderName string SenderAddress string TemplateFile string Subject string Metrics int StartTLS bool Recipients map[string]MailRecipient Dir string Host string Username string Password string }
PluginConfig contains any possible Plugin configuration