oss

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Type           string `yaml:"type"`
	Addr           string `yaml:"addr"`
	Secure         bool   `yaml:"secure"`
	AccessKey      string `yaml:"access_key"`
	SecretKey      string `yaml:"secret_key"`
	ExpiryDuration int    `yaml:"expiry_duration"`
	BucketName     string `yaml:"bucket_name"`
}

func FromEnv

func FromEnv() Conf

type GetObjectOption

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

func (*GetObjectOption) GetRange

func (opt *GetObjectOption) GetRange() *Range

func (*GetObjectOption) SetRange

func (opt *GetObjectOption) SetRange(start, end int64)

type ObjectInfo

type ObjectInfo struct {
	Size int64 `json:"size"`
}

type Oss

type Oss interface {
	PresignedPutURL(ctx context.Context, objectName string, expires time.Duration, etag, mimeType string, size int64) (string, error)
	PresignedGetURL(ctx context.Context, objectName string, expires time.Duration) (string, error)
	StatObject(ctx context.Context, objectName string) (ObjectInfo, error)
	PutObject(ctx context.Context, objectName string, reader io.Reader, objectSize int64, contentType string) error
	GetBucketName() string
	GetObject(ctx context.Context, objectName string, opts GetObjectOption) (io.Reader, error)
	DeleteObject(ctx context.Context, objectName string) error
}

type Range

type Range struct {
	Start int64
	End   int64
}

Directories

Path Synopsis
impl

Jump to

Keyboard shortcuts

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