You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/models/file.go

47 lines
692 B
Go

3 years ago
package models
import (
"fmt"
"github.com/veypi/utils"
"time"
)
// File es model
type File struct {
_id string
CreatedAt time.Time
OwnerID string
Path string
Size uint
MD5 string
Count uint
Tag string
}
func (f *File) ID() string {
if f._id != "" {
return f._id
}
f._id = utils.HashMd5(fmt.Sprintf("%s@%s", f.OwnerID, f.Path))
return f._id
}
type Action string
const (
ActGet Action = "read"
ActPut Action = "put"
ActDelete Action = "delete"
ActRename Action = "rename"
)
type History struct {
CreatedAt time.Time
ActorID string
OwnerID string
FileID string
Action Action
Tag string
IP string
}