Help us shape the future of Go! Take the 2026 Go Developer Survey

uploadstore

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("upload object not found")

Functions

This section is empty.

Types

type Local

type Local struct {
	// contains filtered or unexported fields
}

func NewLocal

func NewLocal(dir string) *Local

func (*Local) Delete

func (s *Local) Delete(_ context.Context, path string) error

func (*Local) Save

func (s *Local) Save(_ context.Context, body io.Reader, _ SaveOptions) (SavedObject, error)

func (*Local) ServeHTTP

func (s *Local) ServeHTTP(w http.ResponseWriter, r *http.Request, object Object) error

type Object

type Object struct {
	Path        string
	Filename    string
	ContentType string
	ByteSize    int64
}

type R2

type R2 struct {
	// contains filtered or unexported fields
}

func NewR2

func NewR2(cfg R2Config) (*R2, error)

func (*R2) Delete

func (s *R2) Delete(ctx context.Context, objectPath string) error

func (*R2) Save

func (s *R2) Save(ctx context.Context, body io.Reader, options SaveOptions) (SavedObject, error)

func (*R2) ServeHTTP

func (s *R2) ServeHTTP(w http.ResponseWriter, r *http.Request, object Object) error

type R2Config

type R2Config struct {
	AccountID       string
	AccessKeyID     string
	SecretAccessKey string
	Bucket          string
	Prefix          string
	Endpoint        string
	Region          string
	HTTPClient      *http.Client
}

type SaveOptions

type SaveOptions struct {
	ContentType string
}

type SavedObject

type SavedObject struct {
	Path     string
	ByteSize int64
}

type Store

type Store interface {
	Save(ctx context.Context, body io.Reader, options SaveOptions) (SavedObject, error)
	Delete(ctx context.Context, path string) error
	// Returned errors are pre-commit; a failed committed stream must be aborted.
	ServeHTTP(w http.ResponseWriter, r *http.Request, object Object) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL