itype

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

View Source
const EPSILON float64 = 1e-9
View Source
const FALSE_STRINGS = "no,false,off,0,"
View Source
const HASH = MAP

compatible with old version

Variables

This section is empty.

Functions

func Bool

func Bool(obj interface{}) bool

Bool try to get bool value of given object. number: 0 => false, otherwise => true string: ("", "false", "off", "no", "0") => false (case insensitive), otherwise => true nil: false otherwise: true

func Bytes

func Bytes(obj interface{}) []byte

Bytes try to get []byte value of given object see String()

func Float

func Float(obj interface{}) float64

Float try to get float value of given object. number: type cast bool: true => 1.0 false => 0.0 string: empty => 0, otherwise parse float nil && otherwise: 0.0

func Int

func Int(obj interface{}) int64

Int try to get int64 value of given object. number : type cast bool: true => 1, false => 0, string: empty => 0, otherwise parse int nil & otherwise : 0

func String

func String(obj interface{}) string

String try to get string value of given object. string/[]byte : original string bool : true => "1", false => "" number : number format nil & otherwise : ""

func Uint

func Uint(obj interface{}) uint64

Uint try to get uint64 value of given object. number : type cast bool: true => 1, false => 0, string: empty => 0, otherwise parse int nil & otherwise : 0

Types

type Type

type Type int
const (
	STRING Type = iota
	NUMBER
	BOOL
	MAP
	ARRAY
	NULL
	UNKNOWN
)

func GetType

func GetType(obj interface{}) Type

GetType get itype.Type of given object

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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