uploadx

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliOSS

type AliOSS struct {
	Conf AliYunConf
}

func NewAliOSS

func NewAliOSS(conf AliYunConf) *AliOSS

func (*AliOSS) DeleteFile

func (*AliOSS) DeleteFile(key string) error

DeleteFile todo

func (*AliOSS) UploadFile

func (*AliOSS) UploadFile(file multipart.File, fileHeader *multipart.FileHeader) (*UploadInfo, error)

UploadFile todo

type AliYunConf

type AliYunConf struct {
	Endpoint        string `json:"endpoint"`
	AccessKeyId     string `json:"access-key-id"`
	AccessKeySecret string `json:"access-key-secret"`
	BucketName      string `json:"bucket-name"`
	BucketUrl       string `json:"bucket-url"`
	BasePath        string `json:"base-path"`
}

type AwsConf

type AwsConf struct {
	Bucket           string `json:"bucket"`
	Region           string `json:"region"`
	Endpoint         string `json:"endpoint"`
	SecretID         string `json:"secret-id"`
	SecretKey        string `json:"secret-key"`
	BaseURL          string `json:"base-url"`
	PathPrefix       string `json:"path-prefix"`
	S3ForcePathStyle bool   `json:"s3-force-path-style"`
	DisableSSL       bool   `json:"disable-ssl"`
}

type AwsOSS

type AwsOSS struct {
	Conf AwsConf
}

func NewAwsOSS

func NewAwsOSS(conf AwsConf) *AwsOSS

func (*AwsOSS) DeleteFile

func (*AwsOSS) DeleteFile(key string) error

func (*AwsOSS) UploadFile

func (*AwsOSS) UploadFile(file multipart.File, fileHeader *multipart.FileHeader) (*UploadInfo, error)

type CloudflareR2Conf

type CloudflareR2Conf struct {
	Bucket          string `json:"bucket"`
	BaseURL         string `json:"base-url"`
	Path            string `json:"path"`
	AccountID       string `json:"account-id"`
	AccessKeyID     string `json:"access-key-id"`
	SecretAccessKey string `json:"secret-access-key"`
}

type HuaWeiConf

type HuaWeiConf struct {
	Path      string `json:"path" yaml:"path"`
	Bucket    string `json:"bucket" yaml:"bucket"`
	Endpoint  string `json:"endpoint" yaml:"endpoint"`
	AccessKey string `json:"access-key" yaml:"access-key"`
	SecretKey string `json:"secret-key" yaml:"secret-key"`
}

type HwOSS

type HwOSS struct {
	Conf HuaWeiConf
}

func NewHwOSS

func NewHwOSS(conf HuaWeiConf) *HwOSS

func (*HwOSS) DeleteFile

func (*HwOSS) DeleteFile(key string) error

func (*HwOSS) UploadFile

func (*HwOSS) UploadFile(file multipart.File, fileHeader *multipart.FileHeader) (*UploadInfo, error)

type LocalConf

type LocalConf struct {
	Path      string `json:"path"`       // 本地文件访问路径
	StorePath string `json:"store-path"` // 本地文件存储路径
}

type LocalOSS

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

func NewLocalOSS

func NewLocalOSS(conf LocalConf) *LocalOSS

func (*LocalOSS) DeleteFile

func (m *LocalOSS) DeleteFile(key string) error

func (*LocalOSS) UploadFile

func (m *LocalOSS) UploadFile(file multipart.File, fileHeader *multipart.FileHeader) (*UploadInfo, error)

type MinIoConf

type MinIoConf struct {
	MinIOAccessKeyID     string `json:"minIOAccessKeyID"`     //admin
	MinIOAccessSecretKey string `json:"minIOAccessSecretKey"` //MinIOAccessSecretKey
	MinIOEndpoint        string `json:"minIOEndpoint"`        //localhost:9000
	MinIOBucketLocation  string `json:"minIOBucketLocation"`  //cn-north-1
	MinIOSSLBool         bool   `json:"minIOSSLBool"`
	MinIOBucket          string `json:"minIOBucket"` //mymusic
	MinIOBasePath        string `json:"minIoBasePath"`
}

type MinioOSS

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

func NewMinioOSS

func NewMinioOSS(conf MinIoConf) *MinioOSS

func (*MinioOSS) DeleteFile

func (m *MinioOSS) DeleteFile(key string) error

func (*MinioOSS) UploadFile

func (m *MinioOSS) UploadFile(file multipart.File, fileHeader *multipart.FileHeader) (*UploadInfo, error)

type OSS

type OSS interface {
	UploadFile(file multipart.File, fileHeader *multipart.FileHeader) (*UploadInfo, error)
	DeleteFile(key string) error
}

func NewOss

func NewOss(conf OSSConf) OSS

type OSSConf

type OSSConf struct {
	Type        OssType     `json:"type"`
	LocalConf   LocalConf   `json:"localConf,omitempty,optional"`
	MinIoConf   MinIoConf   `json:"minioConf,omitempty,optional"`
	AliYunConf  AliYunConf  `json:"aliyunConf,omitempty,optional"`
	TencentConf TencentConf `json:"tencentConf,omitempty,optional"`
	QiNiuConf   QiNiuConf   `json:"qiNiuConf,omitempty,optional"`
	AwsConf     AwsConf     `json:"awsConf,omitempty,optional"`
	HuaWeiConf  HuaWeiConf  `json:"huaWeiConf,omitempty,optional"`
}

type OssType

type OssType int
const (
	LocalType OssType = iota
	MinioType
	AliYunType
	TencentType
	QiNiuType
	AwsType
	HuaWeiType
)

type QiNiuConf

type QiNiuConf struct {
	Zone          string `json:"zone"`            // 存储区域
	Bucket        string `json:"bucket"`          // 空间名称
	ImgPath       string `json:"img-path"`        // CDN加速域名
	AccessKey     string `json:"access-key"`      // 秘钥AK
	SecretKey     string `json:"secret-key"`      // 秘钥SK
	UseHTTPS      bool   `json:"use-https"`       // 是否使用https
	UseCdnDomains bool   `json:"use-cdn-domains"` // 上传是否使用CDN上传加速
}

type QiNiuOSS

type QiNiuOSS struct {
	Conf QiNiuConf
}

func NewQiNiuOSS

func NewQiNiuOSS(conf QiNiuConf) *QiNiuOSS

func (*QiNiuOSS) DeleteFile

func (*QiNiuOSS) DeleteFile(key string) error

func (*QiNiuOSS) UploadFile

func (*QiNiuOSS) UploadFile(file multipart.File, fileHeader *multipart.FileHeader) (*UploadInfo, error)

type TencentConf

type TencentConf struct {
	Bucket     string `json:"bucket"`
	Region     string `json:"region"`
	SecretID   string `json:"secret-id"`
	SecretKey  string `json:"secret-key"`
	BaseURL    string `json:"base-url"`
	PathPrefix string `json:"path-prefix"`
}

type TencentOSS

type TencentOSS struct {
	Conf TencentConf
}

func NewTencentOSS

func NewTencentOSS(conf TencentConf) *TencentOSS

func (*TencentOSS) DeleteFile

func (*TencentOSS) DeleteFile(key string) error

func (*TencentOSS) UploadFile

func (*TencentOSS) UploadFile(file multipart.File, fileHeader *multipart.FileHeader) (*UploadInfo, error)

type UploadInfo

type UploadInfo struct {
	Hash string `json:"hash"`
	Name string `json:"name"`
	Ext  string `json:"ext"`
	Size int64  `json:"size"`
	Path string `json:"path"`
}

Jump to

Keyboard shortcuts

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