ValueFromString Given a string, convert to valuetype
(vt string)
| 236 | |
| 237 | // ValueFromString Given a string, convert to valuetype |
| 238 | func ValueFromString(vt string) ValueType { |
| 239 | switch vt { |
| 240 | case "nil", "null": |
| 241 | return NilType |
| 242 | case "error": |
| 243 | return ErrorType |
| 244 | case "unknown": |
| 245 | return UnknownType |
| 246 | case "value": |
| 247 | return ValueInterfaceType |
| 248 | case "number": |
| 249 | return NumberType |
| 250 | case "int": |
| 251 | return IntType |
| 252 | case "bool": |
| 253 | return BoolType |
| 254 | case "time": |
| 255 | return TimeType |
| 256 | case "[]byte": |
| 257 | return ByteSliceType |
| 258 | case "string": |
| 259 | return StringType |
| 260 | case "[]string": |
| 261 | return StringsType |
| 262 | case "map[string]value": |
| 263 | return MapValueType |
| 264 | case "map[string]int": |
| 265 | return MapIntType |
| 266 | case "map[string]string": |
| 267 | return MapStringType |
| 268 | case "map[string]number": |
| 269 | return MapNumberType |
| 270 | case "map[string]bool": |
| 271 | return MapBoolType |
| 272 | case "map[string]time": |
| 273 | return MapTimeType |
| 274 | case "[]value": |
| 275 | return SliceValueType |
| 276 | case "struct": |
| 277 | return StructType |
| 278 | case "json": |
| 279 | return JsonType |
| 280 | default: |
| 281 | return UnknownType |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | // NewValue creates a new Value type from a native Go value. |
| 286 | // |
no outgoing calls