utils

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

See https://github.com/dablelv/cyan/blob/master/conv/conv.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func If

func If[T any](trueCondition bool, v1, v2 T) T

func ToAny

func ToAny[T any](a any) T

ToAny converts one type to another type.

func ToAnyE

func ToAnyE[T any](a any) (T, error)

ToAnyE converts one type to another and returns an error if error occurred.

func ToBoolE

func ToBoolE(a any) (bool, error)

ToBoolE casts any type to a bool type.

func ToDurationE

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

ToDurationE casts any type to time.Duration type.

func ToFloat32E

func ToFloat32E(i any) (float32, error)

ToFloat32E casts any type to a float32 type.

func ToFloat64E

func ToFloat64E(i any) (float64, error)

ToFloat64E casts any type to a float64 type.

func ToInt16E

func ToInt16E(i any) (int16, error)

ToInt16E casts any type to an int16 type.

func ToInt32E

func ToInt32E(i any) (int32, error)

ToInt32E casts any type to an int32 type.

func ToInt64E

func ToInt64E(i any) (int64, error)

ToInt64E casts any to an int64 type.

func ToInt8E

func ToInt8E(i any) (int8, error)

ToInt8E casts any type to an int8 type.

func ToIntE

func ToIntE(i any) (int, error)

ToIntE casts any type to an int type.

func ToStringE

func ToStringE(i any) (string, error)

ToStringE casts any type to a string type.

func ToUint16E

func ToUint16E(i any) (uint16, error)

ToUint16E casts any type to a uint16 type.

func ToUint32E

func ToUint32E(i any) (uint32, error)

ToUint32E casts any type to a uint32 type.

func ToUint64E

func ToUint64E(i any) (uint64, error)

ToUint64E casts any type to a uint64 type.

func ToUint8E

func ToUint8E(i any) (uint8, error)

ToUint8E casts any type to a uint type.

func ToUintE

func ToUintE(i any) (uint, error)

ToUintE casts any type to a uint type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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