bucket.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package model
  2. import (
  3. "go-common/library/time"
  4. )
  5. // Bucket in accord with bucket table in database
  6. type Bucket struct {
  7. ID int `json:"id" gorm:"column:id"`
  8. Name string `json:"name" gorm:"column:bucket_name"`
  9. Property int `json:"property" gorm:"column:property"`
  10. KeyID string `json:"key_id" gorm:"column:key_id"`
  11. KeySecret string `json:"key_secret" gorm:"column:key_secret"`
  12. PurgeCDN bool `json:"purge_cdn" gorm:"column:purge_cdn"`
  13. CacheControl int `json:"cache_control" gorm:"column:purge_cdn"`
  14. CTime time.Time `json:"ctime" gorm:"column:ctime"`
  15. MTime time.Time `json:"mtime" gorm:"column:mtime"`
  16. DirLimit map[string]*DirConfig `json:"dir_limit" gorm:"-"`
  17. }
  18. // DirLimit in accord with dir_limit table in database
  19. type DirLimit struct {
  20. ID int `json:"id" gorm:"column:id"`
  21. BucketName string `json:"bucket_name" gorm:"column:bucket_name"`
  22. Dir string `json:"dir" gorm:"column:dir"`
  23. DirPicConfig string `json:"dir_pic_config" gorm:"column:config_pic"`
  24. DirRateConfig string `json:"dir_rate_config" gorm:"column:config_rate"`
  25. CTime time.Time `json:"ctime" gorm:"column:ctime"`
  26. MTime time.Time `json:"mtime" gorm:"column:mtime"`
  27. }
  28. // TableName return table name.
  29. func (b Bucket) TableName() string {
  30. return "bucket"
  31. }
  32. // TableName return table name.
  33. func (l DirLimit) TableName() string {
  34. return "dir_limit"
  35. }