Add bool and int support to pkg/cast2
This commit is contained in:
13
server/pkg/cast2/boolean.go
Normal file
13
server/pkg/cast2/boolean.go
Normal 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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user