Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalorieLevel ¶
type CalorieLevel int
CalorieLevel type to save the user's CalorieLevel
const ( FastLost CalorieLevel = -2 SlowLost CalorieLevel = -1 Maintain CalorieLevel = 0 SlowGain CalorieLevel = 1 FastGain CalorieLevel = 2 )
CalorieLevel constants
type Food ¶
type Food struct { Name string `json:"name" bson:"name"` Calories int `json:"calories" bson:"calories"` Fat int `json:"fat" bson:"fat"` Carbs int `json:"carbs" bson:"carbs"` Protein int `json:"protein" bson:"protein"` Sodium int `json:"sodium" bson:"sodium"` // mg }
Food is defined as objects to be entered into a meal
type Log ¶
type Log struct { UserID primitive.ObjectID `json:"user_id" bson:"user_id"` Date time.Time `json:"date" bson:"date"` Meals Meal `json:"meal" bson:"meal"` }
Log is the data structure for saving meals Meals are embedded sub-documents
type Meal ¶
type Meal struct { FoodIDs []primitive.ObjectID `json:"date" bson:"date"` UserID primitive.ObjectID `json:"user_id" bson:"user_id"` }
Meal is a data structure to be saved in logs Meals can also be saved by setting user_id
type Session ¶
type Session struct { UserID primitive.ObjectID `json:"user_id" bson:"user_id"` SessionKey string `json:"session_key" bson:"session_key"` LoginTime time.Time `json:"login_time" bson:"login_time"` LastSeenTime time.Time `json:"last_seen_time" bson:"last_seen_time"` }
Session controls user logins
type User ¶
type User struct { //ID primitive.ObjectID `json:"_id" bson:"_id"` Email string `json:"email" bson:"email"` Username string `json:"username" bson:"username"` Password string `json:"password" bson:"password"` DOB time.Time `json:"dob" bson:"dob"` Height int `json:"height" bson:"height"` // stored as cm CurrentWeight float32 `json:"current_weight" bson:"current_weight"` // stored as kg TargetWeight float32 `json:"target_weight" bson:"target_weight"` CalorieLevel CalorieLevel `json:"calorie_goal" bson:"calorie_goal"` }
User is defined as user account
Click to show internal directories.
Click to hide internal directories.