gogmagog/models/plan.go

32 lines
755 B
Go

package models
import (
"time"
)
// Plan represents a single day's agenda of actions.
type Plan struct {
PlanID int64
PlanDate time.Time
}
// Plans returns all plans in the model.
func (m *Model) Plans() ([]*Plan, error) {
return m.SelectPlans()
}
// Plan returns a single plan from the store by plan_id.
func (m *Model) Plan(id int) (*Plan, error) {
return m.SelectPlanByID(id)
}
// AddPlan inserts a given plan into the store, returning the generated PlanID. The provided PlanID is ignored.
func (m *Model) AddPlan(plan *Plan) (int, error) {
return m.InsertPlan(plan)
}
// GetActions returns the actions associated with a particular plan.
func (m *Model) GetActions(plan *Plan) ([]*Action, error) {
return m.SelectActionsByPlanID(plan)
}