converter

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConverterArrays = []Converter{
	reflect.Bool:    convertBool,
	reflect.Int:     convertInt,
	reflect.Int8:    convertInt8,
	reflect.Int16:   convertInt16,
	reflect.Int32:   convertInt32,
	reflect.Int64:   convertInt64,
	reflect.Uint:    convertUint,
	reflect.Uint8:   convertUint8,
	reflect.Uint16:  convertUint16,
	reflect.Uint32:  convertUint32,
	reflect.Uint64:  convertUint64,
	reflect.Float32: convertFloat32,
	reflect.Float64: convertFloat64,
	reflect.String:  convertString,
}

Functions

func AnyConvert

func AnyConvert[T any](v any) T

func ConvertInt64

func ConvertInt64(v interface{}) int64

func SetFieldByString

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

func SetStructFieldByString

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

func String

func String(value reflect.Value) string

func StringConvert

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

Types

type Converter

type Converter func(string) any

Jump to

Keyboard shortcuts

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