You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

model.go 2.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package model
  2. import (
  3. "time"
  4. cdssdk "gitlink.org.cn/cloudream/common/sdks/storage"
  5. stgmod "gitlink.org.cn/cloudream/storage/common/models"
  6. )
  7. // TODO 可以考虑逐步迁移到cdssdk中。迁移思路:数据对象应该包含的字段都迁移到cdssdk中,内部使用的一些特殊字段则留在这里
  8. type Storage = cdssdk.Storage
  9. type User struct {
  10. UserID cdssdk.UserID `gorm:"column:UserID; primaryKey; type:bigint" json:"userID"`
  11. Password string `gorm:"column:Password; type:varchar(255); not null" json:"password"`
  12. }
  13. func (User) TableName() string {
  14. return "User"
  15. }
  16. type UserBucket struct {
  17. UserID cdssdk.UserID `gorm:"column:UserID; primaryKey; type:bigint" json:"userID"`
  18. BucketID cdssdk.BucketID `gorm:"column:BucketID; primaryKey; type:bigint" json:"bucketID"`
  19. }
  20. func (UserBucket) TableName() string {
  21. return "UserBucket"
  22. }
  23. type UserHub struct {
  24. UserID cdssdk.UserID `gorm:"column:UserID; primaryKey; type:bigint" json:"userID"`
  25. HubID cdssdk.HubID `gorm:"column:HubID; primaryKey; type:bigint" json:"hubID"`
  26. }
  27. func (UserHub) TableName() string {
  28. return "UserHub"
  29. }
  30. type UserStorage struct {
  31. UserID cdssdk.UserID `gorm:"column:UserID; primaryKey; type:bigint" json:"userID"`
  32. StorageID cdssdk.StorageID `gorm:"column:StorageID; primaryKey; type:bigint" json:"storageID"`
  33. }
  34. func (UserStorage) TableName() string {
  35. return "UserStorage"
  36. }
  37. type Bucket = cdssdk.Bucket
  38. type Package = cdssdk.Package
  39. type Object = cdssdk.Object
  40. type HubConnectivity = cdssdk.HubConnectivity
  41. type ObjectBlock = stgmod.ObjectBlock
  42. type Cache struct {
  43. FileHash cdssdk.FileHash `gorm:"column:FileHash; primaryKey; type: char(68)" json:"fileHash"`
  44. StorageID cdssdk.StorageID `gorm:"column:StorageID; primaryKey; type: bigint" json:"storageID"`
  45. CreateTime time.Time `gorm:"column:CreateTime; type:datetime" json:"createTime"`
  46. Priority int `gorm:"column:Priority; type:int" json:"priority"`
  47. }
  48. func (Cache) TableName() string {
  49. return "Cache"
  50. }
  51. type Location struct {
  52. LocationID cdssdk.LocationID `gorm:"column:LocationID; primaryKey; type:bigint; autoIncrement" json:"locationID"`
  53. Name string `gorm:"column:Name; type:varchar(255); not null" json:"name"`
  54. }
  55. func (Location) TableName() string {
  56. return "Location"
  57. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。