cast

package
v1.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package cast 提供了很多类型之间相互转换的函数。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBool

func ToBool(i interface{}) bool

ToBool casts an interface{} to a bool.

func ToBoolE

func ToBoolE(i interface{}) (bool, error)

ToBoolE casts an interface{} to a bool.

func ToDuration

func ToDuration(i interface{}) time.Duration

ToDuration casts an interface{} to a time.Duration.

func ToDurationE

func ToDurationE(i interface{}) (time.Duration, error)

ToDurationE casts an interface{} to a time.Duration.

func ToFloat64

func ToFloat64(i interface{}) float64

ToFloat64 casts an interface{} to a float64.

func ToFloat64E

func ToFloat64E(i interface{}) (float64, error)

ToFloat64E casts an interface{} to a float64.

func ToInt

func ToInt(i interface{}) int

ToInt casts an interface{} to an int.

func ToInt64

func ToInt64(i interface{}) int64

ToInt64 casts an interface{} to an int64.

func ToInt64E

func ToInt64E(i interface{}) (int64, error)

ToInt64E casts an interface{} to an int64.

func ToString

func ToString(i interface{}) string

ToString casts an interface{} to a string.

func ToStringE

func ToStringE(i interface{}) (string, error)

ToStringE casts an interface{} to a string.

func ToTime

func ToTime(i interface{}) time.Time

ToTime casts an interface{} to a time.Time.

func ToTimeE

func ToTimeE(i interface{}) (time.Time, error)

ToTimeE casts an interface{} to a time.Time.

func ToUint64

func ToUint64(i interface{}) uint64

ToUint64 casts an interface{} to a uint64.

func ToUint64E

func ToUint64E(i interface{}) (uint64, error)

ToUint64E casts an interface{} to a uint64.

Types

This section is empty.

Jump to

Keyboard shortcuts

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