// Code generated by go-enum DO NOT EDIT. // Version: - // Revision: - // Build Date: - // Built By: - package consts import ( "database/sql/driver" "errors" "fmt" "strings" ) const ( // PayoutAccountStatusPending is a PayoutAccountStatus of type pending. PayoutAccountStatusPending PayoutAccountStatus = "pending" // PayoutAccountStatusApproved is a PayoutAccountStatus of type approved. PayoutAccountStatusApproved PayoutAccountStatus = "approved" // PayoutAccountStatusRejected is a PayoutAccountStatus of type rejected. PayoutAccountStatusRejected PayoutAccountStatus = "rejected" ) var ErrInvalidPayoutAccountStatus = fmt.Errorf("not a valid PayoutAccountStatus, try [%s]", strings.Join(_PayoutAccountStatusNames, ", ")) var _PayoutAccountStatusNames = []string{ string(PayoutAccountStatusPending), string(PayoutAccountStatusApproved), string(PayoutAccountStatusRejected), } // PayoutAccountStatusNames returns a list of possible string values of PayoutAccountStatus. func PayoutAccountStatusNames() []string { tmp := make([]string, len(_PayoutAccountStatusNames)) copy(tmp, _PayoutAccountStatusNames) return tmp } // PayoutAccountStatusValues returns a list of the values for PayoutAccountStatus func PayoutAccountStatusValues() []PayoutAccountStatus { return []PayoutAccountStatus{ PayoutAccountStatusPending, PayoutAccountStatusApproved, PayoutAccountStatusRejected, } } // String implements the Stringer interface. func (x PayoutAccountStatus) 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 PayoutAccountStatus) IsValid() bool { _, err := ParsePayoutAccountStatus(string(x)) return err == nil } var _PayoutAccountStatusValue = map[string]PayoutAccountStatus{ "pending": PayoutAccountStatusPending, "approved": PayoutAccountStatusApproved, "rejected": PayoutAccountStatusRejected, } // ParsePayoutAccountStatus attempts to convert a string to a PayoutAccountStatus. func ParsePayoutAccountStatus(name string) (PayoutAccountStatus, error) { if x, ok := _PayoutAccountStatusValue[name]; ok { return x, nil } return PayoutAccountStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidPayoutAccountStatus) } var errPayoutAccountStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *PayoutAccountStatus) Scan(value interface{}) (err error) { if value == nil { *x = PayoutAccountStatus("") 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 = ParsePayoutAccountStatus(v) case []byte: *x, err = ParsePayoutAccountStatus(string(v)) case PayoutAccountStatus: *x = v case *PayoutAccountStatus: if v == nil { return errPayoutAccountStatusNilPtr } *x = *v case *string: if v == nil { return errPayoutAccountStatusNilPtr } *x, err = ParsePayoutAccountStatus(*v) default: return errors.New("invalid type for PayoutAccountStatus") } return } // Value implements the driver Valuer interface. func (x PayoutAccountStatus) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *PayoutAccountStatus) Set(val string) error { v, err := ParsePayoutAccountStatus(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *PayoutAccountStatus) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *PayoutAccountStatus) Type() string { return "PayoutAccountStatus" } type NullPayoutAccountStatus struct { PayoutAccountStatus PayoutAccountStatus Valid bool } func NewNullPayoutAccountStatus(val interface{}) (x NullPayoutAccountStatus) { 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 *NullPayoutAccountStatus) Scan(value interface{}) (err error) { if value == nil { x.PayoutAccountStatus, x.Valid = PayoutAccountStatus(""), false return } err = x.PayoutAccountStatus.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullPayoutAccountStatus) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.PayoutAccountStatus), nil } type NullPayoutAccountStatusStr struct { NullPayoutAccountStatus } func NewNullPayoutAccountStatusStr(val interface{}) (x NullPayoutAccountStatusStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullPayoutAccountStatusStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.PayoutAccountStatus.String(), nil }