Rename Object to FileUpload; use native Postgres $n placeholders.

This commit is contained in:
2026-08-21 23:53:00 -07:00
parent a36bc723cc
commit a249965fc1
6 changed files with 41 additions and 71 deletions
+5 -5
View File
@@ -16,11 +16,11 @@ import (
// Uploader stores public avatar objects.
type Uploader interface {
Enabled() bool
Upload(ctx context.Context, obj Object) (publicURL string, err error)
Upload(ctx context.Context, obj FileUpload) (publicURL string, err error)
}
// Object is a file to upload to object storage.
type Object struct {
// FileUpload is a file body to store (e.g. an avatar).
type FileUpload struct {
Key string
Body io.Reader
ContentType string
@@ -47,7 +47,7 @@ type spaces struct {
func (Disabled) Enabled() bool { return false }
func (Disabled) Upload(context.Context, Object) (string, error) {
func (Disabled) Upload(context.Context, FileUpload) (string, error) {
return "", fmt.Errorf("avatar uploads are not configured")
}
@@ -84,7 +84,7 @@ func NewSpaces(cfg SpacesConfig) Uploader {
func (s *spaces) Enabled() bool { return true }
func (s *spaces) Upload(ctx context.Context, obj Object) (string, error) {
func (s *spaces) Upload(ctx context.Context, obj FileUpload) (string, error) {
key := strings.TrimPrefix(obj.Key, "/")
input := &s3.PutObjectInput{
Bucket: aws.String(s.cfg.Bucket),