decodeUUID decodes 16 raw bytes into a UUID string "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
(data []byte)
| 554 | |
| 555 | // decodeUUID decodes 16 raw bytes into a UUID string "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx". |
| 556 | func decodeUUID(data []byte) (string, error) { |
| 557 | if len(data) != 16 { |
| 558 | return "", fmt.Errorf("invalid UUID binary data: got %d bytes, need 16", len(data)) |
| 559 | } |
| 560 | s := hex.EncodeToString(data) |
| 561 | return s[0:8] + "-" + s[8:12] + "-" + s[12:16] + "-" + s[16:20] + "-" + s[20:32], nil |
| 562 | } |
| 563 | |
| 564 | // encodeTime encodes a TIME value as int64 microseconds since midnight (PostgreSQL binary format). |
| 565 | // DuckDB Go driver returns TIME as time.Time with date fixed to 0001-01-01. |
no outgoing calls