Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteGoal ¶
DeleteGoal deletes a goal from the database.
func DeleteProgress ¶
DeleteProgress deletes a progress from the database.
Types ¶
type Goal ¶
type Goal struct {
ID string `db:"goal_id" json:"goal_id"`
Name string `db:"name" json:"name"`
Context string `db:"context" json:"context"`
DateCreated time.Time `db:"date_created" json:"date_created"`
}
Goal represents a row in goal database table.
func CreateGoal ¶
CreateGoal creates a goal in the database.
func UpdateGoal ¶
UpdateGoal updates a goal from the database.
type Health ¶
type Health struct {
Status string `json:"status"`
}
Health represents a health information.
type NewGoal ¶
type NewGoal struct {
Name string `json:"name" validate:"required"`
Context string `json:"context"`
}
NewGoal is what required to create a new goal.
type NewProgress ¶
type NewProgress struct {
SystemID string `json:"system_id" validate:"required"`
Context string `json:"context"`
Completed bool `json:"completed" validate:"required"`
MeasurableData int `json:"measurable_data"`
MeasurableUnit string `json:"measurable_unit"`
Sets int `json:"sets"`
Reps int `json:"reps"`
Link string `json:"link"`
DateCreated time.Time `json:"date_created"`
}
NewProgress is what required to create a new progress.
type NewSystem ¶
type NewSystem struct {
GoalID string `json:"goal_id" validate:"required"`
Name string `json:"name" validate:"required"`
Repeat string `json:"repeat"`
}
NewSystem is what required to create a new system.
type Progress ¶
type Progress struct {
ID string `db:"progress_id" json:"progress_id"`
SystemID string `db:"system_id" json:"system_id"`
Context string `db:"context" json:"context"`
Completed bool `db:"completed" json:"completed"`
MeasurableData int `db:"measurable_data" json:"measurable_data"`
MeasurableUnit string `db:"measurable_unit" json:"measurable_unit"`
Sets int `db:"sets" json:"sets"`
Reps int `db:"reps" json:"reps"`
Link string `db:"link" json:"link"`
DateCreated time.Time `db:"date_created" json:"date_created"`
}
Progress represents a row in progress database table.
func CreateProgress ¶
func CreateProgress(db *sqlx.DB, n *NewProgress) (*Progress, error)
CreateProgress creates a progress in the database.
func GetProgress ¶
GetProgress retrieves a progress from the database.
func GetProgresses ¶
GetProgresses retrieves all progress from the database.
func UpdateProgress ¶
UpdateProgress updates a progress from the database.
type System ¶
type System struct {
ID string `db:"system_id" json:"system_id"`
GoalID string `db:"goal_id" json:"goal_id"`
Name string `db:"name" json:"name"`
Repeat string `db:"repeat" json:"repeat"`
DateCreated time.Time `db:"date_created" json:"date_created"`
}
System represents a row in system database table.
func CreateSystem ¶
CreateSystem creates a system in the database.
func GetSystems ¶
GetSystems retrieves all systems from the database.
func UpdateSystem ¶
UpdateSystem updates a system from the database.
type UpdatedGoal ¶
type UpdatedGoal struct {
Name string `json:"name" validate:"required_without=Context"`
Context string `json:"context" validate:"required_without=Name"`
}
UpdatedGoal is what required to update a goal.
type UpdatedProgress ¶
type UpdatedProgress struct {
Context string `json:"context" validate:"required_without=Completed MeasurableData MeasurableUnit Sets Reps Link DateCreated"`
Completed bool `json:"completed" validate:"required_without=Context MeasurableData MeasurableUnit Sets Reps Link DateCreated"`
MeasurableData int `json:"measurable_data" validate:"required_without=Context Completed MeasurableUnit Sets Reps Link DateCreated"`
MeasurableUnit string `json:"measurable_unit" validate:"required_without=Context Completed MeasurableData Sets Reps Link DateCreated"`
Sets int `json:"sets" validate:"required_without=Context Completed MeasurableData MeasurableUnit Reps Link DateCreated"`
Reps int `json:"reps" validate:"required_without=Context Completed MeasurableData MeasurableUnit Sets Link DateCreated"`
Link string `json:"link" validate:"required_without=Context Completed MeasurableData MeasurableUnit Sets Reps DateCreated"`
DateCreated time.Time `json:"date_created" validate:"required_without=Context Completed MeasurableData MeasurableUnit Sets Reps Link"`
}
UpdatedProgress is what required to update a progress.
type UpdatedSystem ¶
type UpdatedSystem struct {
Name string `json:"name" validate:"required_without=Repeat"`
Repeat string `json:"repeat" validate:"required_without=Name"`
}
UpdatedSystem is what required to update a system.