s3storage

package module
v0.0.0-...-916e115 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Key = func(u url.URL) string {
	return strings.TrimPrefix(u.String(), "https://")
}

Key generates the S3 key from the URL.

Functions

This section is empty.

Types

type Storage

type Storage struct {
	Client *s3.Client
	Bucket string
	Prefix string
}

Storage implements the ghtransport.Storage interface backed by AWS S3.

func Must

func Must(client *s3.Client, bucket string, prefix ...string) *Storage

Must returns a new Storage for the given bucket and (optional) prefix, or panics.

func New

func New(client *s3.Client, bucket string, prefix ...string) (*Storage, error)

New returns a new Storage for the given bucket and (optional) prefix.

func (*Storage) Get

func (s *Storage) Get(ctx context.Context, u *url.URL) (body io.ReadCloser, header http.Header, err error)

func (*Storage) Put

func (s *Storage) Put(ctx context.Context, u *url.URL, body []byte, header http.Header) (err error)

Jump to

Keyboard shortcuts

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