oss

package
v10.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGlobal

func SetGlobal(h func() IClient)

Set the global oss client

Types

type IClient

type IClient interface {
	PutObject(ctx context.Context, bucketName, objectName string, reader io.ReadSeeker, objectSize int64, options ...PutObjectOptions) (*PutObjectResult, error)
	GetObject(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
	RemoveObject(ctx context.Context, bucketName, objectName string) error
	RemoveObjectByURL(ctx context.Context, urlStr string) error
	StatObject(ctx context.Context, bucketName, objectName string) (*ObjectStat, error)
	StatObjectByURL(ctx context.Context, urlStr string) (*ObjectStat, error)
}

IClient is an interface for oss client

var (
	Ins IClient
)

type MinioClient

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

func NewMinioClient

func NewMinioClient(config MinioClientConfig) (*MinioClient, error)

func (*MinioClient) GetObject

func (c *MinioClient) GetObject(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)

func (*MinioClient) PutObject

func (c *MinioClient) PutObject(ctx context.Context, bucketName, objectName string, reader io.ReadSeeker, objectSize int64, options ...PutObjectOptions) (*PutObjectResult, error)

func (*MinioClient) RemoveObject

func (c *MinioClient) RemoveObject(ctx context.Context, bucketName, objectName string) error

func (*MinioClient) RemoveObjectByURL

func (c *MinioClient) RemoveObjectByURL(ctx context.Context, urlStr string) error

func (*MinioClient) StatObject

func (c *MinioClient) StatObject(ctx context.Context, bucketName, objectName string) (*ObjectStat, error)

func (*MinioClient) StatObjectByURL

func (c *MinioClient) StatObjectByURL(ctx context.Context, urlStr string) (*ObjectStat, error)

type MinioClientConfig

type MinioClientConfig struct {
	Domain          string
	Endpoint        string
	AccessKeyID     string
	SecretAccessKey string
	BucketName      string
	Prefix          string
}

type ObjectStat

type ObjectStat struct {
	Key          string
	ETag         string
	LastModified time.Time
	Size         int64
	ContentType  string
	UserMetadata map[string]string
}

func (*ObjectStat) GetName

func (a *ObjectStat) GetName() string

type PutObjectOptions

type PutObjectOptions struct {
	ContentType  string
	UserMetadata map[string]string
}

PutObjectOptions represents options specified by user for PutObject call

type PutObjectResult

type PutObjectResult struct {
	URL  string `json:"url,omitempty"`
	Key  string `json:"key,omitempty"`
	ETag string `json:"e_tag,omitempty"`
	Size int64  `json:"size,omitempty"`
}

type S3Client

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

func NewS3Client

func NewS3Client(config S3ClientConfig) (*S3Client, error)

func (*S3Client) GetObject

func (c *S3Client) GetObject(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)

func (*S3Client) PutObject

func (c *S3Client) PutObject(ctx context.Context, bucketName, objectName string, reader io.ReadSeeker, objectSize int64, options ...PutObjectOptions) (*PutObjectResult, error)

func (*S3Client) RemoveObject

func (c *S3Client) RemoveObject(ctx context.Context, bucketName, objectName string) error

func (*S3Client) RemoveObjectByURL

func (c *S3Client) RemoveObjectByURL(ctx context.Context, urlStr string) error

func (*S3Client) StatObject

func (c *S3Client) StatObject(ctx context.Context, bucketName, objectName string) (*ObjectStat, error)

func (*S3Client) StatObjectByURL

func (c *S3Client) StatObjectByURL(ctx context.Context, urlStr string) (*ObjectStat, error)

type S3ClientConfig

type S3ClientConfig struct {
	Domain          string
	Region          string
	AccessKeyID     string
	SecretAccessKey string
	BucketName      string
	Prefix          string
}

Jump to

Keyboard shortcuts

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