light modification

This commit is contained in:
mr
2025-01-15 10:56:44 +01:00
parent ad69c04951
commit be38030395
14 changed files with 208 additions and 218 deletions

View File

@@ -0,0 +1,15 @@
package enum
type InfrastructureType int
const (
DOCKER InfrastructureType = iota
KUBERNETES
SLURM
HW
CONDOR
)
func (t InfrastructureType) String() string {
return [...]string{"DOCKER", "KUBERNETES", "SLURM", "HW", "CONDOR"}[t]
}

View File

@@ -0,0 +1,38 @@
package enum
type ScheduledType int
const (
DRAFT ScheduledType = iota
SCHEDULED
STARTED
FAILURE
SUCCESS
FORGOTTEN
DELAYED
CANCELLED
)
var str = [...]string{
"draft",
"scheduled",
"started",
"failure",
"success",
"forgotten",
"delayed",
"cancelled",
}
func FromInt(i int) string {
return str[i]
}
func (d ScheduledType) String() string {
return str[d]
}
// EnumIndex - Creating common behavior-give the type a EnumIndex functio
func (d ScheduledType) EnumIndex() int {
return int(d)
}

View File

@@ -0,0 +1,41 @@
package enum
type StorageSize int
// StorageType - Enum that defines the type of storage
const (
GB StorageSize = iota
MB
KB
TB
)
var argoType = [...]string{
"Gi",
"Mi",
"Ki",
"Ti",
}
// New creates a new instance of the StorageResource struct
func (dma StorageSize) ToArgo() string {
return argoType[dma]
}
// enum of a data type
type StorageType int
const (
FILE = iota
STREAM
API
DATABASE
S3
MEMORY
HARDWARE
)
// String() - Returns the string representation of the storage type
func (t StorageType) String() string {
return [...]string{"FILE", "STREAM", "API", "DATABASE", "S3", "MEMORY", "HARDWARE"}[t]
}