MCPcopy
hub / github.com/jackc/pgx / encodeUUID

Function encodeUUID

pgtype/uuid.go:56–70  ·  view source on GitHub ↗

encodeUUID converts a uuid byte array to UUID standard string form.

(src [16]byte)

Source from the content-addressed store, hash-verified

54
55// encodeUUID converts a uuid byte array to UUID standard string form.
56func encodeUUID(src [16]byte) string {
57 var buf [36]byte
58
59 hex.Encode(buf[0:8], src[:4])
60 buf[8] = '-'
61 hex.Encode(buf[9:13], src[4:6])
62 buf[13] = '-'
63 hex.Encode(buf[14:18], src[6:8])
64 buf[18] = '-'
65 hex.Encode(buf[19:23], src[8:10])
66 buf[23] = '-'
67 hex.Encode(buf[24:], src[10:])
68
69 return string(buf[:])
70}
71
72// Scan implements the [database/sql.Scanner] interface.
73func (dst *UUID) Scan(src any) error {

Callers 6

ValueMethod · 0.85
StringMethod · 0.85
MarshalJSONMethod · 0.85
EncodeMethod · 0.85
ScanMethod · 0.85

Calls 1

EncodeMethod · 0.65

Tested by

no test coverage detected