package db import ( log "github.com/sirupsen/logrus" "reichard.io/imagini/internal/models" ) func (dbm *DBManager) CreateMediaItem (mediaItem *models.MediaItem) error { log.Info("[db] Creating media item: ", mediaItem.FileName) err := dbm.db.Create(&mediaItem).Error return err } func (dbm *DBManager) MediaItems(mediaItemFilter *models.MediaItem) ([]models.MediaItem, int64, error) { var mediaItems []models.MediaItem var count int64 err := dbm.db.Where(&mediaItemFilter).Find(&mediaItems).Count(&count).Error; return mediaItems, count, err }