You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.go 484 B

2 years ago
2 years ago
123456789101112131415161718192021
  1. package utils
  2. import (
  3. "fmt"
  4. "strings"
  5. )
  6. // MakeMoveOperationFileName Move操作时,写入的文件的名称
  7. func MakeMoveOperationFileName(objectID int64, userID int64) string {
  8. return fmt.Sprintf("%d-%d", objectID, userID)
  9. }
  10. // GetDirectoryName 根据objectName获取所属的文件夹名
  11. func GetDirectoryName(objectName string) string {
  12. parts := strings.Split(objectName, "/")
  13. //若为文件,dirName设置为空
  14. if len(parts) == 1 {
  15. return ""
  16. }
  17. return parts[0]
  18. }

公共库