examples

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ColorEnumRed Represents the color of fire and blood, associated with energy and passion.
	ColorEnumRed _ColorEnum = "Red"
	// ColorEnumGreen Associated with nature, growth, and harmony.
	ColorEnumGreen _ColorEnum = "Green"
	// ColorEnumBlue Often linked to the sky and the sea, symbolizing calm and tranquility.
	ColorEnumBlue _ColorEnum = "Blue"
	// ColorEnumCyan A blend of blue and green, known for its soothing properties.
	ColorEnumCyan _ColorEnum = "Cyan"
	// ColorEnumMagenta A vibrant and intense color often associated with creativity.
	ColorEnumMagenta _ColorEnum = "Magenta"
	// ColorEnumYellow Represents sunshine and happiness, associated with positivity.
	ColorEnumYellow _ColorEnum = "Yellow"
	// ColorEnumWhite Symbolizes purity and cleanliness.
	ColorEnumWhite _ColorEnum = "White"
	// ColorEnumBlack Represents mystery, sophistication, and formality.
	ColorEnumBlack _ColorEnum = "Black"
)

Variables

This section is empty.

Functions

func ColorEnumStrings

func ColorEnumStrings() []string

ColorEnumStrings returns a slice of all enum values as strings. This could be useful for validation with something like slices.Contains or quickly seeing all values of an enum. Each string matches the index of ColorEnumValues.

Types

type ColorEnum

type ColorEnum interface {
	fmt.Stringer
	encoding.TextMarshaler
	// contains filtered or unexported methods
}

ColorEnum is a true enum, i.e. using this as a parameter in a function declaration requires the use of one of the constants defined in this package.

func ColorEnumValues

func ColorEnumValues() []ColorEnum

ColorEnumValues returns a slice of values of the ColorEnum enum. Each enum value matches the index of ColorEnumStrings.

func ToColorEnum

func ToColorEnum(s string) (ColorEnum, error)

ToColorEnum retrieves an enum value from the constants defined in this package. It tries it's best to find s in the enum by using the original-case, uppercase and lowercase.

type ColorEnumUnmarshaler

type ColorEnumUnmarshaler string

func (ColorEnumUnmarshaler) Extract

func (x ColorEnumUnmarshaler) Extract() ColorEnum

func (*ColorEnumUnmarshaler) UnmarshalText

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

type InvalidColorEnumError

type InvalidColorEnumError struct {
	// contains filtered or unexported fields
}

InvalidColorEnumError is returned by ToColorEnum if the passed in string isn't one of the enum values.

func (InvalidColorEnumError) Error

func (e InvalidColorEnumError) Error() string

Error exposes the invalid string used and shows all the possible values.

func (InvalidColorEnumError) Is

func (e InvalidColorEnumError) Is(err error) bool

Is tells you if target can be unwrapped to be an InvalidColorEnumError.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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