storage

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectOption

type ObjectOption struct {
	BucketName string
	Path       string
	MaxResult  int64
	Projection string
	Context    context.Context
}

ObjectOption is optional parameters used for object call.

type Storage

type Storage struct {
	*GCP.Client
	// contains filtered or unexported fields
}

Storage repesents Cloud Storage API client.

func New

func New(ctx context.Context, conf config.Config) (*Storage, error)

New returns initialized *Storage.

func (*Storage) Attrs

func (s *Storage) Attrs(opt ObjectOption) (*GCP.ObjectAttrs, error)

Attrs gets attributes of the object.

func (*Storage) Delete

func (s *Storage) Delete(opt ObjectOption) error

Delete deletes an object.

func (*Storage) Download

func (s *Storage) Download(opt ObjectOption) (data []byte, err error)

Download downloads object data.

func (*Storage) Errorf

func (s *Storage) Errorf(format string, vv ...interface{})

Errorf logging error information.

func (*Storage) IsExists

func (s *Storage) IsExists(opt ObjectOption) (isExist bool, err error)

IsExists checks if an object exists.

func (*Storage) Rename added in v0.4.1

func (s *Storage) Rename(destPath string, opt ObjectOption) error

Rename moves an object from opt.Path to destPath..

func (*Storage) SetLogger

func (s *Storage) SetLogger(logger log.Logger)

SetLogger sets internal API logger.

func (*Storage) Upload

func (s *Storage) Upload(r io.Reader, opt ObjectOption) error

Upload uploads an object from io.Reader.

func (*Storage) UploadByBytes

func (s *Storage) UploadByBytes(byt []byte, opt ObjectOption) error

UploadByBytes uploads an object from bytes.

func (*Storage) UploadByFile

func (s *Storage) UploadByFile(filepath string, opt ObjectOption) error

UploadByFile uploads an object from bytes.

Jump to

Keyboard shortcuts

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