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)
| 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. |
| 35 | func 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. |
| 48 | type NQuad struct { |
no outgoing calls
no test coverage detected