hreflect

package
v0.81.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 2 Imported by: 18

Documentation

Overview

Package hreflect contains reflect helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFloat added in v0.76.0

func IsFloat(kind reflect.Kind) bool

IsFloat returns whether the given kind is a float.

func IsInt added in v0.76.0

func IsInt(kind reflect.Kind) bool

IsInt returns whether the given kind is an int.

func IsNumber added in v0.76.0

func IsNumber(kind reflect.Kind) bool

TODO(bep) replace the private versions in /tpl with these. IsInt returns whether the given kind is a number.

func IsTruthful

func IsTruthful(in interface{}) bool

IsTruthful returns whether in represents a truthful value. See IsTruthfulValue

func IsTruthfulValue

func IsTruthfulValue(val reflect.Value) (truth bool)

IsTruthfulValue returns whether the given value has a meaningful truth value. This is based on template.IsTrue in Go's stdlib, but also considers IsZero and any interface value will be unwrapped before it's considered for truthfulness.

Based on: https://github.com/golang/go/blob/178a2c42254166cffed1b25fb1d3c7a5727cada6/src/text/template/exec.go#L306

func IsUint added in v0.76.0

func IsUint(kind reflect.Kind) bool

IsUint returns whether the given kind is an uint.

Types

This section is empty.

Jump to

Keyboard shortcuts

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