objects

package
v2.0.0-beta14 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BaseEndpoint    string `json:"BaseEndpoint"`
	Region          string `json:"Region"`
	BucketName      string `json:"BucketName"`
	AccessKeyId     string `json:"AccessKeyId"`
	AccessKeySecret string `json:"AccessKeySecret"`
}

type Object

type Object struct {
	Client     *s3.Client
	Uploader   *manager.Uploader
	Downloader *manager.Downloader
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Object, error)

New creates a new Object instance.

func (*Object) Delete

func (o *Object) Delete(ctx context.Context, key string) error

Delete deletes an object in the bucket with the given key.

func (*Object) DeleteObjects

func (o *Object) DeleteObjects(ctx context.Context, keys []string) error

DeleteObjects deletes objects in the bucket with the given keys.

func (*Object) Download

func (o *Object) Download(ctx context.Context, key string, w io.WriterAt) error

Download downloads an object in the bucket with the given key to the given writer.

func (*Object) DownloadFile

func (o *Object) DownloadFile(ctx context.Context, key string, path string) error

DownloadFile downloads an object in the bucket with the given key to the given path.

func (*Object) Exists

func (o *Object) Exists(ctx context.Context, key string) (bool, error)

Exists checks if an object exists in the bucket with the given key.

func (*Object) ListObjects

func (o *Object) ListObjects(ctx context.Context, prefix string, limit int) ([]string, error)

ListObjects lists objects in the bucket with the given prefix and limit. Prefix & limit will be ignored if it's default value.

func (*Object) Upload

func (o *Object) Upload(ctx context.Context, key string, body io.Reader) error

Upload uploads an object to the bucket with the given key.

func (*Object) UploadFile

func (o *Object) UploadFile(ctx context.Context, key string, path string) error

UploadFile uploads a file to the bucket with the given key.

Jump to

Keyboard shortcuts

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