warehouse/controller/resource.go
2024-11-17 22:08:06 +01:00

28 lines
711 B
Go

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)
FindBucketByName(name string, limit, offset int) (buckets model.Bucket, err error)
FindBucketIdByName(name string) (id uint, err error)
DeleteBucketByName(name string) error
FindObjectByKey(bucketName, key string) (object *model.Object, err error)
DeleteObjectByKey(bucketName, key string) error
}