adapter

package
v0.0.0-...-e37a865 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CosAdapter

type CosAdapter struct {
	CosConf
}

func (*CosAdapter) FileConf

func (m *CosAdapter) FileConf() map[string]string

FileConf 公共访问配置-腾讯云

func (*CosAdapter) ImgToken

func (m *CosAdapter) ImgToken(bucket, key string) (interface{}, error)

ImgToken 获取上传凭证

func (*CosAdapter) ImgUrl

func (m *CosAdapter) ImgUrl(bucket, key string) string

ImgUrl 获取图片地址

type CosConf

type CosConf struct {
	Appid     string       `json:"appid"`
	SecretId  string       `json:"secretId"`
	SecretKey string       `json:"secretKey"`
	Storage   []CosStorage `json:"storage"`
}

type CosStorage

type CosStorage struct {
	Bucket   string `json:"bucket"`
	Region   string `json:"region"`
	Endpoint string `json:"endpoint"`
}

type CosTokenItem

type CosTokenItem struct {
	ExpiredTime int                     `json:"expiredTime"`
	Expiration  string                  `json:"expiration"`
	Credentials CosTokenItemCredentials `json:"credentials"`
	RequestId   string                  `json:"requestId"`
	StartTime   int                     `json:"startTime"`
	Timestamp   int                     `json:"timestamp"`
}

type CosTokenItemCredentials

type CosTokenItemCredentials struct {
	SessionToken string `json:"sessionToken"`
	TmpSecretId  string `json:"tmpSecretId"`
	TmpSecretKey string `json:"tmpSecretKey"`
}

type CosTokenResp

type CosTokenResp struct {
	ImgToken CosTokenItem `json:"img_token"`
}

type OssAdapter

type OssAdapter struct {
	OssConf
}

func (*OssAdapter) FileConf

func (m *OssAdapter) FileConf() map[string]string

FileConf 公共访问配置-阿里云

func (*OssAdapter) ImgToken

func (m *OssAdapter) ImgToken(bucket, key string) (interface{}, error)

ImgToken 获取上传凭证

func (*OssAdapter) ImgUrl

func (m *OssAdapter) ImgUrl(bucket, key string) string

ImgUrl 获取图片地址

type OssConf

type OssConf struct {
	AccessKey string       `json:"access_key"`
	SecretKey string       `json:"secret_key"`
	RoleArny  string       `json:"role_arny"`
	Storage   []OssStorage `json:"storage"`
}

type OssStorage

type OssStorage struct {
	Bucket   string `json:"bucket"`
	Region   string `json:"region"`
	Endpoint string `json:"endpoint"`
}

Jump to

Keyboard shortcuts

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