added select plan by id
All checks were successful
gitea-deepak/gogmagog/pipeline/head This commit looks good

This commit is contained in:
2020-12-29 16:26:30 -06:00
parent ba18d011bd
commit 0c6f686ce5
5 changed files with 63 additions and 1 deletions

View File

@@ -44,3 +44,12 @@ func (store *postgresStore) SelectPlans() ([]*models.Plan, error) {
}
return plans, nil
}
func (store *postgresStore) SelectPlanByID(id int) (*models.Plan, error) {
plan := models.Plan{}
err := store.db.Get(&plan, store.db.Rebind("SELECT plan_id, plan_date FROM plans WHERE plan_id = ?"), id)
if err != nil {
return nil, err
}
return &plan, nil
}