qiniu

package
v0.0.0-...-a2093d6 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: LGPL-2.1 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

func NewClientWithConfig(config Config) *Client

func (*Client) Delete

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

func (*Client) Kernel

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

func (*Client) Token

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

type Option func(config *Config)

func WithAccessKey

func WithAccessKey(accessKey string) Option

func WithBucket

func WithBucket(bucket string) Option

func WithDomain

func WithDomain(domain string) Option

func WithSecretKey

func WithSecretKey(secretKey string) Option

func WithUseCdnDomains

func WithUseCdnDomains(useCdnDomains bool) Option

func WithUseHTTPS

func WithUseHTTPS(useHTTPS bool) Option

func WithZone

func WithZone(zone string) Option

Jump to

Keyboard shortcuts

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