storage.go (1175B)
1 // Package storage specifies a storage interface for Kanban Projects. 2 // Sub packages implement the interface providing different storage strategies. 3 package storage 4 5 import ( 6 "git.sr.ht/~jackmordaunt/kanban" 7 "github.com/google/uuid" 8 ) 9 10 // Storer persists Project entities. 11 type Storer interface { 12 // Create a new Project. 13 Create(kanban.Project) error 14 // Save one or more existing Projects, updating the storage device. 15 Save(...kanban.Project) error 16 // Load updates the Projects using data from the storage device. 17 // Allows caller to allocate and control memory. 18 // Avoids copying. 19 Load([]kanban.Project) error 20 // Find a Project by ID. 21 Find(id uuid.UUID) (kanban.Project, bool, error) 22 // List all existing Projects. 23 List() ([]kanban.Project, error) 24 // Count returns the number of projects that exist in the store. 25 Count() (int, error) 26 // Archive a project. 27 // An archived project will have it's data saved, but won't show up under 28 // normal queries. 29 Archive(uuid.UUID) error 30 // ListArchived lists all archived projects. 31 ListArchived() ([]kanban.Project, error) 32 // Restore takes an archived project and makes it live again. 33 Restore(uuid.UUID) error 34 }