Documentation ¶
Index ¶
- Variables
- func ErrorValidator(vs ...Validator) error
- func Init(c Client, err error) error
- type BucketName
- type Client
- type CopyOptions
- type DelOptions
- type GetOptions
- type KeyName
- type KeyPrefixName
- type ListOptions
- type ObjectInput
- func InputBoolean(bucket string, key string, v bool) ObjectInput
- func InputFile(bucket string, key string, file string) ObjectInput
- func InputMarshalJson(bucket string, key string, vPointer interface{}) ObjectInput
- func InputMarshalProto(bucket string, key string, v proto.Message) ObjectInput
- func InputNumber(bucket string, key string, v interface{}) ObjectInput
- func InputReadSeeker(bucket string, key string, body io.ReadSeeker) ObjectInput
- func InputString(bucket string, key string, v string) ObjectInput
- type ObjectOutput
- type ObjectOutputHook
- type Options
- type Position
- type PresignOptions
- type PutOptions
- type Validator
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSuchKey = errors.New("NoSuchKey: The specified key does not exist.")
ErrNoSuchKey .
Functions ¶
Types ¶
type Client ¶
type Client interface { // PutObject 上传单个对象 PutObject(input ObjectInput, opts ...func(o *PutOptions)) error // PutFolder 上传本地文件夹,存储路径为 'prefix/root/xxx' PutFolder(bucket string, prefix string, root string, opts ...func(o *PutOptions)) error // GetObject 根据对象路径,获取单个对象 GetObject(bucket string, key string, opts ...func(o *GetOptions)) (*ObjectOutputHook, error) // GetObjectsWithIterator 根据对象前缀,获取多个对象 GetObjectsWithIterator(bucket string, prefix string, iterator func(keys []*string) error, opts ...func(o *ListOptions)) error // DelObject 删除单个对象 DelObject(bucket string, key string, opts ...func(o *DelOptions)) error // DelObjectsWithPrefix 根据对象前缀,删除多个对象 DelObjectsWithPrefix(bucket string, prefix string, opts ...func(o *DelOptions)) error // Copy 对象拷贝 Copy(src Position, dst Position, opts ...func(o *CopyOptions)) error // IsExist 查询对象是否存在 IsExist(bucket string, key string, opts ...func(o *GetOptions)) (bool, error) // Presign 获取对象 HTTP 访问路径 Presign(bucket string, key string, opts ...func(o *PresignOptions)) (string, error) // Downloads 根据前缀,批量下载对象至本地存储,本地存储路径为 'root/prefix/xxx' Downloads(bucket string, prefix string, root string, opts ...func(o *ListOptions)) error }
Client .
var C Client
C default Client
type CopyOptions ¶
type CopyOptions struct { Context context.Context // increases the number of callers skipped by caller annotation CallerSkip int }
CopyOptions .
func NewCopyOptions ¶
func NewCopyOptions(opts ...func(o *CopyOptions)) *CopyOptions
NewCopyOptions .
type DelOptions ¶
type DelOptions struct { Context context.Context // object version id VersionID string // increases the number of callers skipped by caller annotation CallerSkip int }
DelOptions .
type GetOptions ¶
type GetOptions struct { Context context.Context // object version VersionID string // increases the number of callers skipped by caller annotation CallerSkip int }
GetOptions .
type ListOptions ¶
type ListOptions struct { Context context.Context MaxKeys int // ignore '/' delimiter Recursive bool // increases the number of callers skipped by caller annotation CallerSkip int }
ListOptions .
func NewListOptions ¶
func NewListOptions(opts ...func(o *ListOptions)) *ListOptions
NewListOptions .
type ObjectInput ¶
type ObjectInput interface { Bucket() string Key() string ContentType() string Close() error Error() error Body() io.ReadSeeker }
ObjectInput .
func InputMarshalJson ¶
func InputMarshalJson(bucket string, key string, vPointer interface{}) ObjectInput
InputMarshalJson .
func InputMarshalProto ¶
func InputMarshalProto(bucket string, key string, v proto.Message) ObjectInput
InputMarshalProto .
func InputNumber ¶
func InputNumber(bucket string, key string, v interface{}) ObjectInput
InputNumber .
func InputReadSeeker ¶
func InputReadSeeker(bucket string, key string, body io.ReadSeeker) ObjectInput
InputReadSeeker .
type ObjectOutput ¶
type ObjectOutput interface { Bucket() string Key() string ContentType() content.Type Decode(vPointer interface{}) error Body() io.ReadCloser Close() error }
ObjectOutput .
func OutputReadCloser ¶
func OutputReadCloser(bucket string, key string, contenttype string, body io.ReadCloser) ObjectOutput
OutputReadCloser .
type ObjectOutputHook ¶
type ObjectOutputHook struct { // Fetch get object with io.ReadCloser Fetch func(hook func(output ObjectOutput) error) error // Write write object to io.WriterAt Write func(w io.WriterAt) error }
ObjectOutputHook .
type Options ¶
type Options struct { // Context context Context context.Context // Timeout 连接超时时间 Timeout time.Duration // Region region Region string // SSL use ssl UseSSL bool }
Options .
type PresignOptions ¶
type PresignOptions struct { Context context.Context // object version id VersionID string // expires time (s) Expires time.Duration // increases the number of callers skipped by caller annotation CallerSkip int }
PresignOptions .
func NewPresignOptions ¶
func NewPresignOptions(opts ...func(o *PresignOptions)) *PresignOptions
NewPresignOptions .
type PutOptions ¶
type PutOptions struct { Context context.Context // increases the number of callers skipped by caller annotation CallerSkip int }
PutOptions .
Click to show internal directories.
Click to hide internal directories.