Compare commits
No commits in common. "1c5bdc5119028e74e797c549916378c739b63d85" and "eccc0f20f01d0176cfbcc031233b549b6013ddac" have entirely different histories.
1c5bdc5119
...
eccc0f20f0
|
@ -50,16 +50,11 @@ func GetUser(dbConn *sql.DB, id string) (*User, error) {
|
||||||
func FindOrSaveUser(dbConn *sql.DB, user *User) (*User, error) {
|
func FindOrSaveUser(dbConn *sql.DB, user *User) (*User, error) {
|
||||||
log.Println("finding or saving user", user.ID)
|
log.Println("finding or saving user", user.ID)
|
||||||
|
|
||||||
_, err := dbConn.Exec(`INSERT INTO users (id, mail, username, display_name) VALUES (?, ?, ?, ?) ON CONFLICT(id) DO UPDATE SET mail = excluded.mail, username = excluded.username, display_name = excluded.display_name;`, user.ID, user.Mail, user.Username, user.DisplayName)
|
_, err := dbConn.Exec(`INSERT OR REPLACE INTO users (id, mail, username, display_name) VALUES (?, ?, ?, ?);`, user.ID, user.Mail, user.Username, user.DisplayName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// _, err = dbConn.Exec(`UPDATE users SET mail = ?, username = ?, display_name = ? WHERE id = ?;`, user.Mail, user.Username, user.DisplayName, user.ID)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
|
|
||||||
return user, nil
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue