-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
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.uuidfor uuid. I wonder, if I can add something to reform to be able to support this import automatically. -
Reform generates the following method:
// SetPK sets record primary key.
func (s *Profile) SetPK(pk interface{}) {
if i64, ok := pk.(int64); ok {
s.ID = uuid.UUID(i64)
} else {
s.ID = pk.(uuid.UUID)
}
}As nothing has been added to imports, I wonder which library supports uuid.UUID(i64) (as this is not what satori/go.uuid can offer, it gives me cannot convert i64 (type int64) to type uuid.UUID). I found a way to make my code working:
func (s *Profile) SetPK(pk interface{}) {
s.ID = pk.(uuid.UUID)
}But I wonder if this is a suitable approach and how can I improve the whole story.
msadakov
Metadata
Metadata
Assignees
Labels
No labels