valToStr converts a posting value to a string.
(v types.Val)
| 90 | |
| 91 | // valToStr converts a posting value to a string. |
| 92 | func valToStr(v types.Val) (string, error) { |
| 93 | v2, err := types.Convert(v, types.StringID) |
| 94 | if err != nil { |
| 95 | return "", errors.Wrapf(err, "while converting %v to string", v2.Value) |
| 96 | } |
| 97 | |
| 98 | // Strip terminating null, if any. |
| 99 | return strings.TrimRight(v2.Value.(string), "\x00"), nil |
| 100 | } |
| 101 | |
| 102 | // facetToString convert a facet value to a string. |
| 103 | func facetToString(fct *api.Facet) (string, error) { |