github.com/andrew00x/gomovies@v0.1.0/pkg/catalog/catalog.go (about) 1 package catalog 2 3 import ( 4 "github.com/andrew00x/gomovies/pkg/api" 5 "github.com/andrew00x/gomovies/pkg/config" 6 ) 7 8 type Factory func(*config.Config) (Catalog, error) 9 10 var catalogFactory Factory 11 12 func CreateCatalog(conf *config.Config) (Catalog, error) { 13 return catalogFactory(conf) 14 } 15 16 type Catalog interface { 17 All() []api.Movie 18 Find(title string) []api.Movie 19 Get(id int) (api.Movie, bool) 20 Load() error 21 Refresh() error 22 Save() error 23 Update(u api.Movie) (api.Movie, error) 24 AddTag(tag string, id int) error 25 }