665 lines
16 KiB
Go
665 lines
16 KiB
Go
// Code generated by go-enum DO NOT EDIT.
|
|
// Version: -
|
|
// Revision: -
|
|
// Build Date: -
|
|
// Built By: -
|
|
|
|
package consts
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"errors"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
// RoleUser is a Role of type user.
|
|
RoleUser Role = "user"
|
|
// RoleSuperAdmin is a Role of type super_admin.
|
|
RoleSuperAdmin Role = "super_admin"
|
|
)
|
|
|
|
var ErrInvalidRole = fmt.Errorf("not a valid Role, try [%s]", strings.Join(_RoleNames, ", "))
|
|
|
|
var _RoleNames = []string{
|
|
string(RoleUser),
|
|
string(RoleSuperAdmin),
|
|
}
|
|
|
|
// RoleNames returns a list of possible string values of Role.
|
|
func RoleNames() []string {
|
|
tmp := make([]string, len(_RoleNames))
|
|
copy(tmp, _RoleNames)
|
|
return tmp
|
|
}
|
|
|
|
// RoleValues returns a list of the values for Role
|
|
func RoleValues() []Role {
|
|
return []Role{
|
|
RoleUser,
|
|
RoleSuperAdmin,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x Role) String() string {
|
|
return string(x)
|
|
}
|
|
|
|
// IsValid provides a quick way to determine if the typed value is
|
|
// part of the allowed enumerated values
|
|
func (x Role) IsValid() bool {
|
|
_, err := ParseRole(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _RoleValue = map[string]Role{
|
|
"user": RoleUser,
|
|
"super_admin": RoleSuperAdmin,
|
|
}
|
|
|
|
// ParseRole attempts to convert a string to a Role.
|
|
func ParseRole(name string) (Role, error) {
|
|
if x, ok := _RoleValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return Role(""), fmt.Errorf("%s is %w", name, ErrInvalidRole)
|
|
}
|
|
|
|
var errRoleNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *Role) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = Role("")
|
|
return
|
|
}
|
|
|
|
// A wider range of scannable types.
|
|
// driver.Value values at the top of the list for expediency
|
|
switch v := value.(type) {
|
|
case string:
|
|
*x, err = ParseRole(v)
|
|
case []byte:
|
|
*x, err = ParseRole(string(v))
|
|
case Role:
|
|
*x = v
|
|
case *Role:
|
|
if v == nil {
|
|
return errRoleNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errRoleNilPtr
|
|
}
|
|
*x, err = ParseRole(*v)
|
|
default:
|
|
return errors.New("invalid type for Role")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x Role) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *Role) Set(val string) error {
|
|
v, err := ParseRole(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *Role) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *Role) Type() string {
|
|
return "Role"
|
|
}
|
|
|
|
type NullRole struct {
|
|
Role Role
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullRole(val interface{}) (x NullRole) {
|
|
err := x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
_ = err // make any errcheck linters happy
|
|
return
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *NullRole) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.Role, x.Valid = Role(""), false
|
|
return
|
|
}
|
|
|
|
err = x.Role.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullRole) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.Role), nil
|
|
}
|
|
|
|
type NullRoleStr struct {
|
|
NullRole
|
|
}
|
|
|
|
func NewNullRoleStr(val interface{}) (x NullRoleStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullRoleStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.Role.String(), nil
|
|
}
|
|
|
|
const (
|
|
// TenantStatusPendingVerify is a TenantStatus of type pending_verify.
|
|
TenantStatusPendingVerify TenantStatus = "pending_verify"
|
|
// TenantStatusVerified is a TenantStatus of type verified.
|
|
TenantStatusVerified TenantStatus = "verified"
|
|
// TenantStatusBanned is a TenantStatus of type banned.
|
|
TenantStatusBanned TenantStatus = "banned"
|
|
)
|
|
|
|
var ErrInvalidTenantStatus = fmt.Errorf("not a valid TenantStatus, try [%s]", strings.Join(_TenantStatusNames, ", "))
|
|
|
|
var _TenantStatusNames = []string{
|
|
string(TenantStatusPendingVerify),
|
|
string(TenantStatusVerified),
|
|
string(TenantStatusBanned),
|
|
}
|
|
|
|
// TenantStatusNames returns a list of possible string values of TenantStatus.
|
|
func TenantStatusNames() []string {
|
|
tmp := make([]string, len(_TenantStatusNames))
|
|
copy(tmp, _TenantStatusNames)
|
|
return tmp
|
|
}
|
|
|
|
// TenantStatusValues returns a list of the values for TenantStatus
|
|
func TenantStatusValues() []TenantStatus {
|
|
return []TenantStatus{
|
|
TenantStatusPendingVerify,
|
|
TenantStatusVerified,
|
|
TenantStatusBanned,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x TenantStatus) String() string {
|
|
return string(x)
|
|
}
|
|
|
|
// IsValid provides a quick way to determine if the typed value is
|
|
// part of the allowed enumerated values
|
|
func (x TenantStatus) IsValid() bool {
|
|
_, err := ParseTenantStatus(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _TenantStatusValue = map[string]TenantStatus{
|
|
"pending_verify": TenantStatusPendingVerify,
|
|
"verified": TenantStatusVerified,
|
|
"banned": TenantStatusBanned,
|
|
}
|
|
|
|
// ParseTenantStatus attempts to convert a string to a TenantStatus.
|
|
func ParseTenantStatus(name string) (TenantStatus, error) {
|
|
if x, ok := _TenantStatusValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return TenantStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidTenantStatus)
|
|
}
|
|
|
|
var errTenantStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *TenantStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = TenantStatus("")
|
|
return
|
|
}
|
|
|
|
// A wider range of scannable types.
|
|
// driver.Value values at the top of the list for expediency
|
|
switch v := value.(type) {
|
|
case string:
|
|
*x, err = ParseTenantStatus(v)
|
|
case []byte:
|
|
*x, err = ParseTenantStatus(string(v))
|
|
case TenantStatus:
|
|
*x = v
|
|
case *TenantStatus:
|
|
if v == nil {
|
|
return errTenantStatusNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errTenantStatusNilPtr
|
|
}
|
|
*x, err = ParseTenantStatus(*v)
|
|
default:
|
|
return errors.New("invalid type for TenantStatus")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x TenantStatus) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *TenantStatus) Set(val string) error {
|
|
v, err := ParseTenantStatus(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *TenantStatus) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *TenantStatus) Type() string {
|
|
return "TenantStatus"
|
|
}
|
|
|
|
type NullTenantStatus struct {
|
|
TenantStatus TenantStatus
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullTenantStatus(val interface{}) (x NullTenantStatus) {
|
|
err := x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
_ = err // make any errcheck linters happy
|
|
return
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *NullTenantStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.TenantStatus, x.Valid = TenantStatus(""), false
|
|
return
|
|
}
|
|
|
|
err = x.TenantStatus.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullTenantStatus) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.TenantStatus), nil
|
|
}
|
|
|
|
type NullTenantStatusStr struct {
|
|
NullTenantStatus
|
|
}
|
|
|
|
func NewNullTenantStatusStr(val interface{}) (x NullTenantStatusStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullTenantStatusStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.TenantStatus.String(), nil
|
|
}
|
|
|
|
const (
|
|
// TenantUserRoleMember is a TenantUserRole of type member.
|
|
TenantUserRoleMember TenantUserRole = "member"
|
|
// TenantUserRoleTenantAdmin is a TenantUserRole of type tenant_admin.
|
|
TenantUserRoleTenantAdmin TenantUserRole = "tenant_admin"
|
|
)
|
|
|
|
var ErrInvalidTenantUserRole = fmt.Errorf("not a valid TenantUserRole, try [%s]", strings.Join(_TenantUserRoleNames, ", "))
|
|
|
|
var _TenantUserRoleNames = []string{
|
|
string(TenantUserRoleMember),
|
|
string(TenantUserRoleTenantAdmin),
|
|
}
|
|
|
|
// TenantUserRoleNames returns a list of possible string values of TenantUserRole.
|
|
func TenantUserRoleNames() []string {
|
|
tmp := make([]string, len(_TenantUserRoleNames))
|
|
copy(tmp, _TenantUserRoleNames)
|
|
return tmp
|
|
}
|
|
|
|
// TenantUserRoleValues returns a list of the values for TenantUserRole
|
|
func TenantUserRoleValues() []TenantUserRole {
|
|
return []TenantUserRole{
|
|
TenantUserRoleMember,
|
|
TenantUserRoleTenantAdmin,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x TenantUserRole) String() string {
|
|
return string(x)
|
|
}
|
|
|
|
// IsValid provides a quick way to determine if the typed value is
|
|
// part of the allowed enumerated values
|
|
func (x TenantUserRole) IsValid() bool {
|
|
_, err := ParseTenantUserRole(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _TenantUserRoleValue = map[string]TenantUserRole{
|
|
"member": TenantUserRoleMember,
|
|
"tenant_admin": TenantUserRoleTenantAdmin,
|
|
}
|
|
|
|
// ParseTenantUserRole attempts to convert a string to a TenantUserRole.
|
|
func ParseTenantUserRole(name string) (TenantUserRole, error) {
|
|
if x, ok := _TenantUserRoleValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return TenantUserRole(""), fmt.Errorf("%s is %w", name, ErrInvalidTenantUserRole)
|
|
}
|
|
|
|
var errTenantUserRoleNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *TenantUserRole) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = TenantUserRole("")
|
|
return
|
|
}
|
|
|
|
// A wider range of scannable types.
|
|
// driver.Value values at the top of the list for expediency
|
|
switch v := value.(type) {
|
|
case string:
|
|
*x, err = ParseTenantUserRole(v)
|
|
case []byte:
|
|
*x, err = ParseTenantUserRole(string(v))
|
|
case TenantUserRole:
|
|
*x = v
|
|
case *TenantUserRole:
|
|
if v == nil {
|
|
return errTenantUserRoleNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errTenantUserRoleNilPtr
|
|
}
|
|
*x, err = ParseTenantUserRole(*v)
|
|
default:
|
|
return errors.New("invalid type for TenantUserRole")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x TenantUserRole) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *TenantUserRole) Set(val string) error {
|
|
v, err := ParseTenantUserRole(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *TenantUserRole) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *TenantUserRole) Type() string {
|
|
return "TenantUserRole"
|
|
}
|
|
|
|
type NullTenantUserRole struct {
|
|
TenantUserRole TenantUserRole
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullTenantUserRole(val interface{}) (x NullTenantUserRole) {
|
|
err := x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
_ = err // make any errcheck linters happy
|
|
return
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *NullTenantUserRole) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.TenantUserRole, x.Valid = TenantUserRole(""), false
|
|
return
|
|
}
|
|
|
|
err = x.TenantUserRole.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullTenantUserRole) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.TenantUserRole), nil
|
|
}
|
|
|
|
type NullTenantUserRoleStr struct {
|
|
NullTenantUserRole
|
|
}
|
|
|
|
func NewNullTenantUserRoleStr(val interface{}) (x NullTenantUserRoleStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullTenantUserRoleStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.TenantUserRole.String(), nil
|
|
}
|
|
|
|
const (
|
|
// UserStatusPendingVerify is a UserStatus of type pending_verify.
|
|
UserStatusPendingVerify UserStatus = "pending_verify"
|
|
// UserStatusVerified is a UserStatus of type verified.
|
|
UserStatusVerified UserStatus = "verified"
|
|
// UserStatusBanned is a UserStatus of type banned.
|
|
UserStatusBanned UserStatus = "banned"
|
|
)
|
|
|
|
var ErrInvalidUserStatus = fmt.Errorf("not a valid UserStatus, try [%s]", strings.Join(_UserStatusNames, ", "))
|
|
|
|
var _UserStatusNames = []string{
|
|
string(UserStatusPendingVerify),
|
|
string(UserStatusVerified),
|
|
string(UserStatusBanned),
|
|
}
|
|
|
|
// UserStatusNames returns a list of possible string values of UserStatus.
|
|
func UserStatusNames() []string {
|
|
tmp := make([]string, len(_UserStatusNames))
|
|
copy(tmp, _UserStatusNames)
|
|
return tmp
|
|
}
|
|
|
|
// UserStatusValues returns a list of the values for UserStatus
|
|
func UserStatusValues() []UserStatus {
|
|
return []UserStatus{
|
|
UserStatusPendingVerify,
|
|
UserStatusVerified,
|
|
UserStatusBanned,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x UserStatus) String() string {
|
|
return string(x)
|
|
}
|
|
|
|
// IsValid provides a quick way to determine if the typed value is
|
|
// part of the allowed enumerated values
|
|
func (x UserStatus) IsValid() bool {
|
|
_, err := ParseUserStatus(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _UserStatusValue = map[string]UserStatus{
|
|
"pending_verify": UserStatusPendingVerify,
|
|
"verified": UserStatusVerified,
|
|
"banned": UserStatusBanned,
|
|
}
|
|
|
|
// ParseUserStatus attempts to convert a string to a UserStatus.
|
|
func ParseUserStatus(name string) (UserStatus, error) {
|
|
if x, ok := _UserStatusValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return UserStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidUserStatus)
|
|
}
|
|
|
|
var errUserStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *UserStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = UserStatus("")
|
|
return
|
|
}
|
|
|
|
// A wider range of scannable types.
|
|
// driver.Value values at the top of the list for expediency
|
|
switch v := value.(type) {
|
|
case string:
|
|
*x, err = ParseUserStatus(v)
|
|
case []byte:
|
|
*x, err = ParseUserStatus(string(v))
|
|
case UserStatus:
|
|
*x = v
|
|
case *UserStatus:
|
|
if v == nil {
|
|
return errUserStatusNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errUserStatusNilPtr
|
|
}
|
|
*x, err = ParseUserStatus(*v)
|
|
default:
|
|
return errors.New("invalid type for UserStatus")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x UserStatus) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *UserStatus) Set(val string) error {
|
|
v, err := ParseUserStatus(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *UserStatus) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *UserStatus) Type() string {
|
|
return "UserStatus"
|
|
}
|
|
|
|
type NullUserStatus struct {
|
|
UserStatus UserStatus
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullUserStatus(val interface{}) (x NullUserStatus) {
|
|
err := x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
_ = err // make any errcheck linters happy
|
|
return
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *NullUserStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.UserStatus, x.Valid = UserStatus(""), false
|
|
return
|
|
}
|
|
|
|
err = x.UserStatus.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullUserStatus) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.UserStatus), nil
|
|
}
|
|
|
|
type NullUserStatusStr struct {
|
|
NullUserStatus
|
|
}
|
|
|
|
func NewNullUserStatusStr(val interface{}) (x NullUserStatusStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullUserStatusStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.UserStatus.String(), nil
|
|
}
|