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

Added support for marshaling/unmarshaling of MongoDB's BSON UUID binary format #40

Open inliquid opened 5 years ago

inliquid commented 5 years ago

Added support for marshaling/unmarshaling of MongoDB's BSON UUID binary format by implementing bson.Getter/Setter interfaces

googlebot commented 5 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
inliquid commented 5 years ago

Since you added go.mod to repo I had to change it to point to my own repo, otherwise I wasn't be able to use it. Keep in mind that you need to change it back.

frednomoon commented 5 years ago

this would be super useful for my purposes

inliquid commented 5 years ago

@frednomoon

Thanks. Not sure if this gonna be merged, but you can use either my repo (https://github.com/inliquid/uuid) or fork it for yourself. Note, that if you are using modules, you have to run go get github.com/<repo>@<commit_id> to grab latest changes and update go.mod of your project, because there is no version tag, and it won't be updated automatically.

pborman commented 5 years ago

Sorry for the delay in response. This change will create an extra dependency for every package that includes the uuid package. Since uuids have a very fixed form, it would be better to just generate the encoded version directly and not use the extra package. I am a little concerned that we will end up adding marshalling/unmarshalling for every various type of encoding.

maxekman commented 3 years ago

Another approach to supporting UUIDs for BSON directly in your client project is to use the RegisterTypeEncoder functions, example here: https://github.com/looplab/eventhorizon/blob/main/codec/bson/uuid.go

batara666 commented 3 years ago

what? no

maxekman commented 3 years ago

Updated the link, if the comment was about that.