mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
28 lines
No EOL
484 B
Go
28 lines
No EOL
484 B
Go
package repositories
|
|
|
|
import (
|
|
"github.com/deluan/gosonic/models"
|
|
)
|
|
|
|
type Album struct {
|
|
BaseRepository
|
|
}
|
|
|
|
func NewAlbumRepository() *Album {
|
|
r := &Album{}
|
|
r.init("album", &models.Album{})
|
|
return r
|
|
}
|
|
|
|
func (r *Album) Put(m *models.Album) error {
|
|
if m.Id == "" {
|
|
m.Id = r.NewId(m.ArtistId, m.Name)
|
|
}
|
|
return r.saveOrUpdate(m.Id, m)
|
|
}
|
|
|
|
func (r *Album) Get(id string) (*models.Album, error) {
|
|
var rec interface{}
|
|
rec, err := r.readEntity(id)
|
|
return rec.(*models.Album), err
|
|
} |