brunel/domain/packages.go
2024-07-28 19:59:50 +01:00

75 lines
1.6 KiB
Go

package domain
import (
"brunel/fastmap"
"time"
)
type PackagesCount struct {
Stale int `json:"stale"`
Missing int `json:"missing"`
Current int `json:"built"`
Error int `json:"error"`
Queued int `json:"queued"`
Building int `json:"building"`
}
type BuildQueue *fastmap.Fastmap[string, BuildQueueItem]
type BuildQueueItem struct {
Source SourcePackage
Status BuildStatus
Patch bool
LTO bool
Rebuild bool
BuildNumber int
BuildVersion string
I386 bool
}
type SourcePackage struct {
Name string `gorm:"primarykey"`
Packages *fastmap.Fastmap[string, PackageInfo] `gorm:"foreignKey:PackageInfo;references:PackageName"`
}
type SourcePackageDTO struct {
Name string `gorm:"primarykey"`
Packages []PackageInfo `gorm:"foreignKey:PackageName"`
}
type PackageInfo struct {
PackageName string `gorm:"primarykey"`
Version string
Source string
Architecture string
Description string
Status PackageStatus
NewVersion string
LastBuildStatus PackageStatus
}
type PackageStatus string
type BuildStatus string
const (
// Package is built
Built PackageStatus = "Built"
// Package is stale
Stale PackageStatus = "Stale"
// Package build errored out
Error PackageStatus = "Error"
// Package is being missing
Missing PackageStatus = "Missing"
// Package is upto date
Current PackageStatus = "Current"
// Package is queued for building
Queued BuildStatus = "Queued"
// Package is being built
Building BuildStatus = "Building"
)
type TimeContainer struct {
ID string
Time time.Time
}