Add select by action id

This commit is contained in:
2020-12-29 16:08:31 -06:00
parent 50bbcdc71d
commit ad47895597
5 changed files with 89 additions and 4 deletions

View File

@@ -27,6 +27,15 @@ func (store *postgresStore) SelectActions() ([]*models.Action, error) {
return actions, nil
}
func (store *postgresStore) SelectActionByID(id int) (*models.Action, error) {
action := models.Action{}
err := store.db.Get(&action, "SELECT action_id, action_description, estimated_chunks, completed_chunks, completed_on, created_at, updated_at, plan_id FROM actions WHERE action_id = ?", id)
if err != nil {
return nil, err
}
return &action, nil
}
func (store *postgresStore) SelectPlans() ([]*models.Plan, error) {
plans := make([]*models.Plan, 0)
err := store.db.Select(&plans, "SELECT plan_id, plan_date FROM plans")