// Update updates a user by id.
Update updates a user by id.
// Update updates a user by id .
func (ur *UserRepository) Update(ctx context.Context, id uint, u user.User) error {
	q := `
	UPDATE users set first_name=$1, last_name=$2, email=$3, picture=$4, updated_at=$5
		WHERE id=$6;
	`
	stmt, err := ur.Data.DB.PrepareContext(ctx, q)
	if err != nil {
		return err
	}
	defer stmt.Close()
	_, err = stmt.ExecContext(
		ctx, u.FirstName, u.LastName, u.Email,
		u.Picture, time.Now(), id,
	)
	if err != nil {
		return err
	}
	return nil
}
func ( ur * UserRepository ) Update ( ctx context . Context , id uint , u user . User ) error { q := `
	UPDATE users set first_name=$1, last_name=$2, email=$3, picture=$4, updated_at=$5
		WHERE id=$6;
	` stmt , err := ur . Data . DB . PrepareContext ( ctx , q ) if err != nil { return err } defer stmt . Close ( ) _ , err = stmt . ExecContext ( ctx , u . FirstName , u . LastName , u . Email , u . Picture , time . Now ( ) , id , ) if err != nil { return err } return nil }
Update updates a user by id.
Update updates a user by id .