Documentation ¶
Index ¶
- Constants
- type Repository
- type Store
- func (s *Store) Create(m domain.Media) (domain.Media, error)
- func (s *Store) Delete(id int) error
- func (s *Store) Exists(fileName string) bool
- func (s *Store) Find(id int) (domain.Media, error)
- func (s *Store) FindByName(name string) (domain.Media, error)
- func (s *Store) FindByURL(url string) (domain.Media, string, error)
- func (s *Store) List(meta params.Params) (domain.MediaItems, int, error)
- func (s *Store) Update(m domain.Media) (domain.Media, error)
Constants ¶
const (
// The database table name for media.
TableName = "media"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { List(meta params.Params) (domain.MediaItems, int, error) Find(id int) (domain.Media, error) FindByName(name string) (domain.Media, error) FindByURL(url string) (domain.Media, string, error) Create(m domain.Media) (domain.Media, error) Update(m domain.Media) (domain.Media, error) Delete(id int) error Exists(fileName string) bool }
Repository defines methods for media items to interact with the database.
type Store ¶
Store defines the data layer for media.
func (*Store) Create ¶
Create
Returns a new media item upon creation. Returns errors.INTERNAL if the SQL query was invalid or the function could not get the newly created ID.
func (*Store) Delete ¶
Delete
Returns nil if the category was successfully deleted. Returns errors.INTERNAL if the SQL query was invalid. Returns errors.NOTFOUND if the category was not found.
func (*Store) Exists ¶
Exists
Returns a bool indicating if the media item exists by name. Logs errors.INTERNAL if there was an error executing the query.
func (*Store) Find ¶
Find
Returns a media item by searching with the given ID. Returns errors.INTERNAL if there was an error executing the query. Returns errors.NOTFOUND if the media item was not found by the given ID.
func (*Store) FindByName ¶
FindByName
Returns a media item by searching with the given name. Returns errors.INTERNAL if there was an error executing the query. Returns errors.NOTFOUND if the media was not found by the given name.
func (*Store) FindByURL ¶
FindByURL
Returns a media by searching with the given url. Returns errors.INTERNAL if there was an error executing the query. Returns errors.NOTFOUND if the media item was not found by the given url.