Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

inliquid
Copy link

@inliquid inliquid commented Jan 3, 2019

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

…marshaling of MongoDB's BSON binary UUID format with new (recommended) UUID as default kind (0x04).

- Introduced SetBSONKind function to make user able to set different BSON kind.
@googlebot
Copy link

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

📝 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
Copy link
Author

inliquid commented Jan 3, 2019

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
Copy link

this would be super useful for my purposes

@inliquid
Copy link
Author

@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
Copy link
Collaborator

pborman commented Jan 30, 2019

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
Copy link

maxekman commented Jan 28, 2021

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
Copy link

what? no

@maxekman
Copy link

Updated the link, if the comment was about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants