MCPcopy
hub / github.com/dgraph-io/dgraph / valToStr

Function valToStr

worker/export.go:92–100  ·  view source on GitHub ↗

valToStr converts a posting value to a string.

(v types.Val)

Source from the content-addressed store, hash-verified

90
91// valToStr converts a posting value to a string.
92func 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.
103func facetToString(fct *api.Facet) (string, error) {

Callers 2

toJSONMethod · 0.85
toRDFMethod · 0.85

Calls 1

ConvertFunction · 0.92

Tested by

no test coverage detected