Skip to content

go-gdbc/gdbc-postgresql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gdbc-postgresql

GDBC Postgresql Driver - It is based on https://github.com/jackc/pgx

Go Report Card codecov Build Status

Usage

dataSource, err := gdbc.GetDataSource("gdbc:postgresql://username:password@localhost:3000/testdb?sslmode=disable")
if err != nil {
    panic(err)
}

var connection *sql.DB
connection, err = dataSource.GetConnection()
if err != nil {
    panic(err)
}

Postgresql GDBC URL takes one of the following forms:

gdbc:postgresql://host:port/database-name?arg1=value1
gdbc:postgresql://host/database-name?arg1=value1
gdbc:postgresql:database-name?arg1=value1
gdbc:postgresql:?arg1=value1
gdbc:postgresql://username:password@host:port/database-name?arg1=value1

Default Values:

  • Host : localhost
  • Port : 5432
  • User : postgres
  • Password :

Checkout https://github.com/jackc/pgx for arguments details.