enums

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEnums

func GenerateEnums(pkgName string, suffix ...string) error

For all enumerated constants, generate enums that satisfy the Enummer interface

func ImplementsEnumer

func ImplementsEnumer(field reflect.StructField) bool

func QuoteEnums

func QuoteEnums(values []string) string

Surround each value with single quote and return a comma-seperated string

Types

type Enumer

type Enumer interface {
	sql.Scanner
	driver.Valuer
	ValidValues() []string
	DatabaseType() string
}

Enumer interface embeds sql.Scanner interface, database/driver.Valuer. Has 2 methods ValidValues()[]string to return valid enums and DatabaseType() that returns the sql data type.

Jump to

Keyboard shortcuts

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