package model import ( "time" "gorm.io/gorm" ) // Repository ???? type Repository struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Name string `gorm:"uniqueIndex;not null" json:"name"` // ?????? "library/nginx" } // Blob blob ?? type Blob struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Digest string `gorm:"uniqueIndex;not null" json:"digest"` // SHA256 digest Size int64 `gorm:"not null" json:"size"` // ?????? MediaType string `json:"media_type"` // ???? Repository string `gorm:"index" json:"repository"` // ??????????????? } // Manifest manifest ?? type Manifest struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Repository string `gorm:"index;not null" json:"repository"` // ???? Tag string `gorm:"index;not null" json:"tag"` // tag ?? Digest string `gorm:"uniqueIndex;not null" json:"digest"` // manifest digest MediaType string `json:"media_type"` // ???? Size int64 `gorm:"not null" json:"size"` // manifest ?? Content []byte `gorm:"type:blob" json:"-"` // manifest ???JSON? } // Tag tag ?????????? type Tag struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Repository string `gorm:"index;not null" json:"repository"` // ???? Tag string `gorm:"index;not null" json:"tag"` // tag ?? Digest string `gorm:"not null" json:"digest"` // ??? manifest digest } // BlobUpload ????? blob ?? type BlobUpload struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` UUID string `gorm:"uniqueIndex;not null" json:"uuid"` // ???? UUID Repository string `gorm:"index;not null" json:"repository"` // ???? Path string `gorm:"not null" json:"path"` // ?????? Size int64 `gorm:"default:0" json:"size"` // ????? } // RegistryConfig registry ????? type RegistryConfig struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Key string `gorm:"uniqueIndex;not null" json:"key"` // ???? key Value string `gorm:"type:text" json:"value"` // ???? value }