2024-11-13 21:16:22 +01:00
|
|
|
package controller
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.schreifuchs.ch/schreifuchs/warehouse/api"
|
|
|
|
"git.schreifuchs.ch/schreifuchs/warehouse/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Implement the interface
|
|
|
|
type Controller struct {
|
|
|
|
db database
|
|
|
|
}
|
|
|
|
|
|
|
|
func New(db database) *Controller {
|
|
|
|
return &Controller{
|
|
|
|
db: db,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type database interface {
|
|
|
|
InsertBucket(bucket *model.Bucket) error
|
|
|
|
FindApiBuckets(limit, offset int) (buckets []api.Bucket, err error)
|
2024-11-17 22:08:06 +01:00
|
|
|
FindBucketByName(name string, limit, offset int) (buckets model.Bucket, err error)
|
2024-11-13 21:16:22 +01:00
|
|
|
FindBucketIdByName(name string) (id uint, err error)
|
|
|
|
DeleteBucketByName(name string) error
|
2024-11-17 22:08:06 +01:00
|
|
|
FindObjectByKey(bucketName, key string) (object *model.Object, err error)
|
|
|
|
DeleteObjectByKey(bucketName, key string) error
|
2024-11-13 21:16:22 +01:00
|
|
|
}
|