InferTypes takes a list of strings produced by ParsePath and returns a slice of datum types inferred from the strings. Type DInt will be used if possible, otherwise DString. For example, a vals slice ["1", "foo"] will give a types slice [Dint, DString].
(vals []string)
| 6347 | // otherwise DString. For example, a vals slice ["1", "foo"] will give a types |
| 6348 | // slice [Dint, DString]. |
| 6349 | func InferTypes(vals []string) []types.Family { |
| 6350 | // Infer the datum types and populate typs accordingly. |
| 6351 | typs := make([]types.Family, len(vals)) |
| 6352 | for i := 0; i < len(vals); i++ { |
| 6353 | typ := types.IntFamily |
| 6354 | _, err := ParseDInt(vals[i]) |
| 6355 | if err != nil { |
| 6356 | typ = types.StringFamily |
| 6357 | } |
| 6358 | typs[i] = typ |
| 6359 | } |
| 6360 | return typs |
| 6361 | } |
| 6362 | |
| 6363 | // AdjustValueToType checks that the width (for strings, byte arrays, and bit |
| 6364 | // strings) and scale (decimal). and, shape/srid (for geospatial types) fits the |
nothing calls this directly
no test coverage detected
searching dependent graphs…