decodeUUIDBinary interprets the binary format of a uuid, returning it in text format.
(src []byte)
| 82 | |
| 83 | // decodeUUIDBinary interprets the binary format of a uuid, returning it in text format. |
| 84 | func decodeUUIDBinary(src []byte) ([]byte, error) { |
| 85 | if len(src) != 16 { |
| 86 | return nil, fmt.Errorf("pq: unable to decode uuid; bad length: %d", len(src)) |
| 87 | } |
| 88 | |
| 89 | dst := make([]byte, 36) |
| 90 | dst[8], dst[13], dst[18], dst[23] = '-', '-', '-', '-' |
| 91 | hex.Encode(dst[0:], src[0:4]) |
| 92 | hex.Encode(dst[9:], src[4:6]) |
| 93 | hex.Encode(dst[14:], src[6:8]) |
| 94 | hex.Encode(dst[19:], src[8:10]) |
| 95 | hex.Encode(dst[24:], src[10:16]) |
| 96 | return dst, nil |
| 97 | } |
| 98 | |
| 99 | func textDecode(ps *parameterStatus, s []byte, typ oid.Oid) (any, error) { |
| 100 | switch typ { |
no outgoing calls
searching dependent graphs…