qiniu

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZoneHuanan  = "huanan"
	ZoneHuadong = "huadong"
	ZoneHuabei  = "huabei"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(options ...Option) *Client

func NewClientWithConfig added in v1.3.0

func NewClientWithConfig(config Config) *Client

func (*Client) Delete

func (client *Client) Delete(filename string) error

func (*Client) Kernel added in v1.3.0

func (client *Client) Kernel() *storage.FormUploader

func (*Client) Token added in v1.3.0

func (client *Client) Token() string

func (*Client) Upload

func (client *Client) Upload(file io.Reader, filename string) (string, error)

type Config

type Config struct {
	AccessKey string `mapstructure:"access_key" json:"access_key"`
	SecretKey string `mapstructure:"secret_key" json:"secret_key"`
	Bucket    string `mapstructure:"bucket" json:"bucket"`
	// 空间对应机房
	Zone string `mapstructure:"zone" json:"zone"`
	// 是否使用https域名
	UseHTTPS bool `mapstructure:"use_https" json:"use_https"`
	// 上传是否使用CDN上传加速
	UseCdnDomains bool `mapstructure:"use_cdn_domains" json:"use_cdn_domains"`
	// 域名地址,包含http://,通过查看外链可以看到,如:http://image-c4lms-qiniu.whereabouts.icu
	Domain string `mapstructure:"domain" json:"domain"`
}

type Option added in v1.3.0

type Option func(config *Config)

func WithAccessKey added in v1.3.0

func WithAccessKey(accessKey string) Option

func WithBucket added in v1.3.0

func WithBucket(bucket string) Option

func WithDomain added in v1.3.0

func WithDomain(domain string) Option

func WithSecretKey added in v1.3.0

func WithSecretKey(secretKey string) Option

func WithUseCdnDomains added in v1.3.0

func WithUseCdnDomains(useCdnDomains bool) Option

func WithUseHTTPS added in v1.3.0

func WithUseHTTPS(useHTTPS bool) Option

func WithZone added in v1.3.0

func WithZone(zone string) Option

Jump to

Keyboard shortcuts

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