iconv

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MulanPSL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// StructTagPriority defines the default priority tags for Map*/Struct* functions.
	// Note, the "gconv", "param", "params" tags are used by old version of package.
	// It is strongly recommended using short tag "c" or "p" instead in the future.
	StructTagPriority = []string{"gconv", "param", "params", "c", "p", "json"}
)

Functions

func Bool

func Bool(any interface{}) bool

Bool converts `any` to bool. It returns false if `any` is: false, "", 0, "false", "off", "no", empty slice/map.

func Byte

func Byte(any interface{}) byte

Byte converts `any` to byte.

func Bytes

func Bytes(any interface{}) []byte

Bytes converts `any` to []byte.

func Float32

func Float32(any interface{}) float32

Float32 converts `any` to float32.

func Float64

func Float64(any interface{}) float64

Float64 converts `any` to float64.

func Int

func Int(any interface{}) int

Int converts `any` to int.

func Int16

func Int16(any interface{}) int16

Int16 converts `any` to int16.

func Int32

func Int32(any interface{}) int32

Int32 converts `any` to int32.

func Int64

func Int64(any interface{}) int64

Int64 converts `any` to int64.

func Int8

func Int8(any interface{}) int8

Int8 converts `any` to int8.

func String

func String(any interface{}) string

String converts `any` to string. It's most commonly used converting function.

func Uint

func Uint(any interface{}) uint

Uint converts `any` to uint.

func Uint16

func Uint16(any interface{}) uint16

Uint16 converts `any` to uint16.

func Uint32

func Uint32(any interface{}) uint32

Uint32 converts `any` to uint32.

func Uint64

func Uint64(any interface{}) uint64

Uint64 converts `any` to uint64.

func Uint8

func Uint8(any interface{}) uint8

Uint8 converts `any` to uint8.

func UnsafeBytesToStr

func UnsafeBytesToStr(b []byte) string

UnsafeBytesToStr converts []byte to string without memory copy. Note that, if you completely sure you will never use `b` variable in the feature, you can use this unsafe function to implement type conversion in high performance.

func UnsafeStrToBytes

func UnsafeStrToBytes(s string) []byte

UnsafeStrToBytes converts string to []byte without memory copy. Note that, if you completely sure you will never use `s` variable in the feature, you can use this unsafe function to implement type conversion in high performance.

Types

This section is empty.

Jump to

Keyboard shortcuts

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