Files
PandaX/base/oss/build.go
2022-01-13 17:48:45 +08:00

16 lines
286 B
Go

package oss
import (
"path"
"time"
"github.com/google/uuid"
)
func BuildName(fileName, fileType string) (string, error) {
t := time.Now().Format("20060102")
newUUID, _ := uuid.NewUUID()
ext := path.Ext(fileName)
return t + "/" + fileType + "/" + newUUID.String() + ext, nil
}