You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
786 B

package services
import (
"strings"
"time"
)
var (
AllLogTypes = []LogType{
LogType("Weight"),
LogType("Height"),
LogType("Calories"),
}
)
type LogType string
func ParseLogTypes(lts string) []LogType {
if lts == "" {
return AllLogTypes
}
ltsArr := []LogType{}
for _, lt := range strings.Split(lts, ",") {
lt_normalized := strings.Title(strings.ToLower(lt))
ltsArr = append(ltsArr, LogType(lt_normalized))
}
return ltsArr
}
const (
Weight = LogType("Weight")
Height = LogType("Height")
Calories = LogType("Calories")
)
type StatLog struct {
ID uint64 `json:"id,omitempty"`
UserID uint64 `json:"userId,omitempty"`
Value float64 `json:"value"`
Type LogType `json:"type"`
RecordedTS time.Time `json:"recordedTs"`
}