Created
January 21, 2019 19:52
-
-
Save shanev/785dc8586b1e3a7c6745006cb5f62ef2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Updates an existing Profile or creates a new one | |
func (c *Client) UpsertProfile(profile *Profile) error { | |
_, err := c.Model(profile). | |
OnConflict("(id) DO UPDATE"). | |
Set("username = EXCLUDED.username"). | |
Insert() | |
return err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment