MCPcopy Create free account
hub / github.com/lib/pq / binaryDecode

Function binaryDecode

encode.go:65–81  ·  view source on GitHub ↗
(s []byte, typ oid.Oid)

Source from the content-addressed store, hash-verified

63}
64
65func 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.
84func decodeUUIDBinary(src []byte) ([]byte, error) {

Callers 1

decodeFunction · 0.85

Calls 1

decodeUUIDBinaryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…