uuid icon indicating copy to clipboard operation
uuid copied to clipboard

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

Open inliquid opened this issue 6 years ago • 8 comments

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

inliquid avatar Jan 03 '19 15:01 inliquid

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

googlebot avatar Jan 03 '19 15:01 googlebot

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.

inliquid avatar Jan 03 '19 15:01 inliquid

this would be super useful for my purposes

frednomoon avatar Jan 23 '19 15:01 frednomoon

@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.

inliquid avatar Jan 23 '19 16:01 inliquid

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.

pborman avatar Jan 30 '19 02:01 pborman

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

maxekman avatar Jan 28 '21 08:01 maxekman

what? no

batara666 avatar Jul 30 '21 17:07 batara666

Updated the link, if the comment was about that.

maxekman avatar Jul 31 '21 07:07 maxekman