enum

package
v0.0.0-...-2f30d10 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAllNegative = errors.New("not a valid AllNegative")
View Source
var ErrInvalidAnimal = errors.New("not a valid Animal")
View Source
var ErrInvalidColor = errors.New("not a valid Color")
View Source
var ErrInvalidCommented = errors.New("not a valid Commented")
View Source
var ErrInvalidComplexCommented = errors.New("not a valid ComplexCommented")
View Source
var ErrInvalidDiffBase = errors.New("not a valid DiffBase")
View Source
var ErrInvalidEnum32bit = errors.New("not a valid Enum32bit")
View Source
var ErrInvalidEnum64bit = errors.New("not a valid Enum64bit")
View Source
var ErrInvalidForceLowerType = errors.New("not a valid ForceLowerType")
View Source
var ErrInvalidForceUpperType = errors.New("not a valid ForceUpperType")
View Source
var ErrInvalidIntShop = fmt.Errorf("not a valid IntShop, try [%s]", strings.Join(_IntShopNames, ", "))
View Source
var ErrInvalidMake = fmt.Errorf("not a valid Make, try [%s]", strings.Join(_MakeNames, ", "))
View Source
var ErrInvalidNoZeros = fmt.Errorf("not a valid NoZeros, try [%s]", strings.Join(_NoZerosNames, ", "))
View Source
var ErrInvalidProduct = errors.New("not a valid Product")
View Source
var ErrInvalidProjectStatus = errors.New("not a valid ProjectStatus")
View Source
var ErrInvalidProjectStrStatus = errors.New("not a valid ProjectStrStatus")
View Source
var ErrInvalidProjectStrStatusIntCode = errors.New("not a valid ProjectStrStatusIntCode")
View Source
var ErrInvalidShop = fmt.Errorf("not a valid Shop, try [%s]", strings.Join(_ShopNames, ", "))
View Source
var ErrInvalidStatus = errors.New("not a valid Status")
View Source
var ErrInvalidSuffix = errors.New("not a valid Suffix")
View Source
var ErrProjectStatusNilPtr = errors.New("value pointer is nil")
View Source
var ErrProjectStrStatusIntCodeNilPtr = errors.New("value pointer is nil")
View Source
var ErrProjectStrStatusNilPtr = errors.New("value pointer is nil")

Functions

func IntShopNames

func IntShopNames() []string

IntShopNames returns a list of the names of IntShop

func MakeNames

func MakeNames() []string

MakeNames returns a list of the names of Make

func NoZerosNames

func NoZerosNames() []string

NoZerosNames returns a list of the names of NoZeros

func ShopNames

func ShopNames() []string

ShopNames returns a list of the names of Shop

Types

type AllNegative

type AllNegative int

@ENUM{ Unknown = -5, Good, Bad, Ugly }.

const (
	// AllNegativeUnknown is an AllNegative of type Unknown.
	AllNegativeUnknown AllNegative = -5
	// AllNegativeGood is an AllNegative of type Good.
	AllNegativeGood AllNegative = -4
	// AllNegativeBad is an AllNegative of type Bad.
	AllNegativeBad AllNegative = -3
	// AllNegativeUgly is an AllNegative of type Ugly.
	AllNegativeUgly AllNegative = -2
)

func ParseAllNegative

func ParseAllNegative(value string) (AllNegative, error)

ParseAllNegative converts a string to an AllNegative.

func (AllNegative) IsValid

func (x AllNegative) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (AllNegative) Name

func (x AllNegative) Name() string

Name is the attribute of AllNegative.

func (AllNegative) String

func (x AllNegative) String() string

String implements the Stringer interface.

func (AllNegative) Val

func (x AllNegative) Val() int

Val is the attribute of AllNegative.

type Animal

type Animal int32

Animal x @ENUM(Name string){ Cat(_), Dog(Dog), Fish("Fish") FishPlusPlus("Fish++") FishSharp("Fish#") }.

const (
	// AnimalCat is an Animal of type Cat.
	AnimalCat Animal = iota
	// AnimalDog is an Animal of type Dog.
	AnimalDog
	// AnimalFish is an Animal of type Fish.
	AnimalFish
	// AnimalFishPlusPlus is an Animal of type Fish++.
	AnimalFishPlusPlus
	// AnimalFishSharp is an Animal of type Fish#.
	AnimalFishSharp
)

func ParseAnimal

func ParseAnimal(value string) (Animal, error)

ParseAnimal converts a string to an Animal.

func (Animal) IsValid

func (x Animal) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Animal) Name

func (x Animal) Name() string

Name is the attribute of Animal.

func (Animal) String

func (x Animal) String() string

String implements the Stringer interface.

func (Animal) Val

func (x Animal) Val() int32

Val is the attribute of Animal.

type Color

type Color int

Color is an enumeration of colors that are allowed. @EnumConfig(marshal, noCase, Mustparse, ptr)

@ENUM (Name string){

Black(_), White(_), Red(_) Green(_) = 33 // Green starts with 33

Blue(_) grey(_)=45 _ _ yellow(_) blue_green("blue-green") red_orange("red-orange") yellow_green(_) red_orange_blue("red-orange-blue") }

const (
	// ColorBlack is a Color of type Black.
	ColorBlack Color = 0
	// ColorWhite is a Color of type White.
	ColorWhite Color = 1
	// ColorRed is a Color of type Red.
	ColorRed Color = 2
	// ColorGreen is a Color of type Green.
	ColorGreen Color = 33 // Green starts with 33
	// ColorBlue is a Color of type Blue.
	ColorBlue Color = 34
	// ColorGrey is a Color of type grey.
	ColorGrey Color = 45

	// ColorYellow is a Color of type yellow.
	ColorYellow Color = 48
	// ColorBlueGreen is a Color of type blue-green.
	ColorBlueGreen Color = 49
	// ColorRedOrange is a Color of type red-orange.
	ColorRedOrange Color = 50
	// ColorYellowGreen is a Color of type yellow_green.
	ColorYellowGreen Color = 51
	// ColorRedOrangeBlue is a Color of type red-orange-blue.
	ColorRedOrangeBlue Color = 52
)

func MustParseColor

func MustParseColor(value string) Color

MustParseColor converts a string to a Color, and panics if is not valid.

func ParseColor

func ParseColor(value string) (Color, error)

ParseColor converts a string to a Color.

func (Color) IsValid

func (x Color) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Color) MarshalText

func (x Color) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Color) Name

func (x Color) Name() string

Name is the attribute of Color.

func (Color) Ptr

func (x Color) Ptr() *Color

func (Color) String

func (x Color) String() string

String implements the Stringer interface.

func (*Color) UnmarshalText

func (x *Color) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (Color) Val

func (x Color) Val() int

Val is the attribute of Color.

type Commented

type Commented int

Commented is an enumeration of commented values

@ENUM{ value1 // Commented value 1 value2 value3 // Commented value 3 }

const (
	// CommentedValue1 is a Commented of type value1.
	CommentedValue1 Commented = iota // Commented value 1
	// CommentedValue2 is a Commented of type value2.
	CommentedValue2
	// CommentedValue3 is a Commented of type value3.
	CommentedValue3 // Commented value 3
)

func ParseCommented

func ParseCommented(value string) (Commented, error)

ParseCommented converts a string to a Commented.

func (Commented) IsValid

func (x Commented) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Commented) MarshalText

func (x Commented) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Commented) Name

func (x Commented) Name() string

Name is the attribute of Commented.

func (Commented) String

func (x Commented) String() string

String implements the Stringer interface.

func (*Commented) UnmarshalText

func (x *Commented) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (Commented) Val

func (x Commented) Val() int

Val is the attribute of Commented.

type ComplexCommented

type ComplexCommented int

ComplexCommented has some extra complicated parsing rules.

@ENUM{
	_, // Placeholder with a ','  in it. (for harder testing)

value1 // Commented value 1 value2, _ _ value3 // Commented value 3 }

const (

	// ComplexCommentedValue1 is a ComplexCommented of type value1.
	ComplexCommentedValue1 ComplexCommented // Commented value 1
	// ComplexCommentedValue2 is a ComplexCommented of type value2.
	ComplexCommentedValue2

	// ComplexCommentedValue3 is a ComplexCommented of type value3.
	ComplexCommentedValue3 // Commented value 3
)

func ParseComplexCommented

func ParseComplexCommented(value string) (ComplexCommented, error)

ParseComplexCommented converts a string to a ComplexCommented.

func (ComplexCommented) IsValid

func (x ComplexCommented) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ComplexCommented) MarshalText

func (x ComplexCommented) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (ComplexCommented) Name

func (x ComplexCommented) Name() string

Name is the attribute of ComplexCommented.

func (ComplexCommented) String

func (x ComplexCommented) String() string

String implements the Stringer interface.

func (*ComplexCommented) UnmarshalText

func (x *ComplexCommented) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (ComplexCommented) Val

func (x ComplexCommented) Val() int

Val is the attribute of ComplexCommented.

type DiffBase

type DiffBase int

@EnumConfig(forcelower) @ENUM{

B3  = 03
B4  = 04
B5  = 5
B6  = 0b110
B7  = 0b111
B8  = 0x08
B9  = 0x09
B10 = 0x0B
B11 = 0x2B

}

const (
	// DiffBaseB3 is a DiffBase of type b3.
	DiffBaseB3 DiffBase = 3
	// DiffBaseB4 is a DiffBase of type b4.
	DiffBaseB4 DiffBase = 4
	// DiffBaseB5 is a DiffBase of type b5.
	DiffBaseB5 DiffBase = 5
	// DiffBaseB6 is a DiffBase of type b6.
	DiffBaseB6 DiffBase = 6
	// DiffBaseB7 is a DiffBase of type b7.
	DiffBaseB7 DiffBase = 7
	// DiffBaseB8 is a DiffBase of type b8.
	DiffBaseB8 DiffBase = 8
	// DiffBaseB9 is a DiffBase of type b9.
	DiffBaseB9 DiffBase = 9
	// DiffBaseB10 is a DiffBase of type b10.
	DiffBaseB10 DiffBase = 11
	// DiffBaseB11 is a DiffBase of type b11.
	DiffBaseB11 DiffBase = 43
)

func ParseDiffBase

func ParseDiffBase(value string) (DiffBase, error)

ParseDiffBase converts a string to a DiffBase.

func (DiffBase) IsValid

func (x DiffBase) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (DiffBase) Name

func (x DiffBase) Name() string

Name is the attribute of DiffBase.

func (DiffBase) String

func (x DiffBase) String() string

String implements the Stringer interface.

func (DiffBase) Val

func (x DiffBase) Val() int

Val is the attribute of DiffBase.

type Enum32bit

type Enum32bit uint32

@EnumConfig(values) @ENUM{

Unkno = 0 E2P15 = 32768 E2P16 = 65536 E2P17 = 131072 E2P18 = 262144 E2P19 = 524288 E2P20 = 1048576 E2P21 = 2097152 E2P22 = 33554432 E2P23 = 67108864 E2P28 = 536870912 E2P30 = 1073741824

}

const (
	// Enum32bitUnkno is an Enum32bit of type Unkno.
	Enum32bitUnkno Enum32bit = 0
	// Enum32bitE2P15 is an Enum32bit of type E2P15.
	Enum32bitE2P15 Enum32bit = 32768
	// Enum32bitE2P16 is an Enum32bit of type E2P16.
	Enum32bitE2P16 Enum32bit = 65536
	// Enum32bitE2P17 is an Enum32bit of type E2P17.
	Enum32bitE2P17 Enum32bit = 131072
	// Enum32bitE2P18 is an Enum32bit of type E2P18.
	Enum32bitE2P18 Enum32bit = 262144
	// Enum32bitE2P19 is an Enum32bit of type E2P19.
	Enum32bitE2P19 Enum32bit = 524288
	// Enum32bitE2P20 is an Enum32bit of type E2P20.
	Enum32bitE2P20 Enum32bit = 1048576
	// Enum32bitE2P21 is an Enum32bit of type E2P21.
	Enum32bitE2P21 Enum32bit = 2097152
	// Enum32bitE2P22 is an Enum32bit of type E2P22.
	Enum32bitE2P22 Enum32bit = 33554432
	// Enum32bitE2P23 is an Enum32bit of type E2P23.
	Enum32bitE2P23 Enum32bit = 67108864
	// Enum32bitE2P28 is an Enum32bit of type E2P28.
	Enum32bitE2P28 Enum32bit = 536870912
	// Enum32bitE2P30 is an Enum32bit of type E2P30.
	Enum32bitE2P30 Enum32bit = 1073741824
)

func Enum32bitValues

func Enum32bitValues() []Enum32bit

Enum32bitValues returns a list of the values of Enum32bit

func ParseEnum32bit

func ParseEnum32bit(value string) (Enum32bit, error)

ParseEnum32bit converts a string to an Enum32bit.

func (Enum32bit) IsValid

func (x Enum32bit) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Enum32bit) Name

func (x Enum32bit) Name() string

Name is the attribute of Enum32bit.

func (Enum32bit) String

func (x Enum32bit) String() string

String implements the Stringer interface.

func (Enum32bit) Val

func (x Enum32bit) Val() uint32

Val is the attribute of Enum32bit.

type Enum64bit

type Enum64bit uint64

@EnumConfig(values) @ENUM{ Unkno = 0 E2P15 = 32768 E2P16 = 65536 E2P17 = 131072 E2P18 = 262144 E2P19 = 524288 E2P20 = 1048576 E2P21 = 2097152 E2P22 = 33554432 E2P23 = 67108864 E2P28 = 536870912 E2P30 = 1073741824 E2P31 = 2147483648 E2P32 = 4294967296 E2P33 = 8454967296 E2P63 = 18446744073709551615 }

const (
	// Enum64bitUnkno is an Enum64bit of type Unkno.
	Enum64bitUnkno Enum64bit = 0
	// Enum64bitE2P15 is an Enum64bit of type E2P15.
	Enum64bitE2P15 Enum64bit = 32768
	// Enum64bitE2P16 is an Enum64bit of type E2P16.
	Enum64bitE2P16 Enum64bit = 65536
	// Enum64bitE2P17 is an Enum64bit of type E2P17.
	Enum64bitE2P17 Enum64bit = 131072
	// Enum64bitE2P18 is an Enum64bit of type E2P18.
	Enum64bitE2P18 Enum64bit = 262144
	// Enum64bitE2P19 is an Enum64bit of type E2P19.
	Enum64bitE2P19 Enum64bit = 524288
	// Enum64bitE2P20 is an Enum64bit of type E2P20.
	Enum64bitE2P20 Enum64bit = 1048576
	// Enum64bitE2P21 is an Enum64bit of type E2P21.
	Enum64bitE2P21 Enum64bit = 2097152
	// Enum64bitE2P22 is an Enum64bit of type E2P22.
	Enum64bitE2P22 Enum64bit = 33554432
	// Enum64bitE2P23 is an Enum64bit of type E2P23.
	Enum64bitE2P23 Enum64bit = 67108864
	// Enum64bitE2P28 is an Enum64bit of type E2P28.
	Enum64bitE2P28 Enum64bit = 536870912
	// Enum64bitE2P30 is an Enum64bit of type E2P30.
	Enum64bitE2P30 Enum64bit = 1073741824
	// Enum64bitE2P31 is an Enum64bit of type E2P31.
	Enum64bitE2P31 Enum64bit = 2147483648
	// Enum64bitE2P32 is an Enum64bit of type E2P32.
	Enum64bitE2P32 Enum64bit = 4294967296
	// Enum64bitE2P33 is an Enum64bit of type E2P33.
	Enum64bitE2P33 Enum64bit = 8454967296
	// Enum64bitE2P63 is an Enum64bit of type E2P63.
	Enum64bitE2P63 Enum64bit = 18446744073709551615
)

func Enum64bitValues

func Enum64bitValues() []Enum64bit

Enum64bitValues returns a list of the values of Enum64bit

func ParseEnum64bit

func ParseEnum64bit(value string) (Enum64bit, error)

ParseEnum64bit converts a string to an Enum64bit.

func (Enum64bit) IsValid

func (x Enum64bit) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Enum64bit) Name

func (x Enum64bit) Name() string

Name is the attribute of Enum64bit.

func (Enum64bit) String

func (x Enum64bit) String() string

String implements the Stringer interface.

func (Enum64bit) Val

func (x Enum64bit) Val() uint64

Val is the attribute of Enum64bit.

type ForceLowerType

type ForceLowerType int

@EnumConfig(forcelower) @ENUM{ DataSwap, BootNode, }

const (
	// ForceLowerTypeDataSwap is a ForceLowerType of type dataswap.
	ForceLowerTypeDataSwap ForceLowerType = iota
	// ForceLowerTypeBootNode is a ForceLowerType of type bootnode.
	ForceLowerTypeBootNode
)

func ParseForceLowerType

func ParseForceLowerType(value string) (ForceLowerType, error)

ParseForceLowerType converts a string to a ForceLowerType.

func (ForceLowerType) IsValid

func (x ForceLowerType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ForceLowerType) Name

func (x ForceLowerType) Name() string

Name is the attribute of ForceLowerType.

func (ForceLowerType) String

func (x ForceLowerType) String() string

String implements the Stringer interface.

func (ForceLowerType) Val

func (x ForceLowerType) Val() int

Val is the attribute of ForceLowerType.

type ForceUpperType

type ForceUpperType int

@EnumConfig(forceupper) @ENUM{ DataSwap, BootNode, }

const (
	// ForceUpperTypeDataSwap is a ForceUpperType of type DATASWAP.
	ForceUpperTypeDataSwap ForceUpperType = iota
	// ForceUpperTypeBootNode is a ForceUpperType of type BOOTNODE.
	ForceUpperTypeBootNode
)

func ParseForceUpperType

func ParseForceUpperType(value string) (ForceUpperType, error)

ParseForceUpperType converts a string to a ForceUpperType.

func (ForceUpperType) IsValid

func (x ForceUpperType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ForceUpperType) Name

func (x ForceUpperType) Name() string

Name is the attribute of ForceUpperType.

func (ForceUpperType) String

func (x ForceUpperType) String() string

String implements the Stringer interface.

func (ForceUpperType) Val

func (x ForceUpperType) Val() int

Val is the attribute of ForceUpperType.

type IntShop

type IntShop int

@EnumConfig(marshal, prefix="AcmeInt_", noprefix, nocamel, names) Shops @ENUM{ SOME_PLACE_AWESOME, SomewhereElse, LocationUnknown }

const (
	// AcmeInt_SOME_PLACE_AWESOME is an IntShop of type SOME_PLACE_AWESOME.
	AcmeInt_SOME_PLACE_AWESOME IntShop = iota
	// AcmeInt_SomewhereElse is an IntShop of type SomewhereElse.
	AcmeInt_SomewhereElse
	// AcmeInt_LocationUnknown is an IntShop of type LocationUnknown.
	AcmeInt_LocationUnknown
)

func ParseIntShop

func ParseIntShop(value string) (IntShop, error)

ParseIntShop converts a string to an IntShop.

func (IntShop) IsValid

func (x IntShop) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (IntShop) MarshalText

func (x IntShop) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (IntShop) Name

func (x IntShop) Name() string

Name is the attribute of IntShop.

func (IntShop) String

func (x IntShop) String() string

String implements the Stringer interface.

func (*IntShop) UnmarshalText

func (x *IntShop) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (IntShop) Val

func (x IntShop) Val() int

Val is the attribute of IntShop.

type Make

type Make int32

Make x @ENUM{Toyota,_,Chevy,_,Ford,_,Tesla,_,Hyundai,_,Nissan,_,Jaguar,_,Audi,_,BMW,_,Mercedes_Benz,_,Volkswagon}

const (
	// MakeToyota is a Make of type Toyota.
	MakeToyota Make = iota

	// MakeChevy is a Make of type Chevy.
	MakeChevy

	// MakeFord is a Make of type Ford.
	MakeFord

	// MakeTesla is a Make of type Tesla.
	MakeTesla

	// MakeHyundai is a Make of type Hyundai.
	MakeHyundai

	// MakeNissan is a Make of type Nissan.
	MakeNissan

	// MakeJaguar is a Make of type Jaguar.
	MakeJaguar

	// MakeAudi is a Make of type Audi.
	MakeAudi

	// MakeBmw is a Make of type BMW.
	MakeBmw

	// MakeMercedesBenz is a Make of type Mercedes_Benz.
	MakeMercedesBenz

	// MakeVolkswagon is a Make of type Volkswagon.
	MakeVolkswagon
)

func MakeValues

func MakeValues() []Make

MakeValues returns a list of the values of Make

func ParseMake

func ParseMake(value string) (Make, error)

ParseMake converts a string to a Make.

func (Make) Get

func (x Make) Get() any

Get implements the Golang flag.Getter interface func.

func (Make) IsValid

func (x Make) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Make) MarshalText

func (x Make) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Make) Name

func (x Make) Name() string

Name is the attribute of Make.

func (*Make) Set

func (x *Make) Set(value string) error

Set implements the Golang flag.Value interface func.

func (Make) String

func (x Make) String() string

String implements the Stringer interface.

func (*Make) UnmarshalText

func (x *Make) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (Make) Val

func (x Make) Val() int32

Val is the attribute of Make.

type NoZeros

type NoZeros int32

Make x @ENUM{start=20,middle,end,ps,pps,ppps}

const (
	// NoZerosStart is a NoZeros of type start.
	NoZerosStart NoZeros = 20
	// NoZerosMiddle is a NoZeros of type middle.
	NoZerosMiddle NoZeros = 21
	// NoZerosEnd is a NoZeros of type end.
	NoZerosEnd NoZeros = 22
	// NoZerosPs is a NoZeros of type ps.
	NoZerosPs NoZeros = 23
	// NoZerosPps is a NoZeros of type pps.
	NoZerosPps NoZeros = 24
	// NoZerosPpps is a NoZeros of type ppps.
	NoZerosPpps NoZeros = 25
)

func NoZerosValues

func NoZerosValues() []NoZeros

NoZerosValues returns a list of the values of NoZeros

func ParseNoZeros

func ParseNoZeros(value string) (NoZeros, error)

ParseNoZeros converts a string to a NoZeros.

func (NoZeros) Get

func (x NoZeros) Get() any

Get implements the Golang flag.Getter interface func.

func (NoZeros) IsValid

func (x NoZeros) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (NoZeros) MarshalText

func (x NoZeros) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (NoZeros) Name

func (x NoZeros) Name() string

Name is the attribute of NoZeros.

func (*NoZeros) Set

func (x *NoZeros) Set(value string) error

Set implements the Golang flag.Value interface func.

func (NoZeros) String

func (x NoZeros) String() string

String implements the Stringer interface.

func (*NoZeros) UnmarshalText

func (x *NoZeros) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (NoZeros) Val

func (x NoZeros) Val() int32

Val is the attribute of NoZeros.

type Product

type Product int32

@EnumConfig(prefix="AcmeInc") Products of AcmeInc @ENUM{ Anvil, Dynamite, Glue }

const (
	// AcmeIncProductAnvil is a Product of type Anvil.
	AcmeIncProductAnvil Product = iota
	// AcmeIncProductDynamite is a Product of type Dynamite.
	AcmeIncProductDynamite
	// AcmeIncProductGlue is a Product of type Glue.
	AcmeIncProductGlue
)

func ParseProduct

func ParseProduct(value string) (Product, error)

ParseProduct converts a string to a Product.

func (Product) IsValid

func (x Product) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Product) Name

func (x Product) Name() string

Name is the attribute of Product.

func (Product) String

func (x Product) String() string

String implements the Stringer interface.

func (Product) Val

func (x Product) Val() int32

Val is the attribute of Product.

type ProjectStatus

type ProjectStatus int

@EnumConfig(sql, ptr, marshal, nocomments) @ENUM{pending, inWork, completed, rejected}

const (
	ProjectStatusPending ProjectStatus = iota
	ProjectStatusInWork
	ProjectStatusCompleted
	ProjectStatusRejected
)

func ParseProjectStatus

func ParseProjectStatus(value string) (ProjectStatus, error)

ParseProjectStatus converts a string to a ProjectStatus.

func (ProjectStatus) IsValid

func (x ProjectStatus) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ProjectStatus) MarshalText

func (x ProjectStatus) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (ProjectStatus) Name

func (x ProjectStatus) Name() string

Name is the attribute of ProjectStatus.

func (ProjectStatus) Ptr

func (x ProjectStatus) Ptr() *ProjectStatus

func (*ProjectStatus) Scan

func (x *ProjectStatus) Scan(value any) (err error)

Scan implements the Scanner interface.

func (ProjectStatus) String

func (x ProjectStatus) String() string

String implements the Stringer interface.

func (*ProjectStatus) UnmarshalText

func (x *ProjectStatus) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (ProjectStatus) Val

func (x ProjectStatus) Val() int

Val is the attribute of ProjectStatus.

func (ProjectStatus) Value

func (x ProjectStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type ProjectStrStatus

type ProjectStrStatus string

@EnumConfig(sql, ptr, marshal, nocomments) @ENUM{pending, inWork, completed, rejected}

const (
	ProjectStrStatusPending   ProjectStrStatus = "pending"
	ProjectStrStatusInWork    ProjectStrStatus = "inWork"
	ProjectStrStatusCompleted ProjectStrStatus = "completed"
	ProjectStrStatusRejected  ProjectStrStatus = "rejected"
)

func ParseProjectStrStatus

func ParseProjectStrStatus(value string) (ProjectStrStatus, error)

ParseProjectStrStatus converts a string to a ProjectStrStatus.

func (ProjectStrStatus) IsValid

func (x ProjectStrStatus) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ProjectStrStatus) MarshalText

func (x ProjectStrStatus) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (ProjectStrStatus) Name

func (x ProjectStrStatus) Name() string

Name is the attribute of ProjectStrStatus.

func (ProjectStrStatus) Ptr

func (*ProjectStrStatus) Scan

func (x *ProjectStrStatus) Scan(value any) (err error)

Scan implements the Scanner interface.

func (ProjectStrStatus) String

func (x ProjectStrStatus) String() string

String implements the Stringer interface.

func (*ProjectStrStatus) UnmarshalText

func (x *ProjectStrStatus) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (ProjectStrStatus) Val

func (x ProjectStrStatus) Val() string

Val is the attribute of ProjectStrStatus.

func (ProjectStrStatus) Value

func (x ProjectStrStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type ProjectStrStatusIntCode

type ProjectStrStatusIntCode string

@EnumConfig(sql, ptr, marshal, nocomments, sqlName=dbCode)

@ENUM(dbCode int) {
	pending(0)
	inWork(10)
	completed(20)
	rejected(30)
}
const (
	ProjectStrStatusIntCodePending   ProjectStrStatusIntCode = "pending"
	ProjectStrStatusIntCodeInWork    ProjectStrStatusIntCode = "inWork"
	ProjectStrStatusIntCodeCompleted ProjectStrStatusIntCode = "completed"
	ProjectStrStatusIntCodeRejected  ProjectStrStatusIntCode = "rejected"
)

func ParseProjectStrStatusIntCode

func ParseProjectStrStatusIntCode(value string) (ProjectStrStatusIntCode, error)

ParseProjectStrStatusIntCode converts a string to a ProjectStrStatusIntCode.

func (ProjectStrStatusIntCode) DbCode

func (x ProjectStrStatusIntCode) DbCode() int

DbCode is the attribute of ProjectStrStatusIntCode.

func (ProjectStrStatusIntCode) IsValid

func (x ProjectStrStatusIntCode) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ProjectStrStatusIntCode) MarshalText

func (x ProjectStrStatusIntCode) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (ProjectStrStatusIntCode) Name

Name is the attribute of ProjectStrStatusIntCode.

func (ProjectStrStatusIntCode) Ptr

func (*ProjectStrStatusIntCode) Scan

func (x *ProjectStrStatusIntCode) Scan(value any) (err error)

Scan implements the Scanner interface.

func (ProjectStrStatusIntCode) String

func (x ProjectStrStatusIntCode) String() string

String implements the Stringer interface.

func (*ProjectStrStatusIntCode) UnmarshalText

func (x *ProjectStrStatusIntCode) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (ProjectStrStatusIntCode) Val

Val is the attribute of ProjectStrStatusIntCode.

func (ProjectStrStatusIntCode) Value

Value implements the driver Valuer interface.

type Shop

type Shop string

@EnumConfig(marshal, prefix="AcmeInc_", noprefix, nocamel, names) Shops @ENUM{ SOME_PLACE_AWESOME, SomewhereElse, LocationUnknown }

const (
	// AcmeInc_SOME_PLACE_AWESOME is a Shop of type SOME_PLACE_AWESOME.
	AcmeInc_SOME_PLACE_AWESOME Shop = "SOME_PLACE_AWESOME"
	// AcmeInc_SomewhereElse is a Shop of type SomewhereElse.
	AcmeInc_SomewhereElse Shop = "SomewhereElse"
	// AcmeInc_LocationUnknown is a Shop of type LocationUnknown.
	AcmeInc_LocationUnknown Shop = "LocationUnknown"
)

func ParseShop

func ParseShop(value string) (Shop, error)

ParseShop converts a string to a Shop.

func (Shop) IsValid

func (x Shop) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Shop) MarshalText

func (x Shop) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Shop) Name

func (x Shop) Name() string

Name is the attribute of Shop.

func (Shop) String

func (x Shop) String() string

String implements the Stringer interface.

func (*Shop) UnmarshalText

func (x *Shop) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (Shop) Val

func (x Shop) Val() string

Val is the attribute of Shop.

type Status

type Status int

@ENUM{ Unknown = -1, Good, Bad }.

const (
	// StatusUnknown is a Status of type Unknown.
	StatusUnknown Status = -1
	// StatusGood is a Status of type Good.
	StatusGood Status = 0
	// StatusBad is a Status of type Bad.
	StatusBad Status = 1
)

func ParseStatus

func ParseStatus(value string) (Status, error)

ParseStatus converts a string to a Status.

func (Status) IsValid

func (x Status) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Status) Name

func (x Status) Name() string

Name is the attribute of Status.

func (Status) String

func (x Status) String() string

String implements the Stringer interface.

func (Status) Val

func (x Status) Val() int

Val is the attribute of Status.

type Suffix

type Suffix string

Suffix @ENUM{gen}

const (
	// SuffixGen is a Suffix of type gen.
	SuffixGen Suffix = "gen"
)

func ParseSuffix

func ParseSuffix(value string) (Suffix, error)

ParseSuffix converts a string to a Suffix.

func (Suffix) IsValid

func (x Suffix) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Suffix) Name

func (x Suffix) Name() string

Name is the attribute of Suffix.

func (Suffix) String

func (x Suffix) String() string

String implements the Stringer interface.

func (Suffix) Val

func (x Suffix) Val() string

Val is the attribute of Suffix.

type X

type X struct{}

X is doc'ed

Jump to

Keyboard shortcuts

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