cloud

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const StorageDomain = "https://storage.googleapis.com/"

Variables

This section is empty.

Functions

This section is empty.

Types

type Cloud

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

func NewFile

func NewFile(env configTool.Media, session cloud.ISession) *Cloud

NewFile method

func (*Cloud) GetURL

func (st *Cloud) GetURL(ctx context.Context, route string) (string, error)

func (*Cloud) List

func (st *Cloud) List(ctx context.Context, query storage.Query, h storage.IterHandler) error

func (*Cloud) Remove

func (st *Cloud) Remove(ctx context.Context, route string) error

func (*Cloud) Upload

func (st *Cloud) Upload(ctx context.Context, prefix string, f io.ReadCloser) (string, error)

type File

type File struct {
	Handle      *storage.BucketHandle `json:"-"`
	FilePath    string                `json:"path,omitempty"`
	PublicURL   string                `json:"public_url,omitempty"`
	MediaLink   string                `json:"media_link,omitempty"`
	ContentType string                `json:"content_type,omitempty"`
	FileSize    int64                 `json:"size,omitempty"`
	Created     time.Time             `json:"created,omitempty"`
	Updated     time.Time             `json:"updated,omitempty"`
	Folder      *Folder               `json:"folders,omitempty"`
}

func (*File) CreatedTime

func (f *File) CreatedTime() (time.Time, error)

func (*File) FolderInfo

func (f *File) FolderInfo() (name string, path string, exist bool)

func (*File) GetURL

func (f *File) GetURL() string

GetURL fetches the file URL for downloading but returns ErrNotFound if no found.

func (*File) ModTime

func (f *File) ModTime() (time.Time, error)

func (*File) Name

func (f *File) Name() string

func (*File) NewReader

func (f *File) NewReader(ctx context.Context) (reader io.ReadCloser, closeFn func() error, err error)

func (*File) NewWriter

func (f *File) NewWriter(ctx context.Context) (writer io.WriteCloser, closeFn func() error)

func (*File) Path

func (f *File) Path() string

func (*File) Remove

func (f *File) Remove(ctx context.Context) error

Remove a file but returns ErrNotFound if not found.

func (*File) Size

func (f *File) Size() (int64, error)

type Folder

type Folder struct {
	Name string `json:"name,omitempty"`
	Path string `json:"path,omitempty"`
}

Jump to

Keyboard shortcuts

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