3
0

Add bool and int support to pkg/cast2

This commit is contained in:
Tomaž Jerman
2023-02-15 13:49:53 +01:00
parent 1e929210b4
commit 8dd5dbfe65
2 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
package cast2
import "github.com/spf13/cast"
func Bool(in any, out *bool) error {
aux, err := cast.ToBoolE(in)
if err != nil {
return err
}
*out = aux
return nil
}

View File

@@ -21,3 +21,13 @@ func Uint(in any, out *uint) error {
*out = aux
return nil
}
func Int(in any, out *int) error {
aux, err := cast.ToIntE(in)
if err != nil {
return err
}
*out = aux
return nil
}