// Code generated by go-enum DO NOT EDIT. // Version: - // Revision: - // Build Date: - // Built By: - package consts import ( "database/sql/driver" "errors" "fmt" "strings" ) const ( // ContentAccessStatusActive is a ContentAccessStatus of type active. ContentAccessStatusActive ContentAccessStatus = "active" // ContentAccessStatusRevoked is a ContentAccessStatus of type revoked. ContentAccessStatusRevoked ContentAccessStatus = "revoked" // ContentAccessStatusExpired is a ContentAccessStatus of type expired. ContentAccessStatusExpired ContentAccessStatus = "expired" ) var ErrInvalidContentAccessStatus = fmt.Errorf("not a valid ContentAccessStatus, try [%s]", strings.Join(_ContentAccessStatusNames, ", ")) var _ContentAccessStatusNames = []string{ string(ContentAccessStatusActive), string(ContentAccessStatusRevoked), string(ContentAccessStatusExpired), } // ContentAccessStatusNames returns a list of possible string values of ContentAccessStatus. func ContentAccessStatusNames() []string { tmp := make([]string, len(_ContentAccessStatusNames)) copy(tmp, _ContentAccessStatusNames) return tmp } // ContentAccessStatusValues returns a list of the values for ContentAccessStatus func ContentAccessStatusValues() []ContentAccessStatus { return []ContentAccessStatus{ ContentAccessStatusActive, ContentAccessStatusRevoked, ContentAccessStatusExpired, } } // String implements the Stringer interface. func (x ContentAccessStatus) 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 ContentAccessStatus) IsValid() bool { _, err := ParseContentAccessStatus(string(x)) return err == nil } var _ContentAccessStatusValue = map[string]ContentAccessStatus{ "active": ContentAccessStatusActive, "revoked": ContentAccessStatusRevoked, "expired": ContentAccessStatusExpired, } // ParseContentAccessStatus attempts to convert a string to a ContentAccessStatus. func ParseContentAccessStatus(name string) (ContentAccessStatus, error) { if x, ok := _ContentAccessStatusValue[name]; ok { return x, nil } return ContentAccessStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidContentAccessStatus) } var errContentAccessStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *ContentAccessStatus) Scan(value interface{}) (err error) { if value == nil { *x = ContentAccessStatus("") 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 = ParseContentAccessStatus(v) case []byte: *x, err = ParseContentAccessStatus(string(v)) case ContentAccessStatus: *x = v case *ContentAccessStatus: if v == nil { return errContentAccessStatusNilPtr } *x = *v case *string: if v == nil { return errContentAccessStatusNilPtr } *x, err = ParseContentAccessStatus(*v) default: return errors.New("invalid type for ContentAccessStatus") } return } // Value implements the driver Valuer interface. func (x ContentAccessStatus) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *ContentAccessStatus) Set(val string) error { v, err := ParseContentAccessStatus(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *ContentAccessStatus) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *ContentAccessStatus) Type() string { return "ContentAccessStatus" } type NullContentAccessStatus struct { ContentAccessStatus ContentAccessStatus Valid bool } func NewNullContentAccessStatus(val interface{}) (x NullContentAccessStatus) { 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 *NullContentAccessStatus) Scan(value interface{}) (err error) { if value == nil { x.ContentAccessStatus, x.Valid = ContentAccessStatus(""), false return } err = x.ContentAccessStatus.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullContentAccessStatus) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.ContentAccessStatus), nil } type NullContentAccessStatusStr struct { NullContentAccessStatus } func NewNullContentAccessStatusStr(val interface{}) (x NullContentAccessStatusStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullContentAccessStatusStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.ContentAccessStatus.String(), nil } const ( // ContentAssetRoleMain is a ContentAssetRole of type main. ContentAssetRoleMain ContentAssetRole = "main" // ContentAssetRoleCover is a ContentAssetRole of type cover. ContentAssetRoleCover ContentAssetRole = "cover" // ContentAssetRolePreview is a ContentAssetRole of type preview. ContentAssetRolePreview ContentAssetRole = "preview" ) var ErrInvalidContentAssetRole = fmt.Errorf("not a valid ContentAssetRole, try [%s]", strings.Join(_ContentAssetRoleNames, ", ")) var _ContentAssetRoleNames = []string{ string(ContentAssetRoleMain), string(ContentAssetRoleCover), string(ContentAssetRolePreview), } // ContentAssetRoleNames returns a list of possible string values of ContentAssetRole. func ContentAssetRoleNames() []string { tmp := make([]string, len(_ContentAssetRoleNames)) copy(tmp, _ContentAssetRoleNames) return tmp } // ContentAssetRoleValues returns a list of the values for ContentAssetRole func ContentAssetRoleValues() []ContentAssetRole { return []ContentAssetRole{ ContentAssetRoleMain, ContentAssetRoleCover, ContentAssetRolePreview, } } // String implements the Stringer interface. func (x ContentAssetRole) 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 ContentAssetRole) IsValid() bool { _, err := ParseContentAssetRole(string(x)) return err == nil } var _ContentAssetRoleValue = map[string]ContentAssetRole{ "main": ContentAssetRoleMain, "cover": ContentAssetRoleCover, "preview": ContentAssetRolePreview, } // ParseContentAssetRole attempts to convert a string to a ContentAssetRole. func ParseContentAssetRole(name string) (ContentAssetRole, error) { if x, ok := _ContentAssetRoleValue[name]; ok { return x, nil } return ContentAssetRole(""), fmt.Errorf("%s is %w", name, ErrInvalidContentAssetRole) } var errContentAssetRoleNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *ContentAssetRole) Scan(value interface{}) (err error) { if value == nil { *x = ContentAssetRole("") 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 = ParseContentAssetRole(v) case []byte: *x, err = ParseContentAssetRole(string(v)) case ContentAssetRole: *x = v case *ContentAssetRole: if v == nil { return errContentAssetRoleNilPtr } *x = *v case *string: if v == nil { return errContentAssetRoleNilPtr } *x, err = ParseContentAssetRole(*v) default: return errors.New("invalid type for ContentAssetRole") } return } // Value implements the driver Valuer interface. func (x ContentAssetRole) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *ContentAssetRole) Set(val string) error { v, err := ParseContentAssetRole(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *ContentAssetRole) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *ContentAssetRole) Type() string { return "ContentAssetRole" } type NullContentAssetRole struct { ContentAssetRole ContentAssetRole Valid bool } func NewNullContentAssetRole(val interface{}) (x NullContentAssetRole) { 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 *NullContentAssetRole) Scan(value interface{}) (err error) { if value == nil { x.ContentAssetRole, x.Valid = ContentAssetRole(""), false return } err = x.ContentAssetRole.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullContentAssetRole) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.ContentAssetRole), nil } type NullContentAssetRoleStr struct { NullContentAssetRole } func NewNullContentAssetRoleStr(val interface{}) (x NullContentAssetRoleStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullContentAssetRoleStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.ContentAssetRole.String(), nil } const ( // ContentStatusDraft is a ContentStatus of type draft. ContentStatusDraft ContentStatus = "draft" // ContentStatusReviewing is a ContentStatus of type reviewing. ContentStatusReviewing ContentStatus = "reviewing" // ContentStatusPublished is a ContentStatus of type published. ContentStatusPublished ContentStatus = "published" // ContentStatusUnpublished is a ContentStatus of type unpublished. ContentStatusUnpublished ContentStatus = "unpublished" // ContentStatusBlocked is a ContentStatus of type blocked. ContentStatusBlocked ContentStatus = "blocked" ) var ErrInvalidContentStatus = fmt.Errorf("not a valid ContentStatus, try [%s]", strings.Join(_ContentStatusNames, ", ")) var _ContentStatusNames = []string{ string(ContentStatusDraft), string(ContentStatusReviewing), string(ContentStatusPublished), string(ContentStatusUnpublished), string(ContentStatusBlocked), } // ContentStatusNames returns a list of possible string values of ContentStatus. func ContentStatusNames() []string { tmp := make([]string, len(_ContentStatusNames)) copy(tmp, _ContentStatusNames) return tmp } // ContentStatusValues returns a list of the values for ContentStatus func ContentStatusValues() []ContentStatus { return []ContentStatus{ ContentStatusDraft, ContentStatusReviewing, ContentStatusPublished, ContentStatusUnpublished, ContentStatusBlocked, } } // String implements the Stringer interface. func (x ContentStatus) 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 ContentStatus) IsValid() bool { _, err := ParseContentStatus(string(x)) return err == nil } var _ContentStatusValue = map[string]ContentStatus{ "draft": ContentStatusDraft, "reviewing": ContentStatusReviewing, "published": ContentStatusPublished, "unpublished": ContentStatusUnpublished, "blocked": ContentStatusBlocked, } // ParseContentStatus attempts to convert a string to a ContentStatus. func ParseContentStatus(name string) (ContentStatus, error) { if x, ok := _ContentStatusValue[name]; ok { return x, nil } return ContentStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidContentStatus) } var errContentStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *ContentStatus) Scan(value interface{}) (err error) { if value == nil { *x = ContentStatus("") 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 = ParseContentStatus(v) case []byte: *x, err = ParseContentStatus(string(v)) case ContentStatus: *x = v case *ContentStatus: if v == nil { return errContentStatusNilPtr } *x = *v case *string: if v == nil { return errContentStatusNilPtr } *x, err = ParseContentStatus(*v) default: return errors.New("invalid type for ContentStatus") } return } // Value implements the driver Valuer interface. func (x ContentStatus) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *ContentStatus) Set(val string) error { v, err := ParseContentStatus(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *ContentStatus) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *ContentStatus) Type() string { return "ContentStatus" } type NullContentStatus struct { ContentStatus ContentStatus Valid bool } func NewNullContentStatus(val interface{}) (x NullContentStatus) { 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 *NullContentStatus) Scan(value interface{}) (err error) { if value == nil { x.ContentStatus, x.Valid = ContentStatus(""), false return } err = x.ContentStatus.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullContentStatus) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.ContentStatus), nil } type NullContentStatusStr struct { NullContentStatus } func NewNullContentStatusStr(val interface{}) (x NullContentStatusStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullContentStatusStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.ContentStatus.String(), nil } const ( // ContentVisibilityPublic is a ContentVisibility of type public. ContentVisibilityPublic ContentVisibility = "public" // ContentVisibilityTenantOnly is a ContentVisibility of type tenant_only. ContentVisibilityTenantOnly ContentVisibility = "tenant_only" // ContentVisibilityPrivate is a ContentVisibility of type private. ContentVisibilityPrivate ContentVisibility = "private" ) var ErrInvalidContentVisibility = fmt.Errorf("not a valid ContentVisibility, try [%s]", strings.Join(_ContentVisibilityNames, ", ")) var _ContentVisibilityNames = []string{ string(ContentVisibilityPublic), string(ContentVisibilityTenantOnly), string(ContentVisibilityPrivate), } // ContentVisibilityNames returns a list of possible string values of ContentVisibility. func ContentVisibilityNames() []string { tmp := make([]string, len(_ContentVisibilityNames)) copy(tmp, _ContentVisibilityNames) return tmp } // ContentVisibilityValues returns a list of the values for ContentVisibility func ContentVisibilityValues() []ContentVisibility { return []ContentVisibility{ ContentVisibilityPublic, ContentVisibilityTenantOnly, ContentVisibilityPrivate, } } // String implements the Stringer interface. func (x ContentVisibility) 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 ContentVisibility) IsValid() bool { _, err := ParseContentVisibility(string(x)) return err == nil } var _ContentVisibilityValue = map[string]ContentVisibility{ "public": ContentVisibilityPublic, "tenant_only": ContentVisibilityTenantOnly, "private": ContentVisibilityPrivate, } // ParseContentVisibility attempts to convert a string to a ContentVisibility. func ParseContentVisibility(name string) (ContentVisibility, error) { if x, ok := _ContentVisibilityValue[name]; ok { return x, nil } return ContentVisibility(""), fmt.Errorf("%s is %w", name, ErrInvalidContentVisibility) } var errContentVisibilityNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *ContentVisibility) Scan(value interface{}) (err error) { if value == nil { *x = ContentVisibility("") 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 = ParseContentVisibility(v) case []byte: *x, err = ParseContentVisibility(string(v)) case ContentVisibility: *x = v case *ContentVisibility: if v == nil { return errContentVisibilityNilPtr } *x = *v case *string: if v == nil { return errContentVisibilityNilPtr } *x, err = ParseContentVisibility(*v) default: return errors.New("invalid type for ContentVisibility") } return } // Value implements the driver Valuer interface. func (x ContentVisibility) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *ContentVisibility) Set(val string) error { v, err := ParseContentVisibility(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *ContentVisibility) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *ContentVisibility) Type() string { return "ContentVisibility" } type NullContentVisibility struct { ContentVisibility ContentVisibility Valid bool } func NewNullContentVisibility(val interface{}) (x NullContentVisibility) { 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 *NullContentVisibility) Scan(value interface{}) (err error) { if value == nil { x.ContentVisibility, x.Valid = ContentVisibility(""), false return } err = x.ContentVisibility.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullContentVisibility) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.ContentVisibility), nil } type NullContentVisibilityStr struct { NullContentVisibility } func NewNullContentVisibilityStr(val interface{}) (x NullContentVisibilityStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullContentVisibilityStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.ContentVisibility.String(), nil } const ( // CurrencyCNY is a Currency of type CNY. CurrencyCNY Currency = "CNY" ) var ErrInvalidCurrency = fmt.Errorf("not a valid Currency, try [%s]", strings.Join(_CurrencyNames, ", ")) var _CurrencyNames = []string{ string(CurrencyCNY), } // CurrencyNames returns a list of possible string values of Currency. func CurrencyNames() []string { tmp := make([]string, len(_CurrencyNames)) copy(tmp, _CurrencyNames) return tmp } // CurrencyValues returns a list of the values for Currency func CurrencyValues() []Currency { return []Currency{ CurrencyCNY, } } // String implements the Stringer interface. func (x Currency) 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 Currency) IsValid() bool { _, err := ParseCurrency(string(x)) return err == nil } var _CurrencyValue = map[string]Currency{ "CNY": CurrencyCNY, } // ParseCurrency attempts to convert a string to a Currency. func ParseCurrency(name string) (Currency, error) { if x, ok := _CurrencyValue[name]; ok { return x, nil } return Currency(""), fmt.Errorf("%s is %w", name, ErrInvalidCurrency) } var errCurrencyNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *Currency) Scan(value interface{}) (err error) { if value == nil { *x = Currency("") 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 = ParseCurrency(v) case []byte: *x, err = ParseCurrency(string(v)) case Currency: *x = v case *Currency: if v == nil { return errCurrencyNilPtr } *x = *v case *string: if v == nil { return errCurrencyNilPtr } *x, err = ParseCurrency(*v) default: return errors.New("invalid type for Currency") } return } // Value implements the driver Valuer interface. func (x Currency) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *Currency) Set(val string) error { v, err := ParseCurrency(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *Currency) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *Currency) Type() string { return "Currency" } type NullCurrency struct { Currency Currency Valid bool } func NewNullCurrency(val interface{}) (x NullCurrency) { 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 *NullCurrency) Scan(value interface{}) (err error) { if value == nil { x.Currency, x.Valid = Currency(""), false return } err = x.Currency.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullCurrency) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.Currency), nil } type NullCurrencyStr struct { NullCurrency } func NewNullCurrencyStr(val interface{}) (x NullCurrencyStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullCurrencyStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.Currency.String(), nil } const ( // DiscountTypeNone is a DiscountType of type none. DiscountTypeNone DiscountType = "none" // DiscountTypePercent is a DiscountType of type percent. DiscountTypePercent DiscountType = "percent" // DiscountTypeAmount is a DiscountType of type amount. DiscountTypeAmount DiscountType = "amount" ) var ErrInvalidDiscountType = fmt.Errorf("not a valid DiscountType, try [%s]", strings.Join(_DiscountTypeNames, ", ")) var _DiscountTypeNames = []string{ string(DiscountTypeNone), string(DiscountTypePercent), string(DiscountTypeAmount), } // DiscountTypeNames returns a list of possible string values of DiscountType. func DiscountTypeNames() []string { tmp := make([]string, len(_DiscountTypeNames)) copy(tmp, _DiscountTypeNames) return tmp } // DiscountTypeValues returns a list of the values for DiscountType func DiscountTypeValues() []DiscountType { return []DiscountType{ DiscountTypeNone, DiscountTypePercent, DiscountTypeAmount, } } // String implements the Stringer interface. func (x DiscountType) 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 DiscountType) IsValid() bool { _, err := ParseDiscountType(string(x)) return err == nil } var _DiscountTypeValue = map[string]DiscountType{ "none": DiscountTypeNone, "percent": DiscountTypePercent, "amount": DiscountTypeAmount, } // ParseDiscountType attempts to convert a string to a DiscountType. func ParseDiscountType(name string) (DiscountType, error) { if x, ok := _DiscountTypeValue[name]; ok { return x, nil } return DiscountType(""), fmt.Errorf("%s is %w", name, ErrInvalidDiscountType) } var errDiscountTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *DiscountType) Scan(value interface{}) (err error) { if value == nil { *x = DiscountType("") 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 = ParseDiscountType(v) case []byte: *x, err = ParseDiscountType(string(v)) case DiscountType: *x = v case *DiscountType: if v == nil { return errDiscountTypeNilPtr } *x = *v case *string: if v == nil { return errDiscountTypeNilPtr } *x, err = ParseDiscountType(*v) default: return errors.New("invalid type for DiscountType") } return } // Value implements the driver Valuer interface. func (x DiscountType) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *DiscountType) Set(val string) error { v, err := ParseDiscountType(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *DiscountType) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *DiscountType) Type() string { return "DiscountType" } type NullDiscountType struct { DiscountType DiscountType Valid bool } func NewNullDiscountType(val interface{}) (x NullDiscountType) { 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 *NullDiscountType) Scan(value interface{}) (err error) { if value == nil { x.DiscountType, x.Valid = DiscountType(""), false return } err = x.DiscountType.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullDiscountType) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.DiscountType), nil } type NullDiscountTypeStr struct { NullDiscountType } func NewNullDiscountTypeStr(val interface{}) (x NullDiscountTypeStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullDiscountTypeStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.DiscountType.String(), nil } const ( // MediaAssetStatusUploaded is a MediaAssetStatus of type uploaded. MediaAssetStatusUploaded MediaAssetStatus = "uploaded" // MediaAssetStatusProcessing is a MediaAssetStatus of type processing. MediaAssetStatusProcessing MediaAssetStatus = "processing" // MediaAssetStatusReady is a MediaAssetStatus of type ready. MediaAssetStatusReady MediaAssetStatus = "ready" // MediaAssetStatusFailed is a MediaAssetStatus of type failed. MediaAssetStatusFailed MediaAssetStatus = "failed" // MediaAssetStatusDeleted is a MediaAssetStatus of type deleted. MediaAssetStatusDeleted MediaAssetStatus = "deleted" ) var ErrInvalidMediaAssetStatus = fmt.Errorf("not a valid MediaAssetStatus, try [%s]", strings.Join(_MediaAssetStatusNames, ", ")) var _MediaAssetStatusNames = []string{ string(MediaAssetStatusUploaded), string(MediaAssetStatusProcessing), string(MediaAssetStatusReady), string(MediaAssetStatusFailed), string(MediaAssetStatusDeleted), } // MediaAssetStatusNames returns a list of possible string values of MediaAssetStatus. func MediaAssetStatusNames() []string { tmp := make([]string, len(_MediaAssetStatusNames)) copy(tmp, _MediaAssetStatusNames) return tmp } // MediaAssetStatusValues returns a list of the values for MediaAssetStatus func MediaAssetStatusValues() []MediaAssetStatus { return []MediaAssetStatus{ MediaAssetStatusUploaded, MediaAssetStatusProcessing, MediaAssetStatusReady, MediaAssetStatusFailed, MediaAssetStatusDeleted, } } // String implements the Stringer interface. func (x MediaAssetStatus) 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 MediaAssetStatus) IsValid() bool { _, err := ParseMediaAssetStatus(string(x)) return err == nil } var _MediaAssetStatusValue = map[string]MediaAssetStatus{ "uploaded": MediaAssetStatusUploaded, "processing": MediaAssetStatusProcessing, "ready": MediaAssetStatusReady, "failed": MediaAssetStatusFailed, "deleted": MediaAssetStatusDeleted, } // ParseMediaAssetStatus attempts to convert a string to a MediaAssetStatus. func ParseMediaAssetStatus(name string) (MediaAssetStatus, error) { if x, ok := _MediaAssetStatusValue[name]; ok { return x, nil } return MediaAssetStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidMediaAssetStatus) } var errMediaAssetStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *MediaAssetStatus) Scan(value interface{}) (err error) { if value == nil { *x = MediaAssetStatus("") 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 = ParseMediaAssetStatus(v) case []byte: *x, err = ParseMediaAssetStatus(string(v)) case MediaAssetStatus: *x = v case *MediaAssetStatus: if v == nil { return errMediaAssetStatusNilPtr } *x = *v case *string: if v == nil { return errMediaAssetStatusNilPtr } *x, err = ParseMediaAssetStatus(*v) default: return errors.New("invalid type for MediaAssetStatus") } return } // Value implements the driver Valuer interface. func (x MediaAssetStatus) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *MediaAssetStatus) Set(val string) error { v, err := ParseMediaAssetStatus(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *MediaAssetStatus) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *MediaAssetStatus) Type() string { return "MediaAssetStatus" } type NullMediaAssetStatus struct { MediaAssetStatus MediaAssetStatus Valid bool } func NewNullMediaAssetStatus(val interface{}) (x NullMediaAssetStatus) { 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 *NullMediaAssetStatus) Scan(value interface{}) (err error) { if value == nil { x.MediaAssetStatus, x.Valid = MediaAssetStatus(""), false return } err = x.MediaAssetStatus.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullMediaAssetStatus) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.MediaAssetStatus), nil } type NullMediaAssetStatusStr struct { NullMediaAssetStatus } func NewNullMediaAssetStatusStr(val interface{}) (x NullMediaAssetStatusStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullMediaAssetStatusStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.MediaAssetStatus.String(), nil } const ( // MediaAssetTypeVideo is a MediaAssetType of type video. MediaAssetTypeVideo MediaAssetType = "video" // MediaAssetTypeAudio is a MediaAssetType of type audio. MediaAssetTypeAudio MediaAssetType = "audio" // MediaAssetTypeImage is a MediaAssetType of type image. MediaAssetTypeImage MediaAssetType = "image" ) var ErrInvalidMediaAssetType = fmt.Errorf("not a valid MediaAssetType, try [%s]", strings.Join(_MediaAssetTypeNames, ", ")) var _MediaAssetTypeNames = []string{ string(MediaAssetTypeVideo), string(MediaAssetTypeAudio), string(MediaAssetTypeImage), } // MediaAssetTypeNames returns a list of possible string values of MediaAssetType. func MediaAssetTypeNames() []string { tmp := make([]string, len(_MediaAssetTypeNames)) copy(tmp, _MediaAssetTypeNames) return tmp } // MediaAssetTypeValues returns a list of the values for MediaAssetType func MediaAssetTypeValues() []MediaAssetType { return []MediaAssetType{ MediaAssetTypeVideo, MediaAssetTypeAudio, MediaAssetTypeImage, } } // String implements the Stringer interface. func (x MediaAssetType) 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 MediaAssetType) IsValid() bool { _, err := ParseMediaAssetType(string(x)) return err == nil } var _MediaAssetTypeValue = map[string]MediaAssetType{ "video": MediaAssetTypeVideo, "audio": MediaAssetTypeAudio, "image": MediaAssetTypeImage, } // ParseMediaAssetType attempts to convert a string to a MediaAssetType. func ParseMediaAssetType(name string) (MediaAssetType, error) { if x, ok := _MediaAssetTypeValue[name]; ok { return x, nil } return MediaAssetType(""), fmt.Errorf("%s is %w", name, ErrInvalidMediaAssetType) } var errMediaAssetTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *MediaAssetType) Scan(value interface{}) (err error) { if value == nil { *x = MediaAssetType("") 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 = ParseMediaAssetType(v) case []byte: *x, err = ParseMediaAssetType(string(v)) case MediaAssetType: *x = v case *MediaAssetType: if v == nil { return errMediaAssetTypeNilPtr } *x = *v case *string: if v == nil { return errMediaAssetTypeNilPtr } *x, err = ParseMediaAssetType(*v) default: return errors.New("invalid type for MediaAssetType") } return } // Value implements the driver Valuer interface. func (x MediaAssetType) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *MediaAssetType) Set(val string) error { v, err := ParseMediaAssetType(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *MediaAssetType) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *MediaAssetType) Type() string { return "MediaAssetType" } type NullMediaAssetType struct { MediaAssetType MediaAssetType Valid bool } func NewNullMediaAssetType(val interface{}) (x NullMediaAssetType) { 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 *NullMediaAssetType) Scan(value interface{}) (err error) { if value == nil { x.MediaAssetType, x.Valid = MediaAssetType(""), false return } err = x.MediaAssetType.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullMediaAssetType) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.MediaAssetType), nil } type NullMediaAssetTypeStr struct { NullMediaAssetType } func NewNullMediaAssetTypeStr(val interface{}) (x NullMediaAssetTypeStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullMediaAssetTypeStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.MediaAssetType.String(), nil } const ( // MediaAssetVariantMain is a MediaAssetVariant of type main. MediaAssetVariantMain MediaAssetVariant = "main" // MediaAssetVariantPreview is a MediaAssetVariant of type preview. MediaAssetVariantPreview MediaAssetVariant = "preview" ) var ErrInvalidMediaAssetVariant = fmt.Errorf("not a valid MediaAssetVariant, try [%s]", strings.Join(_MediaAssetVariantNames, ", ")) var _MediaAssetVariantNames = []string{ string(MediaAssetVariantMain), string(MediaAssetVariantPreview), } // MediaAssetVariantNames returns a list of possible string values of MediaAssetVariant. func MediaAssetVariantNames() []string { tmp := make([]string, len(_MediaAssetVariantNames)) copy(tmp, _MediaAssetVariantNames) return tmp } // MediaAssetVariantValues returns a list of the values for MediaAssetVariant func MediaAssetVariantValues() []MediaAssetVariant { return []MediaAssetVariant{ MediaAssetVariantMain, MediaAssetVariantPreview, } } // String implements the Stringer interface. func (x MediaAssetVariant) 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 MediaAssetVariant) IsValid() bool { _, err := ParseMediaAssetVariant(string(x)) return err == nil } var _MediaAssetVariantValue = map[string]MediaAssetVariant{ "main": MediaAssetVariantMain, "preview": MediaAssetVariantPreview, } // ParseMediaAssetVariant attempts to convert a string to a MediaAssetVariant. func ParseMediaAssetVariant(name string) (MediaAssetVariant, error) { if x, ok := _MediaAssetVariantValue[name]; ok { return x, nil } return MediaAssetVariant(""), fmt.Errorf("%s is %w", name, ErrInvalidMediaAssetVariant) } var errMediaAssetVariantNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *MediaAssetVariant) Scan(value interface{}) (err error) { if value == nil { *x = MediaAssetVariant("") 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 = ParseMediaAssetVariant(v) case []byte: *x, err = ParseMediaAssetVariant(string(v)) case MediaAssetVariant: *x = v case *MediaAssetVariant: if v == nil { return errMediaAssetVariantNilPtr } *x = *v case *string: if v == nil { return errMediaAssetVariantNilPtr } *x, err = ParseMediaAssetVariant(*v) default: return errors.New("invalid type for MediaAssetVariant") } return } // Value implements the driver Valuer interface. func (x MediaAssetVariant) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *MediaAssetVariant) Set(val string) error { v, err := ParseMediaAssetVariant(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *MediaAssetVariant) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *MediaAssetVariant) Type() string { return "MediaAssetVariant" } type NullMediaAssetVariant struct { MediaAssetVariant MediaAssetVariant Valid bool } func NewNullMediaAssetVariant(val interface{}) (x NullMediaAssetVariant) { 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 *NullMediaAssetVariant) Scan(value interface{}) (err error) { if value == nil { x.MediaAssetVariant, x.Valid = MediaAssetVariant(""), false return } err = x.MediaAssetVariant.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullMediaAssetVariant) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.MediaAssetVariant), nil } type NullMediaAssetVariantStr struct { NullMediaAssetVariant } func NewNullMediaAssetVariantStr(val interface{}) (x NullMediaAssetVariantStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullMediaAssetVariantStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.MediaAssetVariant.String(), nil } const ( // OrderStatusCreated is a OrderStatus of type created. OrderStatusCreated OrderStatus = "created" // OrderStatusPaid is a OrderStatus of type paid. OrderStatusPaid OrderStatus = "paid" // OrderStatusRefunding is a OrderStatus of type refunding. OrderStatusRefunding OrderStatus = "refunding" // OrderStatusRefunded is a OrderStatus of type refunded. OrderStatusRefunded OrderStatus = "refunded" // OrderStatusCanceled is a OrderStatus of type canceled. OrderStatusCanceled OrderStatus = "canceled" // OrderStatusFailed is a OrderStatus of type failed. OrderStatusFailed OrderStatus = "failed" ) var ErrInvalidOrderStatus = fmt.Errorf("not a valid OrderStatus, try [%s]", strings.Join(_OrderStatusNames, ", ")) var _OrderStatusNames = []string{ string(OrderStatusCreated), string(OrderStatusPaid), string(OrderStatusRefunding), string(OrderStatusRefunded), string(OrderStatusCanceled), string(OrderStatusFailed), } // OrderStatusNames returns a list of possible string values of OrderStatus. func OrderStatusNames() []string { tmp := make([]string, len(_OrderStatusNames)) copy(tmp, _OrderStatusNames) return tmp } // OrderStatusValues returns a list of the values for OrderStatus func OrderStatusValues() []OrderStatus { return []OrderStatus{ OrderStatusCreated, OrderStatusPaid, OrderStatusRefunding, OrderStatusRefunded, OrderStatusCanceled, OrderStatusFailed, } } // String implements the Stringer interface. func (x OrderStatus) 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 OrderStatus) IsValid() bool { _, err := ParseOrderStatus(string(x)) return err == nil } var _OrderStatusValue = map[string]OrderStatus{ "created": OrderStatusCreated, "paid": OrderStatusPaid, "refunding": OrderStatusRefunding, "refunded": OrderStatusRefunded, "canceled": OrderStatusCanceled, "failed": OrderStatusFailed, } // ParseOrderStatus attempts to convert a string to a OrderStatus. func ParseOrderStatus(name string) (OrderStatus, error) { if x, ok := _OrderStatusValue[name]; ok { return x, nil } return OrderStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidOrderStatus) } var errOrderStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *OrderStatus) Scan(value interface{}) (err error) { if value == nil { *x = OrderStatus("") 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 = ParseOrderStatus(v) case []byte: *x, err = ParseOrderStatus(string(v)) case OrderStatus: *x = v case *OrderStatus: if v == nil { return errOrderStatusNilPtr } *x = *v case *string: if v == nil { return errOrderStatusNilPtr } *x, err = ParseOrderStatus(*v) default: return errors.New("invalid type for OrderStatus") } return } // Value implements the driver Valuer interface. func (x OrderStatus) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *OrderStatus) Set(val string) error { v, err := ParseOrderStatus(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *OrderStatus) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *OrderStatus) Type() string { return "OrderStatus" } type NullOrderStatus struct { OrderStatus OrderStatus Valid bool } func NewNullOrderStatus(val interface{}) (x NullOrderStatus) { 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 *NullOrderStatus) Scan(value interface{}) (err error) { if value == nil { x.OrderStatus, x.Valid = OrderStatus(""), false return } err = x.OrderStatus.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullOrderStatus) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.OrderStatus), nil } type NullOrderStatusStr struct { NullOrderStatus } func NewNullOrderStatusStr(val interface{}) (x NullOrderStatusStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullOrderStatusStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.OrderStatus.String(), nil } const ( // OrderTypeContentPurchase is a OrderType of type content_purchase. OrderTypeContentPurchase OrderType = "content_purchase" ) var ErrInvalidOrderType = fmt.Errorf("not a valid OrderType, try [%s]", strings.Join(_OrderTypeNames, ", ")) var _OrderTypeNames = []string{ string(OrderTypeContentPurchase), } // OrderTypeNames returns a list of possible string values of OrderType. func OrderTypeNames() []string { tmp := make([]string, len(_OrderTypeNames)) copy(tmp, _OrderTypeNames) return tmp } // OrderTypeValues returns a list of the values for OrderType func OrderTypeValues() []OrderType { return []OrderType{ OrderTypeContentPurchase, } } // String implements the Stringer interface. func (x OrderType) 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 OrderType) IsValid() bool { _, err := ParseOrderType(string(x)) return err == nil } var _OrderTypeValue = map[string]OrderType{ "content_purchase": OrderTypeContentPurchase, } // ParseOrderType attempts to convert a string to a OrderType. func ParseOrderType(name string) (OrderType, error) { if x, ok := _OrderTypeValue[name]; ok { return x, nil } return OrderType(""), fmt.Errorf("%s is %w", name, ErrInvalidOrderType) } var errOrderTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *OrderType) Scan(value interface{}) (err error) { if value == nil { *x = OrderType("") 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 = ParseOrderType(v) case []byte: *x, err = ParseOrderType(string(v)) case OrderType: *x = v case *OrderType: if v == nil { return errOrderTypeNilPtr } *x = *v case *string: if v == nil { return errOrderTypeNilPtr } *x, err = ParseOrderType(*v) default: return errors.New("invalid type for OrderType") } return } // Value implements the driver Valuer interface. func (x OrderType) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *OrderType) Set(val string) error { v, err := ParseOrderType(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *OrderType) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *OrderType) Type() string { return "OrderType" } type NullOrderType struct { OrderType OrderType Valid bool } func NewNullOrderType(val interface{}) (x NullOrderType) { 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 *NullOrderType) Scan(value interface{}) (err error) { if value == nil { x.OrderType, x.Valid = OrderType(""), false return } err = x.OrderType.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullOrderType) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.OrderType), nil } type NullOrderTypeStr struct { NullOrderType } func NewNullOrderTypeStr(val interface{}) (x NullOrderTypeStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullOrderTypeStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.OrderType.String(), nil } 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 ( // TenantLedgerTypeDebitPurchase is a TenantLedgerType of type debit_purchase. TenantLedgerTypeDebitPurchase TenantLedgerType = "debit_purchase" // TenantLedgerTypeCreditRefund is a TenantLedgerType of type credit_refund. TenantLedgerTypeCreditRefund TenantLedgerType = "credit_refund" // TenantLedgerTypeFreeze is a TenantLedgerType of type freeze. TenantLedgerTypeFreeze TenantLedgerType = "freeze" // TenantLedgerTypeUnfreeze is a TenantLedgerType of type unfreeze. TenantLedgerTypeUnfreeze TenantLedgerType = "unfreeze" // TenantLedgerTypeAdjustment is a TenantLedgerType of type adjustment. TenantLedgerTypeAdjustment TenantLedgerType = "adjustment" ) var ErrInvalidTenantLedgerType = fmt.Errorf("not a valid TenantLedgerType, try [%s]", strings.Join(_TenantLedgerTypeNames, ", ")) var _TenantLedgerTypeNames = []string{ string(TenantLedgerTypeDebitPurchase), string(TenantLedgerTypeCreditRefund), string(TenantLedgerTypeFreeze), string(TenantLedgerTypeUnfreeze), string(TenantLedgerTypeAdjustment), } // TenantLedgerTypeNames returns a list of possible string values of TenantLedgerType. func TenantLedgerTypeNames() []string { tmp := make([]string, len(_TenantLedgerTypeNames)) copy(tmp, _TenantLedgerTypeNames) return tmp } // TenantLedgerTypeValues returns a list of the values for TenantLedgerType func TenantLedgerTypeValues() []TenantLedgerType { return []TenantLedgerType{ TenantLedgerTypeDebitPurchase, TenantLedgerTypeCreditRefund, TenantLedgerTypeFreeze, TenantLedgerTypeUnfreeze, TenantLedgerTypeAdjustment, } } // String implements the Stringer interface. func (x TenantLedgerType) 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 TenantLedgerType) IsValid() bool { _, err := ParseTenantLedgerType(string(x)) return err == nil } var _TenantLedgerTypeValue = map[string]TenantLedgerType{ "debit_purchase": TenantLedgerTypeDebitPurchase, "credit_refund": TenantLedgerTypeCreditRefund, "freeze": TenantLedgerTypeFreeze, "unfreeze": TenantLedgerTypeUnfreeze, "adjustment": TenantLedgerTypeAdjustment, } // ParseTenantLedgerType attempts to convert a string to a TenantLedgerType. func ParseTenantLedgerType(name string) (TenantLedgerType, error) { if x, ok := _TenantLedgerTypeValue[name]; ok { return x, nil } return TenantLedgerType(""), fmt.Errorf("%s is %w", name, ErrInvalidTenantLedgerType) } var errTenantLedgerTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes // Scan implements the Scanner interface. func (x *TenantLedgerType) Scan(value interface{}) (err error) { if value == nil { *x = TenantLedgerType("") 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 = ParseTenantLedgerType(v) case []byte: *x, err = ParseTenantLedgerType(string(v)) case TenantLedgerType: *x = v case *TenantLedgerType: if v == nil { return errTenantLedgerTypeNilPtr } *x = *v case *string: if v == nil { return errTenantLedgerTypeNilPtr } *x, err = ParseTenantLedgerType(*v) default: return errors.New("invalid type for TenantLedgerType") } return } // Value implements the driver Valuer interface. func (x TenantLedgerType) Value() (driver.Value, error) { return x.String(), nil } // Set implements the Golang flag.Value interface func. func (x *TenantLedgerType) Set(val string) error { v, err := ParseTenantLedgerType(val) *x = v return err } // Get implements the Golang flag.Getter interface func. func (x *TenantLedgerType) Get() interface{} { return *x } // Type implements the github.com/spf13/pFlag Value interface. func (x *TenantLedgerType) Type() string { return "TenantLedgerType" } type NullTenantLedgerType struct { TenantLedgerType TenantLedgerType Valid bool } func NewNullTenantLedgerType(val interface{}) (x NullTenantLedgerType) { 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 *NullTenantLedgerType) Scan(value interface{}) (err error) { if value == nil { x.TenantLedgerType, x.Valid = TenantLedgerType(""), false return } err = x.TenantLedgerType.Scan(value) x.Valid = (err == nil) return } // Value implements the driver Valuer interface. func (x NullTenantLedgerType) Value() (driver.Value, error) { if !x.Valid { return nil, nil } // driver.Value accepts int64 for int values. return string(x.TenantLedgerType), nil } type NullTenantLedgerTypeStr struct { NullTenantLedgerType } func NewNullTenantLedgerTypeStr(val interface{}) (x NullTenantLedgerTypeStr) { x.Scan(val) // yes, we ignore this error, it will just be an invalid value. return } // Value implements the driver Valuer interface. func (x NullTenantLedgerTypeStr) Value() (driver.Value, error) { if !x.Valid { return nil, nil } return x.TenantLedgerType.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 }