enumx

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 7 Imported by: 1

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 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
	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