Documentation
¶
Index ¶
- type OSSBucketInterface
- type OSSOptions
- type OSSStorage
- func (s *OSSStorage) Del(ctx context.Context, fileID string) error
- func (s *OSSStorage) Fetch(ctx context.Context, fileID string, writer io.Writer) error
- func (s *OSSStorage) Name() string
- func (s *OSSStorage) Save(ctx context.Context, fileID string, reader io.Reader) error
- func (s *OSSStorage) URL(ctx context.Context, fileID string) (*url.URL, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OSSBucketInterface ¶ added in v0.2.3
type OSSBucketInterface interface { PutObject(objectKey string, reader io.Reader, options ...oss.Option) error GetObject(objectKey string, options ...oss.Option) (io.ReadCloser, error) DeleteObject(objectKey string, options ...oss.Option) error }
OSSBucketInterface 是为了脱离bucket带来的影响. 如mock时, 如果使用 oss.Client 则无法mock(Client is struct)
type OSSOptions ¶ added in v0.2.3
type OSSOptions struct { Endpoint string `yaml:"endpoint" mapstructure:"endpoint"` AccessKeyID string `yaml:"access_key_id" mapstructure:"access_key_id"` AccessKeySecret string `yaml:"access_key_secret" mapstructure:"access_key_secret"` Bucket string `yaml:"bucket" mapstructure:"bucket"` UseHTTPS bool `yaml:"use_https" mapstructure:"use_https"` Domain string `yaml:"domain" mapstructure:"domain"` }
OSSOptions is Oss 存储所需的配置项
type OSSStorage ¶ added in v0.2.3
type OSSStorage struct {
// contains filtered or unexported fields
}
OSSStorage oss 客户端
func NewOssClient ¶
func NewOssClient(opts *OSSOptions) (*OSSStorage, error)
NewOssClient is 创建oss客户端
func (*OSSStorage) Del ¶ added in v0.2.3
func (s *OSSStorage) Del(ctx context.Context, fileID string) error
func (*OSSStorage) Name ¶ added in v0.2.3
func (s *OSSStorage) Name() string
Click to show internal directories.
Click to hide internal directories.