Documentation
¶
Index ¶
- type FireStore
- func (s *FireStore) CreatePlan(ctx context.Context, p *lib.Plan, user *models.User) (id string, revID string, err error)
- func (s *FireStore) CreatePlanRevision(ctx context.Context, id string, p *lib.Plan, user *models.User) (string, error)
- func (s *FireStore) CreatePractices(ctx context.Context, version string, practices []lib.Practice) error
- func (s *FireStore) CreateProject(ctx context.Context, p *models.ProjectDetails) (string, error)
- func (s *FireStore) DeletePlan(ctx context.Context, id string) error
- func (s *FireStore) DeletePractices(ctx context.Context, version string) error
- func (s *FireStore) DeleteProject(ctx context.Context, id string) error
- func (s *FireStore) GetConfigString(ctx context.Context, field string) (string, error)
- func (s *FireStore) GetPlan(ctx context.Context, id string) (*models.Plan, bool, error)
- func (s *FireStore) GetPlanRevision(ctx context.Context, planID string, revID string) (*lib.Plan, bool, error)
- func (s *FireStore) GetPlanVersions(ctx context.Context, id string) ([]*models.RevisionVersion, error)
- func (s *FireStore) GetPractices(ctx context.Context, version string) ([]lib.Practice, error)
- func (s *FireStore) GetProject(ctx context.Context, id string) (*models.Project, bool, error)
- func (s *FireStore) GetUserData(ctx context.Context, user *models.User) error
- func (s *FireStore) ListPlanRevisionIDs(ctx context.Context, id string) ([]string, error)
- func (s *FireStore) ListPracticesVersions(ctx context.Context) ([]string, error)
- func (s *FireStore) ListProjects(ctx context.Context) ([]*models.Project, error)
- func (s *FireStore) SaveUserData(ctx context.Context, user *models.User) error
- func (s *FireStore) SetManuallyAuthorized(ctx context.Context, UID string, value bool) error
- func (s *FireStore) UpdateProject(ctx context.Context, id string, p *models.ProjectDetails) error
- func (s *FireStore) UserCreationAlertSent(ctx context.Context, UID string) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FireStore ¶
type FireStore struct {
// contains filtered or unexported fields
}
FireStore implements the Store interface with Google Firestore
func NewFireStore ¶
NewFireStore initializes a FireStore
func (*FireStore) CreatePlan ¶
func (s *FireStore) CreatePlan(ctx context.Context, p *lib.Plan, user *models.User) (id string, revID string, err error)
CreatePlan creates a plan from the plan and plan revision, and returns its new id and revision ID
func (*FireStore) CreatePlanRevision ¶
func (s *FireStore) CreatePlanRevision(ctx context.Context, id string, p *lib.Plan, user *models.User) (string, error)
CreatePlanRevision creates a new revision for the plan, returning its ID
func (*FireStore) CreatePractices ¶
func (s *FireStore) CreatePractices(ctx context.Context, version string, practices []lib.Practice) error
CreatePractices creates or replaces the practices at the specified version
func (*FireStore) CreateProject ¶
CreateProject creates a project and returns its new id
func (*FireStore) DeletePlan ¶
DeletePlan atomically deletes the specified plan, all of its revisions, and references in any projects
func (*FireStore) DeletePractices ¶
DeletePractices removes the practices at the specified version. This will break any plans that used this version!
func (*FireStore) DeleteProject ¶
DeleteProject deletes the specified project
func (*FireStore) GetConfigString ¶
GetConfigString returns the named configuration string
func (*FireStore) GetPlan ¶
GetPlan returns the plan with the specified ID or false if it can't be found
func (*FireStore) GetPlanRevision ¶
func (s *FireStore) GetPlanRevision(ctx context.Context, planID string, revID string) (*lib.Plan, bool, error)
GetPlanRevision returns the plan revision with the specified ID or false if it can't be found
func (*FireStore) GetPlanVersions ¶
func (s *FireStore) GetPlanVersions(ctx context.Context, id string) ([]*models.RevisionVersion, error)
GetPlanVersions returns the versions of the specified plan, in date order earliest to latest
func (*FireStore) GetPractices ¶
GetPractices retrieves the specified version of the practice definitions
func (*FireStore) GetProject ¶
GetProject returns the project with the specified ID and true, or false if it can't be found
func (*FireStore) GetUserData ¶
GetUserData extends the referenced user with any additional data recorded in the store
func (*FireStore) ListPlanRevisionIDs ¶
ListPlanRevisionIDs returns the revision ids of the specified plan, in date order earliest to latest or an error if it can't be found
func (*FireStore) ListPracticesVersions ¶
ListPracticesVersions lists all of the recorded versions of practice definitions, in lexicographic order
func (*FireStore) ListProjects ¶
ListProjects returns all of the projects
func (*FireStore) SaveUserData ¶
SaveUserData records the user's LocalData, or removes it if user.LocalData==nil
func (*FireStore) SetManuallyAuthorized ¶
SetManuallyAuthorized sets this user's ManuallyAuthorized attribute
func (*FireStore) UpdateProject ¶
UpdateProject replaces a project with with the contents of the project struct (ctx context.Contextthe ID in the struct is ignored)
type Store ¶
type Store interface {
// ListProjects returns all of the projects
ListProjects(ctx context.Context) ([]*models.Project, error)
// GetProject returns the project with the specified ID, or false if it can't be found
GetProject(ctx context.Context, id string) (*models.Project, bool, error)
// UpdateProject replaces a project with with the contents of the project struct (ctx context.Contextthe ID in the struct is ignored)
UpdateProject(ctx context.Context, id string, p *models.ProjectDetails) error
// CreateProject creates a project and returns its new id
CreateProject(ctx context.Context, p *models.ProjectDetails) (string, error)
// DeleteProject deletes the specified project
DeleteProject(ctx context.Context, id string) error
// GetPlan returns the plan with the specified ID and true, or (nil,false) if it can't be found
GetPlan(ctx context.Context, id string) (*models.Plan, bool, error)
// CreatePlan creates a plan and returns its new id and revision ID
CreatePlan(ctx context.Context, p *lib.Plan, user *models.User) (id string, revID string, err error)
// DeletePlanAndRevisions deletes the specified plan and all of its revisions
DeletePlan(ctx context.Context, id string) error
// CreatePlanRevision creates a new revision for the plan, returning its ID
CreatePlanRevision(ctx context.Context, id string, p *lib.Plan, user *models.User) (string, error)
// GetPlanRevision returns the plan revision with the specified ID or false if it can't be found
GetPlanRevision(ctx context.Context, planID string, revID string) (*lib.Plan, bool, error)
// ListPlanRevisionIDs returns the revision ids of the specified plan, in date order earliest to latest or an error if it can't be found
ListPlanRevisionIDs(ctx context.Context, id string) ([]string, error)
// GetPlanVersions returns the versions of the specified plan, in date order earliest to latest
GetPlanVersions(ctx context.Context, id string) ([]*models.RevisionVersion, error)
// GetUserData extends the referenced user with any additional data recorded in the store
GetUserData(ctx context.Context, user *models.User) error
// SaveUserData records the user's LocalData, or removes it if user.LocalData==nil
SaveUserData(ctx context.Context, user *models.User) error
// UserCreationAlertSent sets this user's CreationAlertSent to true
UserCreationAlertSent(ctx context.Context, UID string) error
// SetManuallyAuthorized sets this user's ManuallyAuthorized attribute
SetManuallyAuthorized(ctx context.Context, UID string, value bool) error
// GetConfigString returns the named configuration string
GetConfigString(ctx context.Context, field string) (string, error)
// ListPracticesVersions lists all of the recorded versions of practice definitions, in lexicographic order
ListPracticesVersions(ctx context.Context) ([]string, error)
// GetPractices retrieves the specified version of the practice definitions
GetPractices(ctx context.Context, version string) ([]lib.Practice, error)
// CreatePractices creates or replaces the practices at the specified version
CreatePractices(ctx context.Context, version string, practices []lib.Practice) error
// DeletePractices removes the practices at the specified version. This will break any plans that used this version!
DeletePractices(ctx context.Context, version string) error
}
Store abstracts over different possible persistence implementations (there used to be more than one)