package db import ( "encoding/json" "fmt" ) type InstallContext string const ( InstallContextUser InstallContext = "user" InstallContextGuild InstallContext = "guild" ) func (c InstallContext) String() string { return string(c) } func (c InstallContext) IsValid() bool { switch c { case InstallContextUser, InstallContextGuild: return true default: return false } } type BotStatus string const ( BotStatusDeleted BotStatus = "deleted" BotStatusPending BotStatus = "pending" BotStatusRejected BotStatus = "rejected" BotStatusApproved BotStatus = "approved" ) func (s BotStatus) String() string { return string(s) } func (s BotStatus) IsValid() bool { switch s { case BotStatusDeleted, BotStatusPending, BotStatusRejected, BotStatusApproved: return true default: return false } } type CoOwnerSlice []User func (c *CoOwnerSlice) Scan(src any) error { b, ok := src.([]byte) if !ok { return fmt.Errorf("expected []byte, got %T", src) } return json.Unmarshal(b, c) }