enumx

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 7 Imported by: 5 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseErrorFor

func ParseErrorFor[E _Int](from string) error

func Scan

func Scan(src any, offset int) (int, error)

Types

type CanBeEnum added in v0.4.8

type CanBeEnum interface {
	EnumValues() []any
}

type DriverValueOffset

type DriverValueOffset interface {
	Offset() int
}

DriverValueOffset as an adaptor between code and database

type Enum

type Enum[E _Int] interface {
	// Values presents enum value list
	Values() []E
	// String returns enum key as string identifier
	String() string
	// Text returns enum description for presents as EnumLabel
	Text() string
	// IsZero check if v is valid
	IsZero() bool

	encoding.TextMarshaler
	encoding.TextUnmarshaler

	driver.Valuer
	sql.Scanner
}

Enum defines an enumeration interface for an int<->string type implements encoding.TextMarshaler/TextUnmarshaler for interaction in networking implements driver.Valuer/sql.Scanner for interaction with database

type ParseError

type ParseError[E _Int] struct {
	// contains filtered or unexported fields
}

func (*ParseError[E]) Error

func (e *ParseError[E]) Error() string

func (*ParseError[E]) Is

func (e *ParseError[E]) Is(err error) bool

Jump to

Keyboard shortcuts

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