Documentation ¶
Index ¶
- func SyncModels()
- type Asset
- func (t *Asset) BeforeCreate(_ *gorm.DB) (err error)
- func (t *Asset) Delete() error
- func (t *Asset) FillByDigest(digest string) error
- func (t *Asset) FillById(id string) error
- func (t *Asset) FillByUploadUUID(uploadUUID string) error
- func (t *Asset) GetVersion() (version *PackageVersion[any], err error)
- func (t *Asset) Insert() error
- func (t *Asset) SetRandomDigest()
- func (t *Asset) StartUpload() error
- func (*Asset) TableName() string
- func (t *Asset) Update() error
- type Package
- func (p *Package[MetaType]) BeforeCreate(_ *gorm.DB) (err error)
- func (p *Package[T]) Delete() error
- func (p *Package[T]) FillByName(name string) error
- func (p *Package[T]) FillVersions() error
- func (p *Package[T]) Insert() error
- func (p *Package[T]) InsertVersion(version PackageVersion[T]) error
- func (p *Package[T]) Save() error
- func (*Package[T]) TableName() string
- func (p *Package[T]) Version(name string) (PackageVersion[T], error)
- type PackageVersion
- func (p *PackageVersion[T]) AddAsset(asset *Asset) error
- func (p *PackageVersion[T]) BeforeCreate(_ *gorm.DB) (err error)
- func (p *PackageVersion[T]) Delete() error
- func (p *PackageVersion[T]) FillByDigest(digest string) error
- func (p *PackageVersion[T]) FillById(id uint64) error
- func (p *PackageVersion[T]) FillByName(version string) error
- func (p *PackageVersion[T]) GetAssets() (assets []Asset, err error)
- func (p *PackageVersion[T]) Insert() error
- func (p *PackageVersion[T]) Save() error
- func (p *PackageVersion[T]) SaveMeta() error
- func (p *PackageVersion[T]) SetAssets(assets []Asset) (err error)
- func (*PackageVersion[T]) TableName() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SyncModels ¶
func SyncModels()
Types ¶
type Asset ¶
type Asset struct { ID uuid.UUID `gorm:"column:id;primaryKey;" json:"id" binding:"required"` Service string `gorm:"column:service;not null" json:"service" binding:"required"` Digest string `gorm:"column:digest;index,not null;uniqueIndex" json:"digest" binding:"required"` Size int64 `gorm:"column:size;not null" json:"size" binding:"required"` UploadUUID string `gorm:"column:upload_uuid;uniqueIndex;not null" json:"upload_uuid" binding:"required"` UploadRange string `gorm:"column:upload_range;not null" json:"upload_range" binding:"required"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` }
func (*Asset) FillByDigest ¶
func (*Asset) FillByUploadUUID ¶
func (*Asset) GetVersion ¶
func (t *Asset) GetVersion() (version *PackageVersion[any], err error)
func (*Asset) SetRandomDigest ¶
func (t *Asset) SetRandomDigest()
func (*Asset) StartUpload ¶
type Package ¶
type Package[MetaType any] struct { ID uuid.UUID `gorm:"column:id;primaryKey;" json:"id" binding:"required"` Name string `gorm:"column:name;uniqueIndex:name_auth_service;not null" json:"name" binding:"required"` Service string `gorm:"column:service;uniqueIndex:name_auth_service;not null" json:"service" binding:"required"` // AuthId is used to identify the owner of the package tied to the authentication process AuthId string `gorm:"column:auth_id;not null" json:"auth_id" binding:"required"` Namespace string `gorm:"column:namespace;uniqueIndex:name_auth_service;not null" json:"namespace" binding:"required"` IsPublic bool `gorm:"column:is_public;not null;default:false" json:"is_public" binding:"required"` LatestVersion string `gorm:"column:latest_version" json:"latest_version"` Versions []PackageVersion[MetaType] `gorm:"foreignKey:PackageId;references:ID;constraint:OnDelete:CASCADE;" json:"versions"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` }
func (*Package[MetaType]) BeforeCreate ¶
func (*Package[T]) FillByName ¶
func (*Package[T]) FillVersions ¶
func (*Package[T]) InsertVersion ¶
func (p *Package[T]) InsertVersion(version PackageVersion[T]) error
type PackageVersion ¶
type PackageVersion[MetaType any] struct { ID uuid.UUID `gorm:"column:id;primaryKey;" json:"id" binding:"required"` Service string `gorm:"column:service;not null" json:"service" binding:"required"` AuthId string `gorm:"column:auth_id;index;not null" json:"auth_id" binding:"required"` Namespace string `gorm:"column:namespace;index;not null" json:"namespace" binding:"required"` Digest string `gorm:"column:digest;index" json:"digest"` Size int64 `gorm:"column:size;not null" json:"size" binding:"required"` PackageId uuid.UUID `gorm:"column:package_id;uniqueIndex:pkg_id_version;uniqueIndex:pkg_id_tag;" json:"package_id" binding:"required"` Version string `gorm:"column:version;not null;uniqueIndex:pkg_id_version" json:"version" binding:"required"` Tag string `gorm:"column:tag;uniqueIndex:pkg_id_tag" json:"tag"` Metadata datatypes.JSONType[MetaType] `gorm:"column:metadata" json:"metadata"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` AssetIds string `gorm:"column:asset_ids" json:"asset_ids"` }
func (*PackageVersion[T]) AddAsset ¶
func (p *PackageVersion[T]) AddAsset(asset *Asset) error
func (*PackageVersion[T]) BeforeCreate ¶
func (p *PackageVersion[T]) BeforeCreate(_ *gorm.DB) (err error)
func (*PackageVersion[T]) Delete ¶
func (p *PackageVersion[T]) Delete() error
func (*PackageVersion[T]) FillByDigest ¶
func (p *PackageVersion[T]) FillByDigest(digest string) error
func (*PackageVersion[T]) FillById ¶
func (p *PackageVersion[T]) FillById(id uint64) error
func (*PackageVersion[T]) FillByName ¶
func (p *PackageVersion[T]) FillByName(version string) error
func (*PackageVersion[T]) GetAssets ¶
func (p *PackageVersion[T]) GetAssets() (assets []Asset, err error)
func (*PackageVersion[T]) Insert ¶
func (p *PackageVersion[T]) Insert() error
func (*PackageVersion[T]) Save ¶
func (p *PackageVersion[T]) Save() error
func (*PackageVersion[T]) SaveMeta ¶
func (p *PackageVersion[T]) SaveMeta() error
func (*PackageVersion[T]) SetAssets ¶
func (p *PackageVersion[T]) SetAssets(assets []Asset) (err error)
func (*PackageVersion[T]) TableName ¶
func (*PackageVersion[T]) TableName() string
Click to show internal directories.
Click to hide internal directories.