storage

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("storage object not found")

Functions

This section is empty.

Types

type Blob

type Blob interface {
	CreateObject(ctx context.Context, bucket, key string, contents []byte) error
	DeleteObject(ctx context.Context, bucket, key string) error
	GetObject(ctx context.Context, bucket, key string) ([]byte, error)
}

func NewFilesystemStorage

func NewFilesystemStorage(_ context.Context) (Blob, error)

type FS

type FS struct{}

func (*FS) CreateObject

func (s *FS) CreateObject(_ context.Context, folder, filename string, contents []byte) error

func (*FS) DeleteObject

func (s *FS) DeleteObject(_ context.Context, folder, filename string) error

func (*FS) GetObject

func (s *FS) GetObject(_ context.Context, folder, filename string) ([]byte, error)

type S3

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

func NewS3

func NewS3(cfg S3Config) (*S3, error)

func (*S3) CreateObject

func (s *S3) CreateObject(ctx context.Context, bucket, key string, contents []byte) error

func (*S3) DeleteObject

func (s *S3) DeleteObject(ctx context.Context, bucket, key string) error

func (*S3) GetObject

func (s *S3) GetObject(ctx context.Context, bucket, key string) ([]byte, error)

func (*S3) PublicAccess

func (s *S3) PublicAccess(_ context.Context, bucket, key string) string

type S3Config

type S3Config struct {
	Region   string `env:"S3_REGION,default=eu-west-3"`
	AccessID string `env:"S3_ACCESS_ID"`
	Secret   string `env:"S3_SECRET_KEY"`
}

Jump to

Keyboard shortcuts

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