-
Notifications
You must be signed in to change notification settings - Fork 73
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
Question: What reform uses for UUID support #202
Comments
I responded in the other issue, but want to highlight one thing there: func (s *Profile) SetPK(pk interface{}) {
s.ID = pk.(uuid.UUID)
} You could replace that code with: func (s *Profile) SetPK(pk interface{}) {
panic("should not be used")
}
|
@AlekSi thanks! Actually, I was pretty sure that
(from https://godoc.org/github.com/lib/pq, also: https://github.com/lib/pq/blob/51e2106eed1cea199c802d2a49e91e2491b02056/conn.go#L694) So, do you mean that for the |
Yes, PostgreSQL uses |
… for PostgreSQL. Reform always uses the code above that line for PostgreSQL. |
@AlekSi ok, then I agree :) (but, for example, it's not possible to simply remove |
That's why this and other tickets are still open. |
When my model has a UUID-based field and when I do
reform models
I have the following situation:Reform generates the code but doesn't add anything to imports. Personally, I use
github.com/satori/go.uuid
for uuid. I wonder, if I can add something to reform to be able to support this import automatically.Reform generates the following method:
As nothing has been added to imports, I wonder which library supports
uuid.UUID(i64)
(as this is not whatsatori/go.uuid
can offer, it gives mecannot convert i64 (type int64) to type uuid.UUID
). I found a way to make my code working:But I wonder if this is a suitable approach and how can I improve the whole story.
The text was updated successfully, but these errors were encountered: