(s []byte, typ oid.Oid)
| 63 | } |
| 64 | |
| 65 | func binaryDecode(s []byte, typ oid.Oid) (any, error) { |
| 66 | switch typ { |
| 67 | case oid.T_bytea: |
| 68 | return s, nil |
| 69 | case oid.T_int8: |
| 70 | return int64(binary.BigEndian.Uint64(s)), nil |
| 71 | case oid.T_int4: |
| 72 | return int64(int32(binary.BigEndian.Uint32(s))), nil |
| 73 | case oid.T_int2: |
| 74 | return int64(int16(binary.BigEndian.Uint16(s))), nil |
| 75 | case oid.T_uuid: |
| 76 | return decodeUUIDBinary(s) |
| 77 | default: |
| 78 | return nil, fmt.Errorf("pq: don't know how to decode binary parameter of type %d", uint32(typ)) |
| 79 | } |
| 80 | |
| 81 | } |
| 82 | |
| 83 | // decodeUUIDBinary interprets the binary format of a uuid, returning it in text format. |
| 84 | func decodeUUIDBinary(src []byte) ([]byte, error) { |
no test coverage detected
searching dependent graphs…