Files
quyun-v2/backend/pkg/consts/api_enums.gen.go
2025-12-29 09:30:49 +08:00

825 lines
22 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 (
// GenderMale is a Gender of type male.
GenderMale Gender = "male"
// GenderFemale is a Gender of type female.
GenderFemale Gender = "female"
// GenderSecret is a Gender of type secret.
GenderSecret Gender = "secret"
)
var ErrInvalidGender = fmt.Errorf("not a valid Gender, try [%s]", strings.Join(_GenderNames, ", "))
var _GenderNames = []string{
string(GenderMale),
string(GenderFemale),
string(GenderSecret),
}
// GenderNames returns a list of possible string values of Gender.
func GenderNames() []string {
tmp := make([]string, len(_GenderNames))
copy(tmp, _GenderNames)
return tmp
}
// GenderValues returns a list of the values for Gender
func GenderValues() []Gender {
return []Gender{
GenderMale,
GenderFemale,
GenderSecret,
}
}
// String implements the Stringer interface.
func (x Gender) 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 Gender) IsValid() bool {
_, err := ParseGender(string(x))
return err == nil
}
var _GenderValue = map[string]Gender{
"male": GenderMale,
"female": GenderFemale,
"secret": GenderSecret,
}
// ParseGender attempts to convert a string to a Gender.
func ParseGender(name string) (Gender, error) {
if x, ok := _GenderValue[name]; ok {
return x, nil
}
return Gender(""), fmt.Errorf("%s is %w", name, ErrInvalidGender)
}
var errGenderNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *Gender) Scan(value interface{}) (err error) {
if value == nil {
*x = Gender("")
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 = ParseGender(v)
case []byte:
*x, err = ParseGender(string(v))
case Gender:
*x = v
case *Gender:
if v == nil {
return errGenderNilPtr
}
*x = *v
case *string:
if v == nil {
return errGenderNilPtr
}
*x, err = ParseGender(*v)
default:
return errors.New("invalid type for Gender")
}
return
}
// Value implements the driver Valuer interface.
func (x Gender) Value() (driver.Value, error) {
return x.String(), nil
}
// Set implements the Golang flag.Value interface func.
func (x *Gender) Set(val string) error {
v, err := ParseGender(val)
*x = v
return err
}
// Get implements the Golang flag.Getter interface func.
func (x *Gender) Get() interface{} {
return *x
}
// Type implements the github.com/spf13/pFlag Value interface.
func (x *Gender) Type() string {
return "Gender"
}
type NullGender struct {
Gender Gender
Valid bool
}
func NewNullGender(val interface{}) (x NullGender) {
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 *NullGender) Scan(value interface{}) (err error) {
if value == nil {
x.Gender, x.Valid = Gender(""), false
return
}
err = x.Gender.Scan(value)
x.Valid = (err == nil)
return
}
// Value implements the driver Valuer interface.
func (x NullGender) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
// driver.Value accepts int64 for int values.
return string(x.Gender), nil
}
type NullGenderStr struct {
NullGender
}
func NewNullGenderStr(val interface{}) (x NullGenderStr) {
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
return
}
// Value implements the driver Valuer interface.
func (x NullGenderStr) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
return x.Gender.String(), nil
}
const (
// NotificationTypeSystem is a NotificationType of type system.
NotificationTypeSystem NotificationType = "system"
// NotificationTypeOrder is a NotificationType of type order.
NotificationTypeOrder NotificationType = "order"
// NotificationTypeAudit is a NotificationType of type audit.
NotificationTypeAudit NotificationType = "audit"
// NotificationTypeInteraction is a NotificationType of type interaction.
NotificationTypeInteraction NotificationType = "interaction"
)
var ErrInvalidNotificationType = fmt.Errorf("not a valid NotificationType, try [%s]", strings.Join(_NotificationTypeNames, ", "))
var _NotificationTypeNames = []string{
string(NotificationTypeSystem),
string(NotificationTypeOrder),
string(NotificationTypeAudit),
string(NotificationTypeInteraction),
}
// NotificationTypeNames returns a list of possible string values of NotificationType.
func NotificationTypeNames() []string {
tmp := make([]string, len(_NotificationTypeNames))
copy(tmp, _NotificationTypeNames)
return tmp
}
// NotificationTypeValues returns a list of the values for NotificationType
func NotificationTypeValues() []NotificationType {
return []NotificationType{
NotificationTypeSystem,
NotificationTypeOrder,
NotificationTypeAudit,
NotificationTypeInteraction,
}
}
// String implements the Stringer interface.
func (x NotificationType) 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 NotificationType) IsValid() bool {
_, err := ParseNotificationType(string(x))
return err == nil
}
var _NotificationTypeValue = map[string]NotificationType{
"system": NotificationTypeSystem,
"order": NotificationTypeOrder,
"audit": NotificationTypeAudit,
"interaction": NotificationTypeInteraction,
}
// ParseNotificationType attempts to convert a string to a NotificationType.
func ParseNotificationType(name string) (NotificationType, error) {
if x, ok := _NotificationTypeValue[name]; ok {
return x, nil
}
return NotificationType(""), fmt.Errorf("%s is %w", name, ErrInvalidNotificationType)
}
var errNotificationTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *NotificationType) Scan(value interface{}) (err error) {
if value == nil {
*x = NotificationType("")
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 = ParseNotificationType(v)
case []byte:
*x, err = ParseNotificationType(string(v))
case NotificationType:
*x = v
case *NotificationType:
if v == nil {
return errNotificationTypeNilPtr
}
*x = *v
case *string:
if v == nil {
return errNotificationTypeNilPtr
}
*x, err = ParseNotificationType(*v)
default:
return errors.New("invalid type for NotificationType")
}
return
}
// Value implements the driver Valuer interface.
func (x NotificationType) Value() (driver.Value, error) {
return x.String(), nil
}
// Set implements the Golang flag.Value interface func.
func (x *NotificationType) Set(val string) error {
v, err := ParseNotificationType(val)
*x = v
return err
}
// Get implements the Golang flag.Getter interface func.
func (x *NotificationType) Get() interface{} {
return *x
}
// Type implements the github.com/spf13/pFlag Value interface.
func (x *NotificationType) Type() string {
return "NotificationType"
}
type NullNotificationType struct {
NotificationType NotificationType
Valid bool
}
func NewNullNotificationType(val interface{}) (x NullNotificationType) {
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 *NullNotificationType) Scan(value interface{}) (err error) {
if value == nil {
x.NotificationType, x.Valid = NotificationType(""), false
return
}
err = x.NotificationType.Scan(value)
x.Valid = (err == nil)
return
}
// Value implements the driver Valuer interface.
func (x NullNotificationType) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
// driver.Value accepts int64 for int values.
return string(x.NotificationType), nil
}
type NullNotificationTypeStr struct {
NullNotificationType
}
func NewNullNotificationTypeStr(val interface{}) (x NullNotificationTypeStr) {
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
return
}
// Value implements the driver Valuer interface.
func (x NullNotificationTypeStr) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
return x.NotificationType.String(), nil
}
const (
// PayoutAccountTypeBank is a PayoutAccountType of type bank.
PayoutAccountTypeBank PayoutAccountType = "bank"
// PayoutAccountTypeAlipay is a PayoutAccountType of type alipay.
PayoutAccountTypeAlipay PayoutAccountType = "alipay"
)
var ErrInvalidPayoutAccountType = fmt.Errorf("not a valid PayoutAccountType, try [%s]", strings.Join(_PayoutAccountTypeNames, ", "))
var _PayoutAccountTypeNames = []string{
string(PayoutAccountTypeBank),
string(PayoutAccountTypeAlipay),
}
// PayoutAccountTypeNames returns a list of possible string values of PayoutAccountType.
func PayoutAccountTypeNames() []string {
tmp := make([]string, len(_PayoutAccountTypeNames))
copy(tmp, _PayoutAccountTypeNames)
return tmp
}
// PayoutAccountTypeValues returns a list of the values for PayoutAccountType
func PayoutAccountTypeValues() []PayoutAccountType {
return []PayoutAccountType{
PayoutAccountTypeBank,
PayoutAccountTypeAlipay,
}
}
// String implements the Stringer interface.
func (x PayoutAccountType) 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 PayoutAccountType) IsValid() bool {
_, err := ParsePayoutAccountType(string(x))
return err == nil
}
var _PayoutAccountTypeValue = map[string]PayoutAccountType{
"bank": PayoutAccountTypeBank,
"alipay": PayoutAccountTypeAlipay,
}
// ParsePayoutAccountType attempts to convert a string to a PayoutAccountType.
func ParsePayoutAccountType(name string) (PayoutAccountType, error) {
if x, ok := _PayoutAccountTypeValue[name]; ok {
return x, nil
}
return PayoutAccountType(""), fmt.Errorf("%s is %w", name, ErrInvalidPayoutAccountType)
}
var errPayoutAccountTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *PayoutAccountType) Scan(value interface{}) (err error) {
if value == nil {
*x = PayoutAccountType("")
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 = ParsePayoutAccountType(v)
case []byte:
*x, err = ParsePayoutAccountType(string(v))
case PayoutAccountType:
*x = v
case *PayoutAccountType:
if v == nil {
return errPayoutAccountTypeNilPtr
}
*x = *v
case *string:
if v == nil {
return errPayoutAccountTypeNilPtr
}
*x, err = ParsePayoutAccountType(*v)
default:
return errors.New("invalid type for PayoutAccountType")
}
return
}
// Value implements the driver Valuer interface.
func (x PayoutAccountType) Value() (driver.Value, error) {
return x.String(), nil
}
// Set implements the Golang flag.Value interface func.
func (x *PayoutAccountType) Set(val string) error {
v, err := ParsePayoutAccountType(val)
*x = v
return err
}
// Get implements the Golang flag.Getter interface func.
func (x *PayoutAccountType) Get() interface{} {
return *x
}
// Type implements the github.com/spf13/pFlag Value interface.
func (x *PayoutAccountType) Type() string {
return "PayoutAccountType"
}
type NullPayoutAccountType struct {
PayoutAccountType PayoutAccountType
Valid bool
}
func NewNullPayoutAccountType(val interface{}) (x NullPayoutAccountType) {
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 *NullPayoutAccountType) Scan(value interface{}) (err error) {
if value == nil {
x.PayoutAccountType, x.Valid = PayoutAccountType(""), false
return
}
err = x.PayoutAccountType.Scan(value)
x.Valid = (err == nil)
return
}
// Value implements the driver Valuer interface.
func (x NullPayoutAccountType) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
// driver.Value accepts int64 for int values.
return string(x.PayoutAccountType), nil
}
type NullPayoutAccountTypeStr struct {
NullPayoutAccountType
}
func NewNullPayoutAccountTypeStr(val interface{}) (x NullPayoutAccountTypeStr) {
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
return
}
// Value implements the driver Valuer interface.
func (x NullPayoutAccountTypeStr) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
return x.PayoutAccountType.String(), nil
}
const (
// UserCommentActionTypeLike is a UserCommentActionType of type like.
UserCommentActionTypeLike UserCommentActionType = "like"
)
var ErrInvalidUserCommentActionType = fmt.Errorf("not a valid UserCommentActionType, try [%s]", strings.Join(_UserCommentActionTypeNames, ", "))
var _UserCommentActionTypeNames = []string{
string(UserCommentActionTypeLike),
}
// UserCommentActionTypeNames returns a list of possible string values of UserCommentActionType.
func UserCommentActionTypeNames() []string {
tmp := make([]string, len(_UserCommentActionTypeNames))
copy(tmp, _UserCommentActionTypeNames)
return tmp
}
// UserCommentActionTypeValues returns a list of the values for UserCommentActionType
func UserCommentActionTypeValues() []UserCommentActionType {
return []UserCommentActionType{
UserCommentActionTypeLike,
}
}
// String implements the Stringer interface.
func (x UserCommentActionType) 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 UserCommentActionType) IsValid() bool {
_, err := ParseUserCommentActionType(string(x))
return err == nil
}
var _UserCommentActionTypeValue = map[string]UserCommentActionType{
"like": UserCommentActionTypeLike,
}
// ParseUserCommentActionType attempts to convert a string to a UserCommentActionType.
func ParseUserCommentActionType(name string) (UserCommentActionType, error) {
if x, ok := _UserCommentActionTypeValue[name]; ok {
return x, nil
}
return UserCommentActionType(""), fmt.Errorf("%s is %w", name, ErrInvalidUserCommentActionType)
}
var errUserCommentActionTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *UserCommentActionType) Scan(value interface{}) (err error) {
if value == nil {
*x = UserCommentActionType("")
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 = ParseUserCommentActionType(v)
case []byte:
*x, err = ParseUserCommentActionType(string(v))
case UserCommentActionType:
*x = v
case *UserCommentActionType:
if v == nil {
return errUserCommentActionTypeNilPtr
}
*x = *v
case *string:
if v == nil {
return errUserCommentActionTypeNilPtr
}
*x, err = ParseUserCommentActionType(*v)
default:
return errors.New("invalid type for UserCommentActionType")
}
return
}
// Value implements the driver Valuer interface.
func (x UserCommentActionType) Value() (driver.Value, error) {
return x.String(), nil
}
// Set implements the Golang flag.Value interface func.
func (x *UserCommentActionType) Set(val string) error {
v, err := ParseUserCommentActionType(val)
*x = v
return err
}
// Get implements the Golang flag.Getter interface func.
func (x *UserCommentActionType) Get() interface{} {
return *x
}
// Type implements the github.com/spf13/pFlag Value interface.
func (x *UserCommentActionType) Type() string {
return "UserCommentActionType"
}
type NullUserCommentActionType struct {
UserCommentActionType UserCommentActionType
Valid bool
}
func NewNullUserCommentActionType(val interface{}) (x NullUserCommentActionType) {
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 *NullUserCommentActionType) Scan(value interface{}) (err error) {
if value == nil {
x.UserCommentActionType, x.Valid = UserCommentActionType(""), false
return
}
err = x.UserCommentActionType.Scan(value)
x.Valid = (err == nil)
return
}
// Value implements the driver Valuer interface.
func (x NullUserCommentActionType) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
// driver.Value accepts int64 for int values.
return string(x.UserCommentActionType), nil
}
type NullUserCommentActionTypeStr struct {
NullUserCommentActionType
}
func NewNullUserCommentActionTypeStr(val interface{}) (x NullUserCommentActionTypeStr) {
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
return
}
// Value implements the driver Valuer interface.
func (x NullUserCommentActionTypeStr) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
return x.UserCommentActionType.String(), nil
}
const (
// UserContentActionTypeLike is a UserContentActionType of type like.
UserContentActionTypeLike UserContentActionType = "like"
// UserContentActionTypeFavorite is a UserContentActionType of type favorite.
UserContentActionTypeFavorite UserContentActionType = "favorite"
)
var ErrInvalidUserContentActionType = fmt.Errorf("not a valid UserContentActionType, try [%s]", strings.Join(_UserContentActionTypeNames, ", "))
var _UserContentActionTypeNames = []string{
string(UserContentActionTypeLike),
string(UserContentActionTypeFavorite),
}
// UserContentActionTypeNames returns a list of possible string values of UserContentActionType.
func UserContentActionTypeNames() []string {
tmp := make([]string, len(_UserContentActionTypeNames))
copy(tmp, _UserContentActionTypeNames)
return tmp
}
// UserContentActionTypeValues returns a list of the values for UserContentActionType
func UserContentActionTypeValues() []UserContentActionType {
return []UserContentActionType{
UserContentActionTypeLike,
UserContentActionTypeFavorite,
}
}
// String implements the Stringer interface.
func (x UserContentActionType) 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 UserContentActionType) IsValid() bool {
_, err := ParseUserContentActionType(string(x))
return err == nil
}
var _UserContentActionTypeValue = map[string]UserContentActionType{
"like": UserContentActionTypeLike,
"favorite": UserContentActionTypeFavorite,
}
// ParseUserContentActionType attempts to convert a string to a UserContentActionType.
func ParseUserContentActionType(name string) (UserContentActionType, error) {
if x, ok := _UserContentActionTypeValue[name]; ok {
return x, nil
}
return UserContentActionType(""), fmt.Errorf("%s is %w", name, ErrInvalidUserContentActionType)
}
var errUserContentActionTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
// Scan implements the Scanner interface.
func (x *UserContentActionType) Scan(value interface{}) (err error) {
if value == nil {
*x = UserContentActionType("")
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 = ParseUserContentActionType(v)
case []byte:
*x, err = ParseUserContentActionType(string(v))
case UserContentActionType:
*x = v
case *UserContentActionType:
if v == nil {
return errUserContentActionTypeNilPtr
}
*x = *v
case *string:
if v == nil {
return errUserContentActionTypeNilPtr
}
*x, err = ParseUserContentActionType(*v)
default:
return errors.New("invalid type for UserContentActionType")
}
return
}
// Value implements the driver Valuer interface.
func (x UserContentActionType) Value() (driver.Value, error) {
return x.String(), nil
}
// Set implements the Golang flag.Value interface func.
func (x *UserContentActionType) Set(val string) error {
v, err := ParseUserContentActionType(val)
*x = v
return err
}
// Get implements the Golang flag.Getter interface func.
func (x *UserContentActionType) Get() interface{} {
return *x
}
// Type implements the github.com/spf13/pFlag Value interface.
func (x *UserContentActionType) Type() string {
return "UserContentActionType"
}
type NullUserContentActionType struct {
UserContentActionType UserContentActionType
Valid bool
}
func NewNullUserContentActionType(val interface{}) (x NullUserContentActionType) {
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 *NullUserContentActionType) Scan(value interface{}) (err error) {
if value == nil {
x.UserContentActionType, x.Valid = UserContentActionType(""), false
return
}
err = x.UserContentActionType.Scan(value)
x.Valid = (err == nil)
return
}
// Value implements the driver Valuer interface.
func (x NullUserContentActionType) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
// driver.Value accepts int64 for int values.
return string(x.UserContentActionType), nil
}
type NullUserContentActionTypeStr struct {
NullUserContentActionType
}
func NewNullUserContentActionTypeStr(val interface{}) (x NullUserContentActionTypeStr) {
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
return
}
// Value implements the driver Valuer interface.
func (x NullUserContentActionTypeStr) Value() (driver.Value, error) {
if !x.Valid {
return nil, nil
}
return x.UserContentActionType.String(), nil
}