A PostgreSQL client library for the Go programming language
Go
Pull request Compare This branch is 14 commits behind lxn:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data
examples
AUTHORS
LICENSE
Makefile
README.mdown
conn.go
conn_log.go
conn_read.go
conn_write.go
driver.go
error.go
messagecodes.go
parameter.go
pgsql_test.go
pool.go
resultset.go
state.go
statement.go
types.go
util.go

README.mdown

About go-pgsql

go-pgsql is a PostgreSQL client library for the Go programming language.

It partially implements version 3.0 of the PostgreSQL frontend/backend protocol, so it should work with servers of version 7.4 and later.

It now supports database/sql in addition to its existing interface.

Installing go-pgsql

First make sure you have a working Go installation, see the installation guide at http://golang.org/doc/install.html

Now you should be able to install go-pgsql by running go get github.com/lxn/go-pgsql

Using go-pgsql

There are some examples in the examples directory which should get you started.

Please open an issue on the bug tracker if you encounter a bug.

Missing Features

go-pgsql is currently missing support for some features, including:

  • authentication types other than MD5
  • SSL encrypted sessions
  • some data types like bytea, ...
  • canceling commands/queries
  • bulk copy
  • ...

Connection Info

To connect, you must pass a connection string to pgsql.Connect(). Much as with the libpq conninfo parameter, values are optional, and may be overridden by environment variables at runtime, specifically:

  • PGPORT - port number
  • PGUSER - user name (defaults to postgres)
  • PGHOST - host name/address (defaults to localhost)
  • PGDATABASE - name of database (defaults to user name if not specified)