project

package
v0.0.0-...-0821d35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrNoValidEnum = errors.New("not a valid enum")
)

Functions

func AccountStateStrings

func AccountStateStrings() []string

AccountStateStrings returns a slice of all String values of the enum.

func CountryCodeStrings

func CountryCodeStrings() []string

CountryCodeStrings returns a slice of all String values of the enum.

func CurrencyStrings

func CurrencyStrings() []string

CurrencyStrings returns a slice of all String values of the enum.

func TimezoneStrings

func TimezoneStrings() []string

TimezoneStrings returns a slice of all String values of the enum.

func UserRoleStrings

func UserRoleStrings() []string

UserRoleStrings returns a slice of all String values of the enum.

Types

type AccountState

type AccountState uint

AccountState represents various entity lifecycle states.

const (
	AccountStateStaged AccountState = iota
	AccountStateProvisioned
	AccountStateActivated
	AccountStateDeactivated
	AccountStateDeprovisioned
)

func AccountStateFromString

func AccountStateFromString(raw string) (AccountState, bool)

AccountStateFromString determines the enum value with an exact case match.

func AccountStateFromStringIgnoreCase

func AccountStateFromStringIgnoreCase(raw string) (AccountState, bool)

AccountStateFromStringIgnoreCase determines the enum value with a case-insensitive match.

func AccountStateValues

func AccountStateValues() []AccountState

AccountStateValues returns all values of the enum.

func (AccountState) IsValid

func (_a AccountState) IsValid() bool

IsValid tests whether the value is a valid enum value.

func (AccountState) MarshalJSON

func (_a AccountState) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for AccountState.

func (*AccountState) Scan

func (_a *AccountState) Scan(value interface{}) error

Scan implements the sql/driver.Scanner interface for AccountState.

func (AccountState) String

func (_a AccountState) String() string

String returns the string of the enum value. If the enum value is invalid, it will produce a string of the following pattern AccountState(%d) instead.

func (*AccountState) UnmarshalJSON

func (_a *AccountState) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for AccountState.

func (AccountState) Validate

func (_a AccountState) Validate() error

Validate whether the value is within the range of enum values.

func (AccountState) Value

func (_a AccountState) Value() (driver.Value, error)

Value implements the sql/driver.Valuer interface for AccountState.

type CountryCode

type CountryCode uint

CountryCode represents a set of 3-Letter codes of Countries. Each CountryCode comes with its additional data columns to augment the enum. Note: The CSV has an 8-column layout. The columns 3-8 are added values.

Example
cc := utils.Must(CountryCodeFromString("USA"))
fmt.Println("Country Name:", cc.GetCountryName())
fmt.Println("Country Code:", cc.GetCountryCode())
fmt.Println("Area (in km^2):", cc.GetAreaInSquareKilometer())
fmt.Println("GDP in USD:", cc.GetGdpInBillion()*1e12)
fmt.Println("Population:", cc.GetPopulation())
Output:

Country Name: United States
Country Code: 1
Area (in km^2): 9629091
GDP in USD: 1.672e+15
Population: 310232863

func CountryCodeFromString

func CountryCodeFromString(raw string) (CountryCode, bool)

CountryCodeFromString determines the enum value with an exact case match.

func CountryCodeFromStringIgnoreCase

func CountryCodeFromStringIgnoreCase(raw string) (CountryCode, bool)

CountryCodeFromStringIgnoreCase determines the enum value with a case-insensitive match.

func CountryCodeValues

func CountryCodeValues() []CountryCode

CountryCodeValues returns all values of the enum.

func (CountryCode) GetAreaInSquareKilometer

func (_c CountryCode) GetAreaInSquareKilometer() uint32

GetAreaInSquareKilometer returns the "area-in-square-kilometer" of the enum value.

func (CountryCode) GetCountryCode

func (_c CountryCode) GetCountryCode() string

GetCountryCode returns the "country-code" of the enum value.

func (CountryCode) GetCountryName

func (_c CountryCode) GetCountryName() string

GetCountryName returns the "country-name" of the enum value.

func (CountryCode) GetGdpInBillion

func (_c CountryCode) GetGdpInBillion() float64

GetGdpInBillion returns the "gdp-in-billion" of the enum value.

func (CountryCode) GetIso2LetterCode

func (_c CountryCode) GetIso2LetterCode() string

GetIso2LetterCode returns the "iso-2-letter-code" of the enum value.

func (CountryCode) GetPopulation

func (_c CountryCode) GetPopulation() uint32

GetPopulation returns the "population" of the enum value.

func (CountryCode) IsValid

func (_c CountryCode) IsValid() bool

IsValid tests whether the value is a valid enum value.

func (CountryCode) MarshalBinary

func (_c CountryCode) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for CountryCode.

func (CountryCode) MarshalGQL

func (_c CountryCode) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface for CountryCode.

func (CountryCode) MarshalJSON

func (_c CountryCode) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for CountryCode.

func (CountryCode) MarshalText

func (_c CountryCode) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for CountryCode.

func (CountryCode) MarshalYAML

func (_c CountryCode) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for CountryCode.

func (*CountryCode) Scan

func (_c *CountryCode) Scan(value interface{}) error

Scan implements the sql/driver.Scanner interface for CountryCode.

func (CountryCode) String

func (_c CountryCode) String() string

String returns the string of the enum value. If the enum value is invalid, it will produce a string of the following pattern CountryCode(%d) instead.

func (*CountryCode) UnmarshalBinary

func (_c *CountryCode) UnmarshalBinary(text []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for CountryCode.

func (*CountryCode) UnmarshalGQL

func (_c *CountryCode) UnmarshalGQL(value interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface for CountryCode.

func (*CountryCode) UnmarshalJSON

func (_c *CountryCode) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for CountryCode.

func (*CountryCode) UnmarshalText

func (_c *CountryCode) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for CountryCode.

func (*CountryCode) UnmarshalYAML

func (_c *CountryCode) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for CountryCode.

func (CountryCode) Validate

func (_c CountryCode) Validate() error

Validate whether the value is within the range of enum values.

func (CountryCode) Value

func (_c CountryCode) Value() (driver.Value, error)

Value implements the sql/driver.Valuer interface for CountryCode.

type Currency

type Currency uint

Currency represents a set of 3-Letter codes of Currencies. Each Currency comes with its additional data columns to augment the enum. Note: The CSV has a 5-column layout. The columns 3-5 are added values.

func CurrencyFromString

func CurrencyFromString(raw string) (Currency, bool)

CurrencyFromString determines the enum value with an exact case match.

func CurrencyFromStringIgnoreCase

func CurrencyFromStringIgnoreCase(raw string) (Currency, bool)

CurrencyFromStringIgnoreCase determines the enum value with a case-insensitive match.

func CurrencyValues

func CurrencyValues() []Currency

CurrencyValues returns all values of the enum.

func (Currency) GetCurrencyName

func (_c Currency) GetCurrencyName() string

GetCurrencyName returns the "currency-name" of the enum value.

func (Currency) GetMinorUnit

func (_c Currency) GetMinorUnit() uint8

GetMinorUnit returns the "minor-unit" of the enum value.

func (Currency) GetNumericCode

func (_c Currency) GetNumericCode() uint16

GetNumericCode returns the "numeric-code" of the enum value.

func (Currency) IsValid

func (_c Currency) IsValid() bool

IsValid tests whether the value is a valid enum value.

func (Currency) MarshalBinary

func (_c Currency) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for Currency.

func (Currency) MarshalGQL

func (_c Currency) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface for Currency.

func (Currency) MarshalJSON

func (_c Currency) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Currency.

func (Currency) MarshalText

func (_c Currency) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Currency.

func (Currency) MarshalYAML

func (_c Currency) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for Currency.

func (*Currency) Scan

func (_c *Currency) Scan(value interface{}) error

Scan implements the sql/driver.Scanner interface for Currency.

func (Currency) String

func (_c Currency) String() string

String returns the string of the enum value. If the enum value is invalid, it will produce a string of the following pattern Currency(%d) instead.

func (*Currency) UnmarshalBinary

func (_c *Currency) UnmarshalBinary(text []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Currency.

func (*Currency) UnmarshalGQL

func (_c *Currency) UnmarshalGQL(value interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface for Currency.

func (*Currency) UnmarshalJSON

func (_c *Currency) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Currency.

func (*Currency) UnmarshalText

func (_c *Currency) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Currency.

func (*Currency) UnmarshalYAML

func (_c *Currency) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for Currency.

func (Currency) Validate

func (_c Currency) Validate() error

Validate whether the value is within the range of enum values.

func (Currency) Value

func (_c Currency) Value() (driver.Value, error)

Value implements the sql/driver.Valuer interface for Currency.

type NotAnEnum

type NotAnEnum uint

NotAnEnum does not contain the magic comment and will therefore be ignored.

type Timezone

type Timezone uint

Timezone represents a set of 424 Timezones from TimeZoneDB. Timezone has no default value, meaning it can only be deserialized from explicit values. Note: The CSV has a 2-column layout.

const (
	TimezoneEuropeLondon Timezone = 379
)

func TimezoneFromString

func TimezoneFromString(raw string) (Timezone, bool)

TimezoneFromString determines the enum value with an exact case match.

func TimezoneFromStringIgnoreCase

func TimezoneFromStringIgnoreCase(raw string) (Timezone, bool)

TimezoneFromStringIgnoreCase determines the enum value with a case-insensitive match.

func TimezoneValues

func TimezoneValues() []Timezone

TimezoneValues returns all values of the enum.

func (Timezone) IsValid

func (_t Timezone) IsValid() bool

IsValid tests whether the value is a valid enum value.

func (Timezone) MarshalBinary

func (_t Timezone) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for Timezone.

func (Timezone) MarshalGQL

func (_t Timezone) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface for Timezone.

func (Timezone) MarshalJSON

func (_t Timezone) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Timezone.

func (Timezone) MarshalText

func (_t Timezone) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Timezone.

func (Timezone) MarshalYAML

func (_t Timezone) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for Timezone.

func (*Timezone) Scan

func (_t *Timezone) Scan(value interface{}) error

Scan implements the sql/driver.Scanner interface for Timezone.

func (Timezone) String

func (_t Timezone) String() string

String returns the string of the enum value. If the enum value is invalid, it will produce a string of the following pattern Timezone(%d) instead.

func (*Timezone) UnmarshalBinary

func (_t *Timezone) UnmarshalBinary(text []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for Timezone.

func (*Timezone) UnmarshalGQL

func (_t *Timezone) UnmarshalGQL(value interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface for Timezone.

func (*Timezone) UnmarshalJSON

func (_t *Timezone) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Timezone.

func (*Timezone) UnmarshalText

func (_t *Timezone) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Timezone.

func (*Timezone) UnmarshalYAML

func (_t *Timezone) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for Timezone.

func (Timezone) Validate

func (_t Timezone) Validate() error

Validate whether the value is within the range of enum values.

func (Timezone) Value

func (_t Timezone) Value() (driver.Value, error)

Value implements the sql/driver.Valuer interface for Timezone.

type UserRole

type UserRole uint

UserRole represents a set of user specific roles. UserRoles can be deserialized from "undefined"/empty values.

const (
	UserRoleStandard UserRole = iota // note: as default
	UserRoleEditor
	UserRoleReviewer
	UserRoleAdmin
)

func UserRoleFromString

func UserRoleFromString(raw string) (UserRole, bool)

UserRoleFromString determines the enum value with an exact case match.

func UserRoleFromStringIgnoreCase

func UserRoleFromStringIgnoreCase(raw string) (UserRole, bool)

UserRoleFromStringIgnoreCase determines the enum value with a case-insensitive match.

func UserRoleValues

func UserRoleValues() []UserRole

UserRoleValues returns all values of the enum.

func (UserRole) IsValid

func (_u UserRole) IsValid() bool

IsValid tests whether the value is a valid enum value.

func (UserRole) MarshalBinary

func (_u UserRole) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface for UserRole.

func (UserRole) MarshalGQL

func (_u UserRole) MarshalGQL(w io.Writer)

MarshalGQL implements the graphql.Marshaler interface for UserRole.

func (UserRole) MarshalJSON

func (_u UserRole) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for UserRole.

func (UserRole) MarshalText

func (_u UserRole) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for UserRole.

func (UserRole) MarshalYAML

func (_u UserRole) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for UserRole.

func (*UserRole) Scan

func (_u *UserRole) Scan(value interface{}) error

Scan implements the sql/driver.Scanner interface for UserRole.

func (UserRole) String

func (_u UserRole) String() string

String returns the string of the enum value. If the enum value is invalid, it will produce a string of the following pattern UserRole(%d) instead.

func (*UserRole) UnmarshalBinary

func (_u *UserRole) UnmarshalBinary(text []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for UserRole.

func (*UserRole) UnmarshalGQL

func (_u *UserRole) UnmarshalGQL(value interface{}) error

UnmarshalGQL implements the graphql.Unmarshaler interface for UserRole.

func (*UserRole) UnmarshalJSON

func (_u *UserRole) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for UserRole.

func (*UserRole) UnmarshalText

func (_u *UserRole) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for UserRole.

func (*UserRole) UnmarshalYAML

func (_u *UserRole) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for UserRole.

func (UserRole) Validate

func (_u UserRole) Validate() error

Validate whether the value is within the range of enum values.

func (UserRole) Value

func (_u UserRole) Value() (driver.Value, error)

Value implements the sql/driver.Valuer interface for UserRole.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL