go-gorm / datatypes

GORM Customized Data Types Collection
https://gorm.io/docs/data_types.html
MIT License
723 stars 108 forks source link

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

Closed omkar-foss closed 1 month ago

omkar-foss commented 3 months ago

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.

omkar-foss commented 3 months ago

@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 commented 3 months ago

skimming, LGTM.

I will use this soon.

omkar-foss commented 3 months ago

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