mirror of
https://github.com/Forceu/Gokapi.git
synced 2026-04-26 08:30:20 -05:00
27 lines
790 B
Go
27 lines
790 B
Go
package models
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// UploadStatus contains information about the current status of a file upload
|
|
type UploadStatus struct {
|
|
// ChunkId is the identifier for the chunk
|
|
ChunkId string `json:"chunkid"`
|
|
// CurrentStatus indicates if the chunk is currently being processed (e.g. encrypting or
|
|
// hashing) or being moved/uploaded to the file storage
|
|
// See processingstatus for definition
|
|
CurrentStatus int `json:"currentstatus"`
|
|
// LastUpdate indicates the last status change
|
|
LastUpdate int64 `json:"lastupdate"`
|
|
// Type is the type of the message and is always "uploadstatus"
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
// ToJson returns the struct as a Json byte array
|
|
func (u *UploadStatus) ToJson() ([]byte, error) {
|
|
u.Type = "uploadstatus"
|
|
return json.Marshal(u)
|
|
|
|
}
|