example

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllBaseEnums = enum.FloatEnums{
	A, C, G, T,
}

AllBaseEnums lists all 4 values in order.

View Source
var AllBases = []Base{
	A, C, G, T,
}

AllBases lists all 4 values in order.

View Source
var AllCountries = []Country{}/* 247 elements not displayed */

AllCountries lists all 247 values in order.

View Source
var AllCountryEnums = enum.IntEnums{}/* 247 elements not displayed */

AllCountryEnums lists all 247 values in order.

AllDayEnums lists all 7 values in order.

AllDays lists all 7 values in order.

AllGreekAlphabetEnums lists all 24 values in order.

AllGreekAlphabets lists all 24 values in order.

View Source
var AllMethodEnums = enum.IntEnums{
	HEAD, GET, PUT, POST,
	PATCH, DELETE,
}

AllMethodEnums lists all 6 values in order.

View Source
var AllMethods = []Method{
	HEAD, GET, PUT, POST,
	PATCH, DELETE,
}

AllMethods lists all 6 values in order.

AllMonthEnums lists all 12 values in order.

AllMonths lists all 12 values in order.

AllPetEnums lists all 5 values in order.

AllPets lists all 5 values in order.

View Source
var AllSalesChannelEnums = enum.IntEnums{
	OnlineSales, InstoreSales, TelephoneSales,
}

AllSalesChannelEnums lists all 3 values in order.

AllSalesChannels lists all 3 values in order.

Functions

This section is empty.

Types

type Base

type Base float32
const A Base = 331.2

Nucleotide Molecular Weights, g/mol

const C Base = 307.2
const G Base = 347.2
const T Base = 322.2

func AsBase

func AsBase(s string) (Base, error)

AsBase parses a string to find the corresponding Base, accepting either one of the string values or a number. The input representation is determined by baseMarshalTextRep. It wraps Parse.

func BaseOf

func BaseOf(v int) Base

BaseOf returns a Base based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid Base is returned.

func MustParseBase added in v2.7.0

func MustParseBase(s string) Base

MustParseBase is similar to AsBase except that it panics on error.

func (Base) Float

func (v Base) Float() float64

Float returns the float64 value. It serves to facilitate polymorphism (see enum.FloatEnum).

func (Base) IsValid

func (v Base) IsValid() bool

IsValid determines whether a Base is one of the defined constants.

func (Base) MarshalJSON

func (v Base) MarshalJSON() ([]byte, error)

MarshalJSON converts values to bytes suitable for transmission via JSON. The representation is chosen according to baseMarshalTextRep.

func (Base) MarshalText

func (v Base) MarshalText() (text []byte, err error)

MarshalText converts values to a form suitable for transmission via XML etc. The representation is chosen according to baseMarshalTextRep.

func (Base) Ordinal

func (v Base) Ordinal() int

Ordinal returns the ordinal number of a Base. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*Base) Parse

func (v *Base) Parse(s string) error

Parse parses a string to find the corresponding Base, accepting one of the string values or a number. The input representation is determined by baseMarshalTextRep. It is used by AsBase.

Usage Example

v := new(Base)
err := v.Parse(s)
...  etc

func (*Base) Scan

func (v *Base) Scan(value interface{}) error

Scan parses some value, which can be a number, a string or []byte. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner

func (Base) String

func (v Base) String() string

String returns the literal string representation of a Base, which is the same as the const identifier but without prefix or suffix.

func (Base) Tag

func (v Base) Tag() string

Tag returns the string representation of a Base. This is an alias for String.

func (*Base) UnmarshalJSON

func (v *Base) UnmarshalJSON(text []byte) error

UnmarshalJSON converts transmitted JSON values to ordinary values. It allows both ordinals and strings to represent the values.

func (*Base) UnmarshalText

func (v *Base) UnmarshalText(text []byte) error

UnmarshalText converts transmitted values to ordinary values.

func (Base) Value

func (v Base) Value() (driver.Value, error)

Value converts the Base to a string. It implements driver.Valuer, https://golang.org/pkg/database/sql/driver/#Valuer

type Country added in v2.5.0

type Country int
const (
	Afghanistan Country = iota
	Aland_Islands
	Albania
	Algeria
	American_Samoa
	Andorra
	Angola
	Anguilla
	Antarctica
	Antigua_and_Barbuda
	Argentina
	Armenia
	Aruba
	Australia
	Austria
	Azerbaijan
	Bahamas
	Bahrain
	Bangladesh
	Barbados
	Belarus
	Belgium
	Belize
	Benin
	Bermuda
	Bhutan
	Bolivia
	Bosnia_and_Herzegovina
	Botswana
	Bouvet_Island
	Brazil
	British_Virgin_Islands
	British_Indian_Ocean_Territory
	Brunei_Darussalam
	Bulgaria
	Burkina_Faso
	Burundi
	Cambodia
	Cameroon
	Canada
	Cape_Verde
	Cayman_Islands
	Central_African_Republic
	Chad
	Chile
	China
	Hong_Kong // Special Administrative Region of China
	Macao     // Special Administrative Region of China
	Christmas_Island
	Cocos_Islands // Cocos (Keeling) Islands
	Colombia
	Comoros
	Congo_Brazzaville // Congo (Brazzaville)
	Congo_DRC         // Democratic Republic of the Congo
	Cook_Islands
	Costa_Rica
	Côte_dIvoire // Côte_d’Ivoire
	Croatia
	Cuba
	Cyprus
	Czech_Republic
	Denmark
	Djibouti
	Dominica
	Dominican_Republic
	Ecuador
	Egypt
	El_Salvador
	Equatorial_Guinea
	Eritrea
	Estonia
	Ethiopia
	Falkland_Islands // Falkland Islands (Malvinas)
	Faroe_Islands
	Fiji
	Finland
	France
	French_Guiana
	French_Polynesia
	French_Southern_Territories
	Gabon
	Gambia
	Georgia
	Germany
	Ghana
	Gibraltar
	Greece
	Greenland
	Grenada
	Guadeloupe
	Guam
	Guatemala
	Guernsey
	Guinea
	Guinea_Bissau
	Guyana
	Haiti
	Heard_Island_and_Mcdonald_Islands
	Holy_See // Vatican City State
	Honduras
	Hungary
	Iceland
	India
	Indonesia
	Iran // Islamic Republic of Iran
	Iraq
	Ireland
	Isle_of_Man
	Israel
	Italy
	Jamaica
	Japan
	Jersey
	Jordan
	Kazakhstan
	Kenya
	Kiribati
	Democratic_Peoples_Republic_of_Korea // Democratic People’s Republic of Korea
	South_Korea                          // Republic of Korea
	Kuwait
	Kyrgyzstan
	Lao_PDR
	Latvia
	Lebanon
	Lesotho
	Liberia
	Libya
	Liechtenstein
	Lithuania
	Luxembourg
	Macedonia // Republic of Macedonia
	Madagascar
	Malawi
	Malaysia
	Maldives
	Mali
	Malta
	Marshall_Islands
	Martinique
	Mauritania
	Mauritius
	Mayotte
	Mexico
	Micronesia // Federated States of Micronesia
	Moldova
	Monaco
	Mongolia
	Montenegro
	Montserrat
	Morocco
	Mozambique
	Myanmar
	Namibia
	Nauru
	Nepal
	Netherlands
	Netherlands_Antilles
	New_Caledonia
	New_Zealand
	Nicaragua
	Niger
	Nigeria
	Niue
	Norfolk_Island
	Northern_Mariana_Islands
	Norway
	Oman
	Pakistan
	Palau
	Palestinian_Territory // Palestinian Territory, Occupied
	Panama
	Papua_New_Guinea
	Paraguay
	Peru
	Philippines
	Pitcairn
	Poland
	Portugal
	Puerto_Rico
	Qatar
	Réunion
	Romania
	Russian_Federation
	Rwanda
	Saint_Barthélemy
	Saint_Helena
	Saint_Kitts_and_Nevis
	Saint_Lucia
	Saint_Martin // Saint-Martin (French part)
	Saint_Pierre_and_Miquelon
	Saint_Vincent_and_Grenadines
	Samoa
	San_Marino
	Sao_Tome_and_Principe
	Saudi_Arabia
	Senegal
	Serbia
	Seychelles
	Sierra_Leone
	Singapore
	Slovakia
	Slovenia
	Solomon_Islands
	Somalia
	South_Africa
	South_Georgia_and_the_South_Sandwich_Islands
	South_Sudan
	Spain
	Sri_Lanka
	Sudan
	Suriname
	Svalbard_and_Jan_Mayen_Islands
	Swaziland // Eswatini
	Sweden
	Switzerland
	Syria  // Syrian Arab Republic
	Taiwan // Taiwan, Republic of China
	Tajikistan
	Tanzania // United Republic of Tanzania
	Thailand
	Timor_Leste
	Togo
	Tokelau
	Tonga
	Trinidad_and_Tobago
	Tunisia
	Turkey
	Turkmenistan
	Turks_and_Caicos_Islands
	Tuvalu
	Uganda
	Ukraine
	United_Arab_Emirates
	United_Kingdom
	United_States_of_America
	United_States_Minor_Outlying_Islands
	Uruguay
	Uzbekistan
	Vanuatu
	Venezuela // Bolivarian Republic of Venezuela
	Viet_Nam
	Virgin_Islands
	Wallis_and_Futuna_Islands
	Western_Sahara
	Yemen
	Zambia
	Zimbabwe
)

func AsCountry added in v2.5.0

func AsCountry(s string) (Country, error)

AsCountry parses a string to find the corresponding Country, accepting either one of the string values or a number. The input representation is determined by countryMarshalTextRep. It wraps Parse. The input case does not matter.

func CountryOf added in v2.5.0

func CountryOf(v int) Country

CountryOf returns a Country based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid Country is returned.

func MustParseCountry added in v2.7.0

func MustParseCountry(s string) Country

MustParseCountry is similar to AsCountry except that it panics on error. The input case does not matter.

func (Country) Int added in v2.5.0

func (v Country) Int() int

Int returns the int value, which is not necessarily the same as the ordinal. This facilitates polymorphism (see enum.IntEnum).

func (Country) IsValid added in v2.5.0

func (v Country) IsValid() bool

IsValid determines whether a Country is one of the defined constants.

func (Country) MarshalJSON added in v2.5.0

func (v Country) MarshalJSON() ([]byte, error)

MarshalJSON converts values to bytes suitable for transmission via JSON. The representation is chosen according to countryMarshalTextRep.

func (Country) MarshalText added in v2.5.0

func (v Country) MarshalText() (text []byte, err error)

MarshalText converts values to a form suitable for transmission via XML etc. The representation is chosen according to countryMarshalTextRep.

func (Country) Ordinal added in v2.5.0

func (v Country) Ordinal() int

Ordinal returns the ordinal number of a Country. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*Country) Parse added in v2.5.0

func (v *Country) Parse(s string) error

Parse parses a string to find the corresponding Country, accepting one of the string values or a number. The input representation is determined by countryMarshalTextRep. It is used by AsCountry. The input case does not matter.

Usage Example

v := new(Country)
err := v.Parse(s)
...  etc

func (*Country) Scan added in v2.5.0

func (v *Country) Scan(value interface{}) error

Scan parses some value, which can be a number, a string or []byte. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner

func (Country) String added in v2.5.0

func (v Country) String() string

String returns the literal string representation of a Country, which is the same as the const identifier but without prefix or suffix.

func (Country) Tag added in v2.5.0

func (v Country) Tag() string

Tag returns the string representation of a Country. For invalid values, this returns v.String() (see IsValid).

func (*Country) UnmarshalJSON added in v2.5.0

func (v *Country) UnmarshalJSON(text []byte) error

UnmarshalJSON converts transmitted JSON values to ordinary values. It allows both ordinals and strings to represent the values.

func (*Country) UnmarshalText added in v2.5.0

func (v *Country) UnmarshalText(text []byte) error

UnmarshalText converts transmitted values to ordinary values.

func (Country) Value added in v2.5.0

func (v Country) Value() (driver.Value, error)

Value converts the Country to a string. It implements driver.Valuer, https://golang.org/pkg/database/sql/driver/#Valuer

type Day

type Day uint
const (
	Sunday Day
	Monday
	Tuesday
	Wednesday
)
const (
	Thursday Day = iota + 5
	Friday
	Saturday
)

It is allowable to break the constant blocks (although it's a bit unnecessary here). However, the numeric values *must* all be distinct, otherwise the generated enum will not compile.

func AsDay

func AsDay(s string) (Day, error)

AsDay parses a string to find the corresponding Day, accepting either one of the string values or a number. The input representation is determined by dayMarshalTextRep. It wraps Parse.

func DayOf

func DayOf(v int) Day

DayOf returns a Day based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid Day is returned.

func MustParseDay added in v2.7.0

func MustParseDay(s string) Day

MustParseDay is similar to AsDay except that it panics on error.

func (Day) Int

func (v Day) Int() int

Int returns the int value, which is not necessarily the same as the ordinal. This facilitates polymorphism (see enum.IntEnum).

func (Day) IsValid

func (v Day) IsValid() bool

IsValid determines whether a Day is one of the defined constants.

func (Day) MarshalJSON

func (v Day) MarshalJSON() ([]byte, error)

MarshalJSON converts values to bytes suitable for transmission via JSON. The representation is chosen according to dayMarshalTextRep.

func (Day) MarshalText

func (v Day) MarshalText() (text []byte, err error)

MarshalText converts values to a form suitable for transmission via XML etc. The representation is chosen according to dayMarshalTextRep.

func (Day) Ordinal

func (v Day) Ordinal() int

Ordinal returns the ordinal number of a Day. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*Day) Parse

func (v *Day) Parse(s string) error

Parse parses a string to find the corresponding Day, accepting one of the string values or a number. The input representation is determined by dayMarshalTextRep. It is used by AsDay.

Usage Example

v := new(Day)
err := v.Parse(s)
...  etc

func (*Day) Scan

func (v *Day) Scan(value interface{}) error

Scan parses some value, which can be a number, a string or []byte. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner

func (Day) String

func (v Day) String() string

String returns the literal string representation of a Day, which is the same as the const identifier but without prefix or suffix.

func (Day) Tag

func (v Day) Tag() string

Tag returns the string representation of a Day. This is an alias for String.

func (*Day) UnmarshalJSON

func (v *Day) UnmarshalJSON(text []byte) error

UnmarshalJSON converts transmitted JSON values to ordinary values. It allows both ordinals and strings to represent the values.

func (*Day) UnmarshalText

func (v *Day) UnmarshalText(text []byte) error

UnmarshalText converts transmitted values to ordinary values.

func (Day) Value

func (v Day) Value() (driver.Value, error)

Value converts the Day to a string. It implements driver.Valuer, https://golang.org/pkg/database/sql/driver/#Valuer

type GreekAlphabet added in v2.1.0

type GreekAlphabet int
const (
	Αλφα GreekAlphabet = iota + 1 // U0391 = Α
	Βήτα
	Γάμμα
	Δέλτα
	Εψιλον
	Ζήτα // U0396
	Ητα
	Θήτα
	Ιώτα
	Κάππα
	Λάμβδα // U039b
	Μυ
	Νυ
	Ξι
	Ομικρον
	Πι // U03A0
	Ρώ
	// there is no U03A2
	Σίγμα // U03a3
	Ταυ
	Υψιλον
	Φι
	Χι // U03a7
	Ψι
	Ωμέγα
)

func AsGreekAlphabet added in v2.1.0

func AsGreekAlphabet(s string) (GreekAlphabet, error)

AsGreekAlphabet parses a string to find the corresponding GreekAlphabet, accepting either one of the string values or a number. The input representation is determined by greekalphabetMarshalTextRep. It wraps Parse.

func GreekAlphabetOf added in v2.1.0

func GreekAlphabetOf(v int) GreekAlphabet

GreekAlphabetOf returns a GreekAlphabet based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid GreekAlphabet is returned.

func MustParseGreekAlphabet added in v2.7.0

func MustParseGreekAlphabet(s string) GreekAlphabet

MustParseGreekAlphabet is similar to AsGreekAlphabet except that it panics on error.

func (GreekAlphabet) Int added in v2.1.0

func (v GreekAlphabet) Int() int

Int returns the int value, which is not necessarily the same as the ordinal. This facilitates polymorphism (see enum.IntEnum).

func (GreekAlphabet) IsValid added in v2.1.0

func (v GreekAlphabet) IsValid() bool

IsValid determines whether a GreekAlphabet is one of the defined constants.

func (GreekAlphabet) MarshalJSON added in v2.1.0

func (v GreekAlphabet) MarshalJSON() ([]byte, error)

MarshalJSON converts values to bytes suitable for transmission via JSON. The representation is chosen according to greekalphabetMarshalTextRep.

func (GreekAlphabet) MarshalText added in v2.1.0

func (v GreekAlphabet) MarshalText() (text []byte, err error)

MarshalText converts values to a form suitable for transmission via XML etc. The representation is chosen according to greekalphabetMarshalTextRep.

func (GreekAlphabet) Ordinal added in v2.1.0

func (v GreekAlphabet) Ordinal() int

Ordinal returns the ordinal number of a GreekAlphabet. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*GreekAlphabet) Parse added in v2.1.0

func (v *GreekAlphabet) Parse(s string) error

Parse parses a string to find the corresponding GreekAlphabet, accepting one of the string values or a number. The input representation is determined by greekalphabetMarshalTextRep. It is used by AsGreekAlphabet.

Usage Example

v := new(GreekAlphabet)
err := v.Parse(s)
...  etc

func (*GreekAlphabet) Scan added in v2.1.0

func (v *GreekAlphabet) Scan(value interface{}) error

Scan parses some value, which can be a number, a string or []byte. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner

func (GreekAlphabet) String added in v2.1.0

func (v GreekAlphabet) String() string

String returns the literal string representation of a GreekAlphabet, which is the same as the const identifier but without prefix or suffix.

func (GreekAlphabet) Tag added in v2.1.0

func (v GreekAlphabet) Tag() string

Tag returns the string representation of a GreekAlphabet. For invalid values, this returns v.String() (see IsValid).

func (*GreekAlphabet) UnmarshalJSON added in v2.1.0

func (v *GreekAlphabet) UnmarshalJSON(text []byte) error

UnmarshalJSON converts transmitted JSON values to ordinary values. It allows both ordinals and strings to represent the values.

func (*GreekAlphabet) UnmarshalText added in v2.1.0

func (v *GreekAlphabet) UnmarshalText(text []byte) error

UnmarshalText converts transmitted values to ordinary values.

func (GreekAlphabet) Value added in v2.1.0

func (v GreekAlphabet) Value() (driver.Value, error)

Value converts the GreekAlphabet to a string. It implements driver.Valuer, https://golang.org/pkg/database/sql/driver/#Valuer

type Method

type Method uint
const (
	HEAD Method = iota
	GET
	PUT
	POST
	PATCH
	DELETE
)

func AsMethod

func AsMethod(s string) (Method, error)

AsMethod parses a string to find the corresponding Method, accepting either one of the string values or a number. The input representation is determined by methodMarshalTextRep. It wraps Parse. The input case does not matter.

func MethodOf

func MethodOf(v int) Method

MethodOf returns a Method based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid Method is returned.

func MustParseMethod added in v2.7.0

func MustParseMethod(s string) Method

MustParseMethod is similar to AsMethod except that it panics on error. The input case does not matter.

func (Method) Int

func (v Method) Int() int

Int returns the int value, which is not necessarily the same as the ordinal. This facilitates polymorphism (see enum.IntEnum).

func (Method) IsValid

func (v Method) IsValid() bool

IsValid determines whether a Method is one of the defined constants.

func (Method) MarshalJSON

func (v Method) MarshalJSON() ([]byte, error)

MarshalJSON converts values to bytes suitable for transmission via JSON. The representation is chosen according to methodMarshalTextRep.

func (Method) MarshalText

func (v Method) MarshalText() (text []byte, err error)

MarshalText converts values to a form suitable for transmission via XML etc. The representation is chosen according to methodMarshalTextRep.

func (Method) Ordinal

func (v Method) Ordinal() int

Ordinal returns the ordinal number of a Method. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*Method) Parse

func (v *Method) Parse(s string) error

Parse parses a string to find the corresponding Method, accepting one of the string values or a number. The input representation is determined by methodMarshalTextRep. It is used by AsMethod. The input case does not matter.

Usage Example

v := new(Method)
err := v.Parse(s)
...  etc

func (*Method) Scan

func (v *Method) Scan(value interface{}) error

Scan parses some value, which can be a number, a string or []byte. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner

func (Method) String

func (v Method) String() string

String returns the literal string representation of a Method, which is the same as the const identifier but without prefix or suffix.

func (Method) Tag

func (v Method) Tag() string

Tag returns the string representation of a Method. For invalid values, this returns v.String() (see IsValid).

func (*Method) UnmarshalJSON

func (v *Method) UnmarshalJSON(text []byte) error

UnmarshalJSON converts transmitted JSON values to ordinary values. It allows both ordinals and strings to represent the values.

func (*Method) UnmarshalText

func (v *Method) UnmarshalText(text []byte) error

UnmarshalText converts transmitted values to ordinary values.

func (Method) Value

func (v Method) Value() (driver.Value, error)

Value converts the Method to a string. It implements driver.Valuer, https://golang.org/pkg/database/sql/driver/#Valuer

type Month

type Month uint
const (
	January, February, March    Month = 1, 2, 3
	April, May, June            Month = 4, 5, 6
	July, August, September     Month = 7, 8, 9
	October, November, December Month = 10, 11, 12
)

func AsMonth

func AsMonth(s string) (Month, error)

AsMonth parses a string to find the corresponding Month, accepting either one of the string values or a number. The input representation is determined by monthMarshalTextRep. It wraps Parse. The input case does not matter.

func MonthOf

func MonthOf(v int) Month

MonthOf returns a Month based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid Month is returned.

func MustParseMonth added in v2.7.0

func MustParseMonth(s string) Month

MustParseMonth is similar to AsMonth except that it panics on error. The input case does not matter.

func (Month) Int

func (v Month) Int() int

Int returns the int value, which is not necessarily the same as the ordinal. This facilitates polymorphism (see enum.IntEnum).

func (Month) IsValid

func (v Month) IsValid() bool

IsValid determines whether a Month is one of the defined constants.

func (Month) MarshalJSON

func (v Month) MarshalJSON() ([]byte, error)

MarshalJSON converts values to bytes suitable for transmission via JSON. The representation is chosen according to monthMarshalTextRep.

func (Month) MarshalText

func (v Month) MarshalText() (text []byte, err error)

MarshalText converts values to a form suitable for transmission via XML etc. The representation is chosen according to monthMarshalTextRep.

func (Month) Ordinal

func (v Month) Ordinal() int

Ordinal returns the ordinal number of a Month. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*Month) Parse

func (v *Month) Parse(s string) error

Parse parses a string to find the corresponding Month, accepting one of the string values or a number. The input representation is determined by monthMarshalTextRep. It is used by AsMonth. The input case does not matter.

Usage Example

v := new(Month)
err := v.Parse(s)
...  etc

func (*Month) Scan

func (v *Month) Scan(value interface{}) error

Scan parses some value, which can be a number, a string or []byte. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner

func (Month) String

func (v Month) String() string

String returns the literal string representation of a Month, which is the same as the const identifier but without prefix or suffix.

func (Month) Tag

func (v Month) Tag() string

Tag returns the string representation of a Month. This is an alias for String.

func (*Month) UnmarshalJSON

func (v *Month) UnmarshalJSON(text []byte) error

UnmarshalJSON converts transmitted JSON values to ordinary values. It allows both ordinals and strings to represent the values.

func (*Month) UnmarshalText

func (v *Month) UnmarshalText(text []byte) error

UnmarshalText converts transmitted values to ordinary values.

func (Month) Value

func (v Month) Value() (driver.Value, error)

Value converts the Month to a string. It implements driver.Valuer, https://golang.org/pkg/database/sql/driver/#Valuer

type Pet

type Pet uint16
const (
	MyCat Pet = iota
	MyDog
	MyMouse
	MyElephant
	MyKoala_Bear
)

These all have prefix "My", which is stripped from the String representation.

func AsPet

func AsPet(s string) (Pet, error)

AsPet parses a string to find the corresponding Pet, accepting either one of the string values or a number. The input representation is determined by petMarshalTextRep. It wraps Parse.

func MustParsePet added in v2.7.0

func MustParsePet(s string) Pet

MustParsePet is similar to AsPet except that it panics on error.

func PetOf

func PetOf(v int) Pet

PetOf returns a Pet based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid Pet is returned.

func (Pet) Int

func (v Pet) Int() int

Int returns the int value, which is not necessarily the same as the ordinal. This facilitates polymorphism (see enum.IntEnum).

func (Pet) IsValid

func (v Pet) IsValid() bool

IsValid determines whether a Pet is one of the defined constants.

func (Pet) MarshalJSON

func (v Pet) MarshalJSON() ([]byte, error)

MarshalJSON converts values to bytes suitable for transmission via JSON. The representation is chosen according to petMarshalTextRep.

func (Pet) MarshalText

func (v Pet) MarshalText() (text []byte, err error)

MarshalText converts values to a form suitable for transmission via XML etc. The representation is chosen according to petMarshalTextRep.

func (Pet) Ordinal

func (v Pet) Ordinal() int

Ordinal returns the ordinal number of a Pet. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*Pet) Parse

func (v *Pet) Parse(s string) error

Parse parses a string to find the corresponding Pet, accepting one of the string values or a number. The input representation is determined by petMarshalTextRep. It is used by AsPet.

Usage Example

v := new(Pet)
err := v.Parse(s)
...  etc

func (*Pet) Scan

func (v *Pet) Scan(value interface{}) error

Scan parses some value, which can be a number, a string or []byte. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner

func (Pet) String

func (v Pet) String() string

String returns the literal string representation of a Pet, which is the same as the const identifier but without prefix or suffix.

func (Pet) Tag

func (v Pet) Tag() string

Tag returns the string representation of a Pet. For invalid values, this returns v.String() (see IsValid).

func (*Pet) UnmarshalJSON

func (v *Pet) UnmarshalJSON(text []byte) error

UnmarshalJSON converts transmitted JSON values to ordinary values. It allows both ordinals and strings to represent the values.

func (*Pet) UnmarshalText

func (v *Pet) UnmarshalText(text []byte) error

UnmarshalText converts transmitted values to ordinary values.

func (Pet) Value

func (v Pet) Value() (driver.Value, error)

Value converts the Pet to a string. It implements driver.Valuer, https://golang.org/pkg/database/sql/driver/#Valuer

type SalesChannel added in v2.9.0

type SalesChannel int
const (
	OnlineSales    SalesChannel // json:"webshop" sql:"o" -- String() is "online"
	InstoreSales                // json:"store"   sql:"s" -- String() is "instore"
	TelephoneSales              // json:"phone"   sql:"t" -- String() is "telephone"
)

func AsSalesChannel added in v2.9.0

func AsSalesChannel(s string) (SalesChannel, error)

AsSalesChannel parses a string to find the corresponding SalesChannel, accepting either one of the string values or a number. The input representation is determined by saleschannelMarshalTextRep. It wraps Parse.

func MustParseSalesChannel added in v2.9.0

func MustParseSalesChannel(s string) SalesChannel

MustParseSalesChannel is similar to AsSalesChannel except that it panics on error.

func SalesChannelOf added in v2.9.0

func SalesChannelOf(v int) SalesChannel

SalesChannelOf returns a SalesChannel based on an ordinal number. This is the inverse of Ordinal. If the ordinal is out of range, an invalid SalesChannel is returned.

func (SalesChannel) Int added in v2.9.0

func (v SalesChannel) Int() int

Int returns the int value, which is not necessarily the same as the ordinal. This facilitates polymorphism (see enum.IntEnum).

func (SalesChannel) IsValid added in v2.9.0

func (v SalesChannel) IsValid() bool

IsValid determines whether a SalesChannel is one of the defined constants.

func (SalesChannel) MarshalJSON added in v2.9.0

func (v SalesChannel) MarshalJSON() ([]byte, error)

MarshalJSON converts values to bytes suitable for transmission via JSON. The representation is chosen according to saleschannelMarshalTextRep.

func (SalesChannel) MarshalText added in v2.9.0

func (v SalesChannel) MarshalText() (text []byte, err error)

MarshalText converts values to a form suitable for transmission via XML etc. The representation is chosen according to saleschannelMarshalTextRep.

func (SalesChannel) Ordinal added in v2.9.0

func (v SalesChannel) Ordinal() int

Ordinal returns the ordinal number of a SalesChannel. This is an integer counting from zero. It is *not* the same as the const number assigned to the value.

func (*SalesChannel) Parse added in v2.9.0

func (v *SalesChannel) Parse(s string) error

Parse parses a string to find the corresponding SalesChannel, accepting one of the string values or a number. The input representation is determined by saleschannelMarshalTextRep. It is used by AsSalesChannel.

Usage Example

v := new(SalesChannel)
err := v.Parse(s)
...  etc

func (*SalesChannel) Scan added in v2.9.0

func (v *SalesChannel) Scan(value interface{}) error

Scan parses some value, which can be a number, a string or []byte. It implements sql.Scanner, https://golang.org/pkg/database/sql/#Scanner

func (SalesChannel) String added in v2.9.0

func (v SalesChannel) String() string

String returns the literal string representation of a SalesChannel, which is the same as the const identifier but without prefix or suffix.

func (SalesChannel) Tag added in v2.9.0

func (v SalesChannel) Tag() string

Tag returns the JSON representation of a SalesChannel.

func (*SalesChannel) UnmarshalJSON added in v2.9.0

func (v *SalesChannel) UnmarshalJSON(text []byte) error

UnmarshalJSON converts transmitted JSON values to ordinary values. It allows both ordinals and strings to represent the values.

func (*SalesChannel) UnmarshalText added in v2.9.0

func (v *SalesChannel) UnmarshalText(text []byte) error

UnmarshalText converts transmitted values to ordinary values.

func (SalesChannel) Value added in v2.9.0

func (v SalesChannel) Value() (driver.Value, error)

Value converts the SalesChannel to a string. It implements driver.Valuer, https://golang.org/pkg/database/sql/driver/#Valuer

Jump to

Keyboard shortcuts

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