s_file_chunk.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package schema
  2. import "time"
  3. // FileChunk 文件分块
  4. type FileChunk struct {
  5. RecordID string `json:"record_id"` // 记录ID
  6. Hash string `json:"hash"` //
  7. Total int `json:"total"` // 文件块总数
  8. Current int `json:"current"` // 当前上传的块数
  9. Name string `json:"name"` // 文件名
  10. Path string `json:"path"` // 文件路径
  11. Size int64 `json:"size"` // 文件大小
  12. Creator string `json:"creator"` // 创建者
  13. CreatedAt time.Time `json:"created_at"` // 创建时间
  14. FileHash string `json:"file_hash"` // 文件的md5
  15. PastTime time.Time `json:"past_time"` //文件块过期的时间
  16. }
  17. // FileChunkQueryParam 查询条件
  18. type FileChunkQueryParam struct {
  19. Hash string `form:"hash"`
  20. Current int `form:"current"`
  21. Name string `form:"name"`
  22. IsClear bool `form:"is_clear"`
  23. }
  24. // FileChunkQueryOptions demo对象查询可选参数项
  25. type FileChunkQueryOptions struct {
  26. PageParam *PaginationParam // 分页参数
  27. }
  28. type FileChunkS []*FileChunk
  29. // FileChunkQueryResult demo对象查询结果
  30. type FileChunkQueryResult struct {
  31. Data FileChunkS
  32. PageResult *PaginationResult
  33. }
  34. func (a FileChunkS) FileChunkToPath() []string {
  35. pathS := make([]string, 0, len(a))
  36. for i := range a {
  37. pathS = append(pathS, a[i].Path)
  38. }
  39. return pathS
  40. }