31 lines
697 B
Go
31 lines
697 B
Go
package db
|
|
|
|
import (
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"reichard.io/imagini/graph/model"
|
|
)
|
|
|
|
func (dbm *DBManager) CreateAlbum(album *model.Album) error {
|
|
log.Debug("[db] Creating album: ", album.Name)
|
|
err := dbm.db.Create(album).Error
|
|
return err
|
|
}
|
|
|
|
func (dbm *DBManager) Album(album *model.Album) (int64, error) {
|
|
var count int64
|
|
err := dbm.db.Where(album).First(album).Count(&count).Error
|
|
return count, err
|
|
}
|
|
|
|
func (dbm *DBManager) Albums() ([]*model.Album, int64, error) {
|
|
var foundAlbums []*model.Album
|
|
var count int64
|
|
err := dbm.db.Find(&foundAlbums).Count(&count).Error
|
|
return foundAlbums, count, err
|
|
}
|
|
|
|
func (dbm *DBManager) DeleteAlbum(album *model.Album) error {
|
|
return nil
|
|
}
|