Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseErrorFor ¶
ParseErrorFor new parsing error for the specific enum type E.
Types ¶
type CanBeEnum ¶ added in v0.4.8
type CanBeEnum interface {
EnumValues() []any
}
CanBeEnum defines an interface for types that can provide value list of their enumeration values.
type DriverValueOffset ¶
type DriverValueOffset interface {
Offset() int
}
DriverValueOffset acts as an adaptor between code and database. It provides an offset to adjust the enumeration's value during converting
type EncodingArshaler ¶ added in v0.5.5
type EncodingArshaler interface {
encoding.TextMarshaler
encoding.TextUnmarshaler
}
type Enum ¶
type Enum[E _U] interface {
// Values presents enum value list
Values() []E
// String returns the string identifier (key) of the enumeration.
String() string
// Text returns enum description for presents as EnumLabel
Text() string
// IsZero check if v is valid
IsZero() bool
EncodingArshaler
DatabaseValuer
}
Enum defines an enumeration interface for mapping between `int` and `string`. It implements encoding.TextMarshaler encoding.TextUnmarshaler for network interaction, and driver.Valuer sql.Scanner for database interaction.
Click to show internal directories.
Click to hide internal directories.