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

feature: Add datatype BinUUID for uuid as binary storage in DB #264

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

omkar-foss
Copy link
Contributor

  • [*] Do only one thing
  • [*] Non breaking API changes
  • [*] Tested

What did this pull request do?

This adds a new datatype BinUUID, similar to datatypes.UUID but with a major difference being that BinUUID stores the uuid in the database as a binary (byte) array instead of a string. Developers may use either datatypes.UUID or datatypes.BinUUID as per their preference, either storing uuid in the database as a string or as a binary (byte) array respectively.

User Case Description

This new datatype is useful for developers who prefer to store uuid as binary (byte) array in the database for join performance, column size optimization or any other reasons.

This adds a new datatype BinUUID, similar to datatypes.UUID but
with a major difference being that BinUUID stores the uuid in
the database as a binary (byte) array instead of a string.
Developers may use either datatypes.UUID or datatypes.BinUUID
as per their preference, either storing uuid in the database
as a string or as a binary (byte) array respectively.
@omkar-foss
Copy link
Contributor Author

@pcfreak30 I've added a new datatype BinUUID in this PR, which stores uuid as binary (byte) array in the database. Might be useful to you, check it out :)

@pcfreak30
Copy link

skimming, LGTM.

I will use this soon.

@omkar-foss
Copy link
Contributor Author

Hi @jinzhu, hope you're doing great. When you get some time, please review this PR. Thanks.

@jinzhu jinzhu merged commit 48115e5 into go-gorm:master Sep 14, 2024
8 of 9 checks passed
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.

3 participants