Private
Public Access
1
0

scores: json handler
Some checks failed
continuous-integration/drone/push Build was killed

This commit is contained in:
2023-12-10 21:42:15 -08:00
parent 61245cc77c
commit f6b0f96a34
7 changed files with 358 additions and 85 deletions

View File

@@ -142,6 +142,49 @@ func (ns NullMonitorsType) Value() (driver.Value, error) {
return string(ns.MonitorsType), nil
}
type ServerScoresStatus string
const (
ServerScoresStatusNew ServerScoresStatus = "new"
ServerScoresStatusTesting ServerScoresStatus = "testing"
ServerScoresStatusActive ServerScoresStatus = "active"
)
func (e *ServerScoresStatus) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = ServerScoresStatus(s)
case string:
*e = ServerScoresStatus(s)
default:
return fmt.Errorf("unsupported scan type for ServerScoresStatus: %T", src)
}
return nil
}
type NullServerScoresStatus struct {
ServerScoresStatus ServerScoresStatus `json:"server_scores_status"`
Valid bool `json:"valid"` // Valid is true if ServerScoresStatus is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullServerScoresStatus) Scan(value interface{}) error {
if value == nil {
ns.ServerScoresStatus, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.ServerScoresStatus.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullServerScoresStatus) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.ServerScoresStatus), nil
}
type ServersIpVersion string
const (