You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
342 B
24 lines
342 B
package simulation |
|
|
|
func AsFloat64(v interface{}) float64 { |
|
switch val := v.(type) { |
|
case float64: |
|
return val |
|
case int: |
|
return float64(val) |
|
case int64: |
|
return float64(val) |
|
case float32: |
|
return float64(val) |
|
default: |
|
return 0 |
|
} |
|
} |
|
|
|
func AsString(v interface{}) string { |
|
s, ok := v.(string) |
|
if !ok { |
|
return "" |
|
} |
|
return s |
|
}
|
|
|