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

Function facetToString

worker/export.go:103–115  ·  view source on GitHub ↗

facetToString convert a facet value to a string.

(fct *api.Facet)

Source from the content-addressed store, hash-verified

101
102// facetToString convert a facet value to a string.
103func facetToString(fct *api.Facet) (string, error) {
104 v1, err := facets.ValFor(fct)
105 if err != nil {
106 return "", errors.Wrapf(err, "getting value from facet %#v", fct)
107 }
108
109 v2 := &types.Val{Tid: types.StringID}
110 if err = types.Marshal(v1, v2); err != nil {
111 return "", errors.Wrapf(err, "marshaling facet value %v to string", v1)
112 }
113
114 return v2.Value.(string), nil
115}
116
117// escapedString converts a string into an escaped string for exports.
118func escapedString(str string) string {

Callers 2

toJSONMethod · 0.85
toRDFMethod · 0.85

Calls 2

ValForFunction · 0.92
MarshalFunction · 0.92

Tested by

no test coverage detected