|
@@ -19,6 +19,9 @@ func isBytes(v reflect.Value) bool {
|
|
|
}
|
|
|
|
|
|
func StringValue(v interface{}) (s string, err error) {
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
refValue := reflect.Indirect(reflect.ValueOf(v))
|
|
|
switch refValue.Kind() {
|
|
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
|
@@ -38,6 +41,9 @@ func StringValue(v interface{}) (s string, err error) {
|
|
|
}
|
|
|
|
|
|
func IntegerValue(v interface{}) (n int64, err error) {
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
refValue := reflect.Indirect(reflect.ValueOf(v))
|
|
|
switch refValue.Kind() {
|
|
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
|
@@ -59,6 +65,9 @@ func IntegerValue(v interface{}) (n int64, err error) {
|
|
|
}
|
|
|
|
|
|
func FloatValue(v interface{}) (n float64, err error) {
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
refValue := reflect.Indirect(reflect.ValueOf(v))
|
|
|
switch refValue.Kind() {
|
|
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|