mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
* Move BackupDatabase and AnonymiseDatabase to internal/manager * Rename config.Instance to config.Config * Rename FFMPEG * Rework manager and initialization process * Fix Makefile * Tweak phasher * Fix config races * Fix setup error not clearing
50 lines
1,009 B
Go
50 lines
1,009 B
Go
package manager
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"strconv"
|
|
)
|
|
|
|
type SystemStatusEnum string
|
|
|
|
const (
|
|
SystemStatusEnumSetup SystemStatusEnum = "SETUP"
|
|
SystemStatusEnumNeedsMigration SystemStatusEnum = "NEEDS_MIGRATION"
|
|
SystemStatusEnumOk SystemStatusEnum = "OK"
|
|
)
|
|
|
|
var AllSystemStatusEnum = []SystemStatusEnum{
|
|
SystemStatusEnumSetup,
|
|
SystemStatusEnumNeedsMigration,
|
|
SystemStatusEnumOk,
|
|
}
|
|
|
|
func (e SystemStatusEnum) IsValid() bool {
|
|
switch e {
|
|
case SystemStatusEnumSetup, SystemStatusEnumNeedsMigration, SystemStatusEnumOk:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (e SystemStatusEnum) String() string {
|
|
return string(e)
|
|
}
|
|
|
|
func (e *SystemStatusEnum) UnmarshalGQL(v interface{}) error {
|
|
str, ok := v.(string)
|
|
if !ok {
|
|
return fmt.Errorf("enums must be strings")
|
|
}
|
|
|
|
*e = SystemStatusEnum(str)
|
|
if !e.IsValid() {
|
|
return fmt.Errorf("%s is not a valid SystemStatusEnum", str)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (e SystemStatusEnum) MarshalGQL(w io.Writer) {
|
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
|
}
|