I am making an API using Golang, and I am using Postgres as database. I have used the following command:-
args := "host=" + host + " port=" + port + " dbName=" + dbName + "username=" + username + " sslmode=disable password=" + password
db, err := gorm.Open("postgres", args)
if err != nil {
log.Fatal(err)
}
db.AutoMigrate(models.Hospital{})
DB = db
But while I build the model, I am getting the error as:-
pq: password authentication failed for user "Ansh Joshi"
Though when I try to login using the same password in pgAdmin, I am able to log in it perfectly fine. Then the thing I am not able to understand is why I am unable to connect it while using vscode.
Any help would be much appreciated. Thank you in advance...