(nq NQuad)
| 82 | } |
| 83 | |
| 84 | func 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 | |
| 101 | func toUid(subject string, newToUid map[string]uint64) (uid uint64, err error) { |
| 102 | if id, err := ParseUid(subject); err == nil || err == errInvalidUID { |
no test coverage detected