converter

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArrayBool    = reflect.Bool + array
	ArrayInt     = reflect.Int + array
	ArrayInt8    = reflect.Int8 + array
	ArrayInt16   = reflect.Int16 + array
	ArrayInt32   = reflect.Int32 + array
	ArrayInt64   = reflect.Int64 + array
	ArrayUint    = reflect.Uint + array
	ArrayUint8   = reflect.Uint8 + array
	ArrayUint16  = reflect.Uint16 + array
	ArrayUint32  = reflect.Uint32 + array
	ArrayUint64  = reflect.Uint64 + array
	ArrayFloat32 = reflect.Float32 + array
	ArrayFloat64 = reflect.Float64 + array
	ArrayString  = reflect.String + array
)
View Source
const (
	SliceBool    = reflect.Bool + slice
	SliceInt     = reflect.Int + slice
	SliceInt8    = reflect.Int8 + slice
	SliceInt16   = reflect.Int16 + slice
	SliceInt32   = reflect.Int32 + slice
	SliceInt64   = reflect.Int64 + slice
	SliceUint    = reflect.Uint + slice
	SliceUint8   = reflect.Uint8 + slice
	SliceUint16  = reflect.Uint16 + slice
	SliceUint32  = reflect.Uint32 + slice
	SliceUint64  = reflect.Uint64 + slice
	SliceFloat32 = reflect.Float32 + slice
	SliceFloat64 = reflect.Float64 + slice
	SliceString  = reflect.String + slice
)

Variables

View Source
var StringConverterArrays = []StringConverterE{
	reflect.Bool:    stringConvertBool,
	reflect.Int:     stringConvertInt,
	reflect.Int8:    stringConvertInt8,
	reflect.Int16:   stringConvertInt16,
	reflect.Int32:   stringConvertInt32,
	reflect.Int64:   stringConvertInt64,
	reflect.Uint:    stringConvertUint,
	reflect.Uint8:   stringConvertUint8,
	reflect.Uint16:  stringConvertUint16,
	reflect.Uint32:  stringConvertUint32,
	reflect.Uint64:  stringConvertUint64,
	reflect.Float32: stringConvertFloat32,
	reflect.Float64: stringConvertFloat64,
	reflect.String:  stringConvertString,
}

Deprecated: unsupported slices array map

Functions

func CastInt64 added in v1.5.11

func CastInt64(v any) int64

func SetFieldByString

func SetFieldByString(dst any, field, value string) error

func SetValueByString added in v1.4.0

func SetValueByString(field reflect.Value, value string) error

func String

func String(value reflect.Value) string

func StringConvert

func StringConvert(kind reflect.Kind, value string) (any, error)

func StringConvertBasicFor added in v1.5.11

func StringConvertBasicFor[T any](value string) (T, error)

func StringConvertFor added in v1.2.8

func StringConvertFor[T any](value string) (T, error)

func StringFor added in v1.2.8

func StringFor[T any](t T) string

Types

type StringConverter added in v1.4.0

type StringConverter func(string) any

type StringConverterE added in v1.4.0

type StringConverterE func(string) (any, error)

func (StringConverterE) Converter added in v1.4.0

func (c StringConverterE) Converter() StringConverter

Jump to

Keyboard shortcuts

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