Files
template-vitrine/backend/internal/modules/media/storage.go
T
2026-09-14 20:50:19 +02:00

20 lines
713 B
Go

package media
import (
"context"
"io"
)
// Storage is the pluggable backend that actually persists uploaded bytes.
// The service/handler layers never know whether files end up on local disk
// or in an S3 bucket -- only main.go decides which implementation to wire
// in, based on MEDIA_STORAGE_DRIVER.
type Storage interface {
// Save persists the content under the given key and returns the
// publicly reachable URL for it.
Save(ctx context.Context, key string, reader io.Reader, size int64, contentType string) (url string, err error)
// Delete removes the object identified by key. Deleting a
// already-removed key must not be treated as an error.
Delete(ctx context.Context, key string) error
}