mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
577 B
28 lines
577 B
package model
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
type AttachmentType int
|
|
|
|
const (
|
|
ATTACHMENT_TYPE_IMAGE AttachmentType = iota + 1
|
|
ATTACHMENT_TYPE_VIDEO
|
|
ATTACHMENT_TYPE_OTHER
|
|
)
|
|
|
|
type Attachment struct {
|
|
*Model
|
|
UserID int64 `json:"user_id"`
|
|
FileSize int64 `json:"file_size"`
|
|
ImgWidth int `json:"img_width"`
|
|
ImgHeight int `json:"img_height"`
|
|
Type AttachmentType `json:"type"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
func (a *Attachment) Create(db *gorm.DB) (*Attachment, error) {
|
|
err := db.Create(&a).Error
|
|
|
|
return a, err
|
|
}
|