storage

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(input IFile, closeFn func())

func Unload

func Unload()

Types

type File

type File interface {
	FolderInfo() (name string, path string, exist bool)
	Path() string
	Name() string
	Size() (int64, error)
	CreatedTime() (time.Time, error)
	ModTime() (time.Time, error)
	NewWriter(ctx context.Context) (writer io.WriteCloser, closeFn func() error)
	NewReader(ctx context.Context) (reader io.ReadCloser, closeFn func() error, err error)
	Remove(ctx context.Context) error
	GetURL() string
}

type FileEnumType

type FileEnumType int
const (
	FileCloudDelimiter FileEnumType = iota
	FileCloudPrefix
	FileCloudVersions
	FileCloudStartOffset
	FileCloudEndOffset
	FileCloudProjection
)

type IFile

type IFile interface {
	Upload(ctx context.Context, prefix string, f io.ReadCloser) (string, error)
	GetURL(ctx context.Context, path string) (string, error)
	Remove(ctx context.Context, path string) error
	List(ctx context.Context, q Query, h IterHandler) error
}
var (
	FILE    IFile
	CLOSEFN func()
)

func Load

func Load() (IFile, func())

type IterHandler

type IterHandler func(file File) error

type Query

type Query struct {
	Fields           []FileEnumType
	CloudDelimiter   string        // google cloud field
	CloudPrefix      string        // google cloud field
	CloudVersions    bool          // google cloud field
	CloudStartOffset string        // google cloud field
	CloudEndOffset   string        // google cloud field
	CloudProjection  gs.Projection // google cloud field
}

func WithFileCloudDelimiter

func WithFileCloudDelimiter(condition Query, delimiter string) Query

func WithFileCloudEndOffset

func WithFileCloudEndOffset(condition Query, endOffset string) Query

func WithFileCloudPrefix

func WithFileCloudPrefix(condition Query, prefix string) Query

func WithFileCloudProjection

func WithFileCloudProjection(condition Query, projection gs.Projection) Query

func WithFileCloudStartOffset

func WithFileCloudStartOffset(condition Query, startOffset string) Query

func WithFileCloudVersions

func WithFileCloudVersions(condition Query, versions bool) Query

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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