-- import "github.com/anikhasibul/sure"
Package sure helps you to use interfaces with more confidence. It returns zero value when the confidence is not so good.
It helps you to code like this:
if sure.Bool(value){
//..
}
instead of
if v,ok := value.(bool); ok {
//...
}
With sure:
var v = sure.Int(anInterface)
Without sure:
var (
v int
ok bool
)
v, ok = anInterface.(int) if !ok {
// hndle zero value
}
// use `v`
var PanicWhenWrong = falsePanicWhenWrong - when true it panics when the interface doesn't match with the prefered type. Default is false
func Bool(value interface{}) boolBool returns bool
func Float32(value interface{}) float32Float32 returns float32
func Float64(value interface{}) float64Float64 returns float64
func HasSet(value interface{}) boolHasSet returns false if the interface is nil
func Int(value interface{}) intInt returns int
func Int64(value interface{}) int64Int64 returns int64
func String(value interface{}) stringString returns string