convert

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBool

func ToBool(v any) bool

ToBool 将任意值转为 bool;失败返回 false。

func ToBoolE

func ToBoolE(v any) (bool, error)

ToBoolE 将任意值转为 bool。

func ToDuration

func ToDuration(v any) time.Duration

ToDuration 将任意值转为 time.Duration;失败返回 0。

func ToDurationE

func ToDurationE(v any) (time.Duration, error)

ToDurationE 将任意值转为 time.Duration。

func ToFloat64

func ToFloat64(v any) float64

ToFloat64 将任意值转为 float64;失败返回 0。

func ToFloat64E

func ToFloat64E(v any) (float64, error)

ToFloat64E 将任意值转为 float64。

func ToInt

func ToInt(v any) int

ToInt 将任意值转为 int;失败返回 0。

func ToInt64

func ToInt64(v any) int64

ToInt64 将任意值转为 int64;失败返回 0。

func ToInt64E

func ToInt64E(v any) (int64, error)

ToInt64E 将任意值转为 int64。

func ToIntE

func ToIntE(v any) (int, error)

ToIntE 将任意值转为 int。

func ToString

func ToString(v any) string

ToString 将任意值转为 string;失败返回空字符串。

func ToStringE

func ToStringE(v any) (string, error)

ToStringE 将任意值转为 string。

func ToStringMap

func ToStringMap(v any) map[string]any

ToStringMap 将任意值转为 map[string]any。

func ToStringMapString

func ToStringMapString(v any) map[string]string

ToStringMapString 将任意值转为 map[string]string。

func ToStringSlice

func ToStringSlice(v any) []string

ToStringSlice 将任意值转为 []string。

func ToTime

func ToTime(v any) time.Time

ToTime 将任意值转为 time.Time;失败返回零值。

func ToTimeE

func ToTimeE(v any) (time.Time, error)

ToTimeE 将任意值转为 time.Time。

func ToUint

func ToUint(v any) uint

ToUint 将任意值转为 uint;失败返回 0。

func ToUint64

func ToUint64(v any) uint64

ToUint64 将任意值转为 uint64;失败返回 0。

func ToUint64E

func ToUint64E(v any) (uint64, error)

ToUint64E 将任意值转为 uint64。

func ToUintE

func ToUintE(v any) (uint, error)

ToUintE 将任意值转为 uint。

Types

This section is empty.

Source Files

  • convert.go

Jump to

Keyboard shortcuts

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