Documentation
¶
Index ¶
- Variables
- func BitsMerge[T any](ss []string) uint32
- func BitsSplit[T any](d uint32) []string
- func BitsTransfer[T any](vs []string) []uint32
- func Get[T any, P enumProperty](v P) (o *T)
- func Is[T any, P enumProperty](v P) bool
- func List[T any]() []T
- func New[T any](i IntegerType, s ...string) T
- func ObjectName[T any]() string
- func StringDict[S any, D any](str string) *D
- func Strings[T any](p PropertyKind) string
- func ToString[T any, V enumInteger](i V, defaultValue ...string) string
- func Values(name string) []string
- type IntegerType
- type Object
- type PropertyKind
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Integer = New[PropertyKind](1, "integer") String = New[PropertyKind](2, "string") Display = New[PropertyKind](3, "display") )
Functions ¶
func BitsTransfer ¶
func ObjectName ¶
func StringDict ¶
StringDict 从S到D的枚举映射查询,当前映射的关键是枚举属性String
func Strings ¶
func Strings[T any](p PropertyKind) string
Types ¶
type IntegerType ¶
type IntegerType int
IntegerType 整形数据 int,为什么这么大,因为有时候,项目会使用位计算 int8很明显不够用,所以使用int, 一般int是32位
func ToInteger ¶
func ToInteger[T any](s string, defaultValue ...IntegerType) IntegerType
ToInteger find the uint8 value of 's' panic if not the valid enum type, return the defaultValue[0] if not find
func (IntegerType) Int ¶
func (ip IntegerType) Int() int
func (IntegerType) Int8 ¶
func (ip IntegerType) Int8() int8
func (IntegerType) Int16 ¶
func (ip IntegerType) Int16() int16
func (IntegerType) Int32 ¶
func (ip IntegerType) Int32() int32
func (IntegerType) Uint ¶
func (ip IntegerType) Uint() uint
func (IntegerType) Uint8 ¶
func (ip IntegerType) Uint8() uint8
func (IntegerType) Uint16 ¶
func (ip IntegerType) Uint16() uint16
func (IntegerType) Uint32 ¶
func (ip IntegerType) Uint32() uint32
type Object ¶
type Object struct {
Integer *IntegerType // 枚举整形值
String string // 枚举的字符串表示值,英文
Display string // 枚举的前端展示值,中文
// contains filtered or unexported fields
}
Object one enum object
type PropertyKind ¶
type PropertyKind Object
Click to show internal directories.
Click to hide internal directories.