More About SQL With Go
package main import ( "database/sql" "fmt" _ "github.com/jackc/pgx/v4/stdlib" // stdlib is the package that provides the standard library driver. To be able to use database sql package ) type PostgresConfig struct { Host string Port string User string Password string Database string SSLMode string } func (cfg PostgresConfig) String() string { return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s", cfg.Host, cfg.Port, cfg.User, cfg.Password, cfg.Database, cfg.SSLMode) } func main() { cfg := PostgresConfig{ Host: "localhost", Port: "5432", User: "baloo", Password: "junglebook", Database: "lenslocked", SSLMode: "disable", } // pgx = Driver name defined by github.