2023-07-28 03:15:42 +00:00
|
|
|
|
package gmodel
|
|
|
|
|
|
|
|
|
|
import (
|
2023-09-07 03:28:06 +00:00
|
|
|
|
"gorm.io/gorm"
|
2023-09-07 10:28:19 +00:00
|
|
|
|
"time"
|
2023-07-28 03:15:42 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// fs_resource 资源表
|
|
|
|
|
type FsResource struct {
|
2023-10-20 08:42:58 +00:00
|
|
|
|
ResourceId string `gorm:"primary_key;default:'';" json:"resource_id"` // 资源 ID
|
|
|
|
|
UserId *int64 `gorm:"index;default:0;" json:"user_id"` // 用户 ID
|
|
|
|
|
GuestId *int64 `gorm:"index;default:0;" json:"guest_id"` // 访客 ID
|
|
|
|
|
ResourceType *string `gorm:"index;default:'';" json:"resource_type"` // 资源类型
|
|
|
|
|
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` //
|
|
|
|
|
Version *string `gorm:"index;default:'0';" json:"version"` // 版本信息
|
|
|
|
|
UploadedAt *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"uploaded_at"` //
|
|
|
|
|
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
|
|
|
|
|
ApiType *int64 `gorm:"default:1;" json:"api_type"` // 调用类型:1=对外,2=对内
|
|
|
|
|
BucketName *string `gorm:"default:'';" json:"bucket_name"` // 存储桶名: 1=持久 2=缓存
|
|
|
|
|
Source *string `gorm:"default:'';" json:"source"` // 来源
|
2023-07-28 03:15:42 +00:00
|
|
|
|
}
|
|
|
|
|
type FsResourceModel struct {
|
|
|
|
|
db *gorm.DB
|
|
|
|
|
name string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewFsResourceModel(db *gorm.DB) *FsResourceModel {
|
|
|
|
|
return &FsResourceModel{db: db, name: "fs_resource"}
|
|
|
|
|
}
|