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

Function ParseUid

dql/mutation.go:35–45  ·  view source on GitHub ↗

ParseUid parses the given string into an UID. This method returns with an error if the string cannot be parsed or the parsed UID is zero.

(xid string)

Source from the content-addressed store, hash-verified

33// ParseUid parses the given string into an UID. This method returns with an error
34// if the string cannot be parsed or the parsed UID is zero.
35func ParseUid(xid string) (uint64, error) {
36 // If string represents a UID, convert to uint64 and return.
37 uid, err := strconv.ParseUint(xid, 0, 64)
38 if err != nil {
39 return 0, err
40 }
41 if uid == 0 {
42 return 0, errInvalidUID
43 }
44 return uid, nil
45}
46
47// NQuad is an alias for the NQuad type in the API protobuf library.
48type NQuad struct {

Callers 5

GetGQLSchemaFunction · 0.92
parseSubjectFunction · 0.92
RequireUidFunction · 0.92
ExtractBlankUIDsFunction · 0.92
toUidFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected