-
-
Save L04DB4L4NC3R/04efd6e4659f7aab367523e52b0aa839 to your computer and use it in GitHub Desktop.
package user | |
import "github.com/jinzhu/gorm" | |
type User struct { | |
gorm.Model | |
FirstName string `json:"first_name,omitempty"` | |
LastName string `json:"last_name,omitempty"` | |
Password string `json:"password,omitempty"` | |
PhoneNumber string `json:"phone_number,omitempty"` | |
Email string `json:"email,omitempty"` | |
Address string `json:"address,omitempty"` | |
DisplayPic string `json:"display_pic,omitempty"` | |
} |
Isn’t
password
is implementation specific?
If you wanna use Login with Google you would need to change your entity that need to be independentAnother thing is that the
json
path or whatever it is (I’m sorry I don’t know Go) is also implementation specific
(entity shouldn’t import libraries, if you want to change your library you would need to change your business core)
json
tag is actually an idiomatic way to represent what the names of the fields will be when this structure is encoded into JSON. It is not a path. Your conjecture about the password field is right, I just store the OAuth access token in the password field when doing Google login, since we have to explicitly serialize them anyway. I would love to know about your approach for the same.
Isn’t
password
is implementation specific?If you wanna use Login with Google you would need to change your entity that need to be independent
Another thing is that the
json
path or whatever it is (I’m sorry I don’t know Go) is also implementation specific(entity shouldn’t import libraries, if you want to change your library you would need to change your business core)