utils

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBucketExistByNme added in v1.0.4

func CheckBucketExistByNme(targetBucket string) bool

CheckBucketExistByNme check bucket name exist or not

func CheckBucketExistByNmeType added in v1.0.4

func CheckBucketExistByNmeType(targetBucket, bucketType string) bool

CheckBucketExistByNmeType check bucket name exist or not

func GetBucketTypeByNme

func GetBucketTypeByNme(d string) string

GetBucketTypeByNme get pub bucket name by data bucket name under same endpoint

func GetByBucketPrefer

func GetByBucketPrefer(prefer, bucketType string) (string, string)

GetByBucketPrefer get prefer and bucket by prefer and bucketType

func GetCDNURLByBucket added in v1.0.3

func GetCDNURLByBucket(d string) string

GetCDNURLByBucket get cdnurl by bucket name under same endpoint

func GetCoutryCodeByBucketName

func GetCoutryCodeByBucketName(bucketName string) string

GetCoutryCodeByBucketName get oss countryCode by bucket name

func GetEndpointByPrefer

func GetEndpointByPrefer(prefer string) string

GetEndpointByPrefer get endpoint by prefer

func GetOSSPreferByCountryID

func GetOSSPreferByCountryID(countryID, GEO string) string

GetOSSPreferByCountryID get oss prefer region by countryID

func GetPreferByBucketName

func GetPreferByBucketName(bucketName string) (string, string)

GetPreferByBucketName get prefer by bucket name

func GetPreferByCoutryNode

func GetPreferByCoutryNode(countryNode string) string

GetPreferByCoutryNode get prefer by bucket name

func SetDfsID

func SetDfsID(userID, fileName, category, subCategory, relativePath, identifier, cloud string, totalSize int64) string

SetDfsID gen unique dfsID by userID, fileName, category, subCategory, relativePath, identifier, cloud, totalSize

func SetMultiPartDfsID

func SetMultiPartDfsID(userID, cloud string, obj ChunksObj) string

SetMultiPartDfsID gen unique dfsID by userID, cloud, ChunksObj

Types

type ChunksObj

type ChunksObj struct {
	Category string `form:"category" query:"category" json:"category" validate:"uploadCateCheck"`
	SubCate  string `form:"subcate" query:"subcate" json:"subcate"`
	GEO      string `form:"geo" query:"geo" json:"geo"`
	// 在开始上传后变更
	Bucket           string `form:"bucket" query:"bucket" json:"bucket"`
	ChunkNumber      int    `form:"chunkNumber" query:"chunkNumber" json:"chunkNumber"`
	Identifier       string `form:"identifier" query:"identifier" json:"identifier"`
	Filename         string `form:"filename" query:"filename" json:"filename"`
	RelativePath     string `form:"relativePath" query:"relativePath" json:"relativePath"`
	CurrentChunkSize int64  `form:"currentChunkSize" query:"currentChunkSize" json:"currentChunkSize"`
	TotalSize        int64  `form:"totalSize" query:"totalSize" json:"totalSize"`
	TotalChunks      int    `form:"totalChunks" query:"totalChunks" json:"totalChunks"`
	DownValidTo      int64  `form:"downValidTo" query:"downValidTo" json:"downValidTo"`

	// 上传完成后变动
	DfsID       string `json:"dfsID"`
	ContentType string `json:"contentType"`
	Endpoint    string `json:"endpoint"`
	DownURL     string `json:"downURL"`
}

ChunksObj for multipart upload

Jump to

Keyboard shortcuts

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