uri

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadUri = fmt.Errorf("badly formatted storage uri")
)

Functions

This section is empty.

Types

type DefaultFactory

type DefaultFactory struct{}

func (*DefaultFactory) NewUri

func (f *DefaultFactory) NewUri(provider, bucketName, path string) Uri

func (*DefaultFactory) ParseUri

func (f *DefaultFactory) ParseUri(uri string) (Uri, error)

type DefaultUri

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

func ParseUri

func ParseUri(rawURI string) (DefaultUri, error)

ParseUri parse a storage uri (e.g. gcs://bucket-name/path/to/file)

func (DefaultUri) Bucket

func (u DefaultUri) Bucket() string

func (DefaultUri) Delete

func (u DefaultUri) Delete(ctx context.Context) error

func (DefaultUri) Download

func (u DefaultUri) Download(ctx context.Context) ([]byte, error)

func (DefaultUri) DownloadToFile

func (u DefaultUri) DownloadToFile(ctx context.Context, destination string) error

func (DefaultUri) Exist added in v0.3.0

func (u DefaultUri) Exist(ctx context.Context) (bool, error)

func (DefaultUri) FileName

func (u DefaultUri) FileName() string

func (DefaultUri) GetAttrs

func (u DefaultUri) GetAttrs(ctx context.Context) (storage.Attrs, error)

func (DefaultUri) NewStorageStrategy

func (u DefaultUri) NewStorageStrategy(ctx context.Context) (storage.Strategy, error)

func (DefaultUri) Path

func (u DefaultUri) Path() string

func (DefaultUri) Protocol

func (u DefaultUri) Protocol() string

func (DefaultUri) String

func (u DefaultUri) String() string

func (DefaultUri) Upload

func (u DefaultUri) Upload(ctx context.Context, data []byte) error

func (DefaultUri) UploadFile

func (u DefaultUri) UploadFile(ctx context.Context, data io.ReadCloser) error

type Factory

type Factory interface {
	ParseUri(uri string) (Uri, error)
	NewUri(provider, bucketName, path string) Uri
}

type Uri

type Uri interface {
	Protocol() string
	Bucket() string
	Path() string
	FileName() string
	String() string
}

func NewUri

func NewUri(protocol, bucketName, path string) Uri

Jump to

Keyboard shortcuts

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