enumeration

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 1 Imported by: 11

README

Enumeration

GoDoc Widget Build Status codecov Go Report Card

Enumeration in go

// declare named type base on int or uint
type Protocol int

// declare const as the declared type
// and with prefix upper-snake-cased type name
// link with UNKNOWN by one lodash _ as the zero value
// link with ENUM VALUE by two lodash __ as enum values
// comments after enum values will be the label of matched enum value
const (
	PROTOCOL_UNKNOWN Protocol = iota
	PROTOCOL__HTTP    // http
	PROTOCOL__HTTPS   // https
	PROTOCOL__TCP
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanEnum

func ScanEnum(src interface{}, offset int) (int, error)

func ScanIntEnumStringer added in v1.3.0

func ScanIntEnumStringer(src interface{}, offset int) (int, error)

Types

type DriverValueOffset added in v1.3.0

type DriverValueOffset interface {
	Offset() int
}

sql value of enum maybe have offset from value of enum in go

type Enum

type Enum = IntStringerEnum

Deprecated use IntStringerEnum instead

type EnumDriverValueOffset

type EnumDriverValueOffset = DriverValueOffset

Deprecated use DriverValueOffset instead

type IntStringerEnum added in v1.3.0

type IntStringerEnum interface {
	TypeName() string
	Int() int
	String() string
	Label() string
	ConstValues() []IntStringerEnum
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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