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

Function byteVal

dql/mutation.go:84–99  ·  view source on GitHub ↗
(nq NQuad)

Source from the content-addressed store, hash-verified

82}
83
84func byteVal(nq NQuad) ([]byte, types.TypeID, error) {
85 // We infer object type from type of value. We set appropriate type in parse
86 // function or the Go client has already set.
87 p := TypeValFrom(nq.ObjectValue)
88 // These three would have already been marshalled to bytes by the client or
89 // in parse function.
90 if p.Tid == types.GeoID || p.Tid == types.DateTimeID || p.Tid == types.BigFloatID {
91 return p.Value.([]byte), p.Tid, nil
92 }
93
94 p1 := types.ValueForType(types.BinaryID)
95 if err := types.Marshal(p, &p1); err != nil {
96 return []byte{}, p.Tid, err
97 }
98 return p1.Value.([]byte), p.Tid, nil
99}
100
101func toUid(subject string, newToUid map[string]uint64) (uid uint64, err error) {
102 if id, err := ParseUid(subject); err == nil || err == errInvalidUID {

Callers 1

copyValueFunction · 0.85

Calls 3

ValueForTypeFunction · 0.92
MarshalFunction · 0.92
TypeValFromFunction · 0.85

Tested by

no test coverage detected