24 lines
756 B
Go
24 lines
756 B
Go
package models
|
|
|
|
// PrimaryPlan represents the primary plan ID for a particular user ID.
|
|
type PrimaryPlan struct {
|
|
UserID int64 `json:"user_id"`
|
|
PlanID int64 `json:"plan_id"`
|
|
}
|
|
|
|
// PrimaryPlan returns the primary plan for a provided user ID in the given model.
|
|
func (m *Model) PrimaryPlan(userID int) (*PrimaryPlan, error) {
|
|
pp, err := m.SelectPrimaryPlan(userID)
|
|
return pp, wrapNotFound(err)
|
|
}
|
|
|
|
// AddPrimaryPlan inserts a given primary plan into the store, returning nothing.
|
|
func (m *Model) AddPrimaryPlan(pp *PrimaryPlan, userID int) error {
|
|
return m.InsertPrimaryPlan(pp, userID)
|
|
}
|
|
|
|
// SavePrimaryPlan saves and updates a primary plan.
|
|
func (m *Model) SavePrimaryPlan(pp *PrimaryPlan, userID int) error {
|
|
return m.UpdatePrimaryPlan(pp, userID)
|
|
}
|