google / uuid

Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
BSD 3-Clause "New" or "Revised" License
5.26k stars 362 forks source link

Enhancement: Support binary SQL representation #46

Open mcandre opened 5 years ago

mcandre commented 5 years ago

Binary UUID format in SQL has much better performance than text UUID format in SQL. Could we get support for seamless binary UUID marshaling?

cbandy commented 5 years ago

Can you please describe what "Binary UUID format in SQL" means and what "seamless" marshaling might look like?

ZzEeKkAa commented 3 years ago

@cbandy if you create uuid in mysql as binary(16), then drivers are waiting for byte[16], not string, which is returned by default from Value(). But we cannot just replace, cause it depends on driver. Global flag is also not a good solution, because if you use multiple drivers in the solution it's going to be a hell.

Thinks became more tricky if you use gorm. You do not send values explicitly.