Browse Source

grom 结构示例

master
dark 6 months ago
parent
commit
0a533c4ea7
  1. 24
      structs/file.go
  2. 17
      structs/path.go

24
structs/file.go

@ -0,0 +1,24 @@
package OrmStructs
import "gorm.io/gorm"
type File struct {
ID int64 `gorm:"type:bigint;primary_key;AUTO_INCREMENT;comment:文件id"` // 文件id
Name string `gorm:"type:varchar(255);not null;index:index_check;comment:文件名称"` // 文件名称
Size int64 `gorm:"type:bigint;not null;comment:文件大小"` // 文件大小
Path string `gorm:"type:varchar(255);not null;index:index_check;comment:文件路径"` // 文件路径
OrigName string `gorm:"type:varchar(255);not null;comment:文件原始名称"` // 文件原始名称
Type string `gorm:"type:varchar(255);not null;comment:文件类型"` // 文件url
Hash string `gorm:"type:varchar(255);not null;comment:文件hash"` // 文件hash
CreaterUserID int64 `gorm:"type:bigint;not null;comment:创建者id"` // 创建者id
CreaterUserName string `gorm:"type:varchar(255);not null;comment:创建者名称"` // 创建者名称
UpdaterUserID int64 `gorm:"type:bigint;not null;comment:更新者id"` // 更新者id
UpdaterUserName string `gorm:"type:varchar(255);not null;comment:更新者名称"` // 更新者名称
DeleterUserID int64 `gorm:"type:bigint;not null;comment:删除者id"` // 删除者id
DeleterUserName string `gorm:"type:varchar(255);not null;comment:删除者名称"` // 删除者名称
ConnectID int64 `gorm:"type:bigint;not null;index;comment:连接id"` // 连接id
ConnectName string `gorm:"type:varchar(255);not null;comment:连接名称"` // 连接名称
ConnectType string `gorm:"type:varchar(255);not null;comment:连接类型"` // 连接类型
Tenant string `gorm:"type:varchar(255);not null;index:index_check;comment:租户"` // 租户
gorm.Model
}

17
structs/path.go

@ -0,0 +1,17 @@
package OrmStructs
import "gorm.io/gorm"
type Path struct {
ID int64 `gorm:"type:bigint;primary_key;AUTO_INCREMENT;comment:文件id"` // 目录id
Name string `gorm:"type:varchar(255);not null;comment:目录名称"` // 目录名称
ParentID int64 `gorm:"type:bigint;not null;comment:父级目录id"` // 父级目录id
CreaterUserID int64 `gorm:"type:bigint;not null;comment:创建者id"` // 创建者id
CreaterUserName string `gorm:"type:varchar(255);not null;comment:创建者名称"` // 创建者名称
UpdaterUserID int64 `gorm:"type:bigint;not null;comment:更新者id"` // 更新者id
UpdaterUserName string `gorm:"type:varchar(255);not null;comment:更新者名称"`
DeleterUserID int64 `gorm:"type:bigint;not null;comment:删除者id"` // 删除者id
DeleterUserName string `gorm:"type:varchar(255);not null;comment:删除者名称"` // 删除者名称
Tenant int64 `gorm:"type:varchar(255);not null;comment:租户"` // 租户
gorm.Model
}
Loading…
Cancel
Save