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"` }