storage

package module
v0.0.0-...-c32de3e Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

README

go-storage

Golang抽象文件操作库

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Stat(path string, context Context) (FileInfo, error)
	Write(path string, contents string, context Context) (int64, error)
	WriteStream(path string, reader io.Reader, size int64, context Context) error
	WriteBytes(path string, contents []byte, context Context) (int64, error)
	Append(path string, contents string, context Context) (int64, error)
	AppendStream(path string, reader io.Reader, size int64, context Context) error
	AppendBytes(path string, contents []byte, context Context) (int64, error)
	ReName(path string, newPath string, context Context) error
	Copy(src string, dst string, context Context) error
	Delete(dst string, context Context) error
	DeleteDir(dst string, context Context) error
	CreateDir(dst string, context Context) error
	ListDir(dst string, ctx Context) ([]FileInfo, int64, error)
}

type Context

type Context map[string]interface{}

上下文信息

func NewContext

func NewContext() Context

func (Context) Get

func (m Context) Get(key string) (interface{}, bool)

func (Context) Has

func (m Context) Has(key string) bool

func (Context) Set

func (m Context) Set(key string, value interface{}) Context

type FileInfo

type FileInfo interface {
	Name() string
	Size() int64
	ModTime() time.Time
	MimeType() string
	Hash() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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