Created
October 19, 2022 15:11
-
-
Save AseemWangoo/1e7ff631dd1ba2acd47b0a8c4c4f99ac to your computer and use it in GitHub Desktop.
connect with postgres
This file contains 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
host := "127.0.0.1" | |
port := "5432" | |
user := "user" | |
password := "password" | |
dbname := "dbname" | |
psqlInfo := fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable", host, port, user, password, dbname) | |
result, err := sql.Open("postgres", psqlInfo) | |
if err != nil { | |
log.Fatalf("Error in connection : %s", err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment