-
Notifications
You must be signed in to change notification settings - Fork 56
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
add support for snowflake based int64 uuids #824
Conversation
@@ -283,3 +286,5 @@ require ( | |||
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect | |||
sigs.k8s.io/yaml v1.2.0 // indirect | |||
) | |||
|
|||
replace github.com/gin-gonic/gin => github.com/infrahq/gin v1.7.2-0.20220120203023-0eaa562f3a8a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is how we can work off the fork without changing the code everywhere.
uuid/snowflake.go
Outdated
@@ -0,0 +1,40 @@ | |||
package uuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package id
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - consider calling this ID or UID to avoid users expecting the UUID format
internal/api/model_user.go
Outdated
|
||
// User struct for User | ||
type User struct { | ||
ID UUID `json:"id"` | ||
Email string `json:"email" validate:"email,required"` | ||
ID uuid.UUID `json:"id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change this to ID
in general rather than UUID
? UUID implies it matches the UUID spec to me, which I don't think snowflake IDs do.
@@ -275,7 +275,7 @@ func (a *API) ListGrants(c *gin.Context, r *api.ListGrantsRequest) ([]api.Grant, | |||
} | |||
|
|||
func (a *API) GetGrant(c *gin.Context, r *api.Resource) (*api.Grant, error) { | |||
grant, err := access.GetGrant(c, r.ID.ToUUID()) | |||
grant, err := access.GetGrant(c, r.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are much nicer to read now 👏
id
s will either have to migrate or drop/recreate.