ingredient/info: Add Fetcher concept

This commit is contained in:
Tom Wiesing 2022-10-19 10:50:40 +02:00
parent a6501b42c7
commit 52559e4d68
No known key found for this signature in database
22 changed files with 447 additions and 328 deletions

View file

@ -1,6 +1,9 @@
package locker
import "github.com/FAU-CDI/wisski-distillery/internal/models"
import (
"github.com/FAU-CDI/wisski-distillery/internal/models"
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
)
// Locked checks if this WissKI is currently locked.
func (lock *Locker) Locked() (locked bool) {
@ -13,3 +16,8 @@ func (lock *Locker) Locked() (locked bool) {
table.Select("count(*) > 0").Where("slug = ?", lock.Slug).Find(&locked)
return
}
func (locker *Locker) Fetch(flags ingredient.FetchFlags, info *ingredient.Information) (err error) {
info.Locked = locker.Locked()
return
}