This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/internal/db/albums.go

31 lines
697 B
Go
Raw Normal View History

2021-01-19 21:26:10 +00:00
package db
2021-02-07 02:11:44 +00:00
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
}