oss

package
v0.0.0-...-4fbaa37 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	EndPoint string
	Bucket   string
}

Context context includes endPoint and bucket info

type Service

type Service struct {
	Context      *Context
	AccessKey    string
	AccessSecret string
}

Service service defines context

func NewService

func NewService(key, secret string) *Service

NewService service initializer

func (*Service) AsyncUpload

func (s *Service) AsyncUpload(opts *UploadOptions) (respchan chan *UploadResponse)

AsyncUpload async upload

func (*Service) GetBucket

func (s *Service) GetBucket() string

GetBucket get bucket

func (*Service) GetEndPoint

func (s *Service) GetEndPoint() string

GetEndPoint get endpoint

func (*Service) GetLocation

func (s *Service) GetLocation(objname string) string

GetLocation get location

func (*Service) SetBucket

func (s *Service) SetBucket(bucket string)

SetBucket set bucket

func (*Service) SetEndPoint

func (s *Service) SetEndPoint(endpoint string)

SetEndPoint set endpoint

func (*Service) Upload

func (s *Service) Upload(opts *UploadOptions) (resp *UploadResponse)

Upload upload file

type UploadOptions

type UploadOptions struct {
	ObjectName   string
	Public       bool
	Expire       time.Duration
	IsFolder     bool   // Is file or folder
	ParentFolder string // Parent folder
	Meta         map[string]string
}

UploadOptions upload response

type UploadResponse

type UploadResponse struct {
	// Location location of uploaded file
	Location string
	Error    error
}

UploadResponse upload response

Jump to

Keyboard shortcuts

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