Rename ConnectionPoolOptions to ConnPoolConfig

scan-io
Jack Christensen 2014-05-17 13:44:55 -05:00
parent 2da1751e1a
commit 9067b2d991
5 changed files with 8 additions and 8 deletions

View File

@ -139,7 +139,7 @@ changing transcoders).
### Logging
Pgx defines the pgx.Logger interface. A value that satisfies this interface
used as part of ConnectionOptions or ConnectionPoolOptions to enable logging
used as part of ConnectionOptions or ConnPoolConfig to enable logging
of pgx activities.
## Testing

View File

@ -635,7 +635,7 @@ func BenchmarkTimestampTzBinary(b *testing.B) {
}
func BenchmarkConnPool(b *testing.B) {
options := pgx.ConnectionPoolOptions{MaxConnections: 5}
options := pgx.ConnPoolConfig{MaxConnections: 5}
pool, err := pgx.NewConnPool(*defaultConnConfig, options)
if err != nil {
b.Fatalf("Unable to create connection pool: %v", err)

View File

@ -5,7 +5,7 @@ import (
"sync"
)
type ConnectionPoolOptions struct {
type ConnPoolConfig struct {
MaxConnections int // max simultaneous connections to use
AfterConnect func(*Conn) error
Logger Logger
@ -29,7 +29,7 @@ type ConnPoolStat struct {
// NewConnPool creates a new ConnPool. config are passed through to
// Connect directly.
func NewConnPool(config ConnConfig, options ConnectionPoolOptions) (p *ConnPool, err error) {
func NewConnPool(config ConnConfig, options ConnPoolConfig) (p *ConnPool, err error) {
p = new(ConnPool)
p.config = config
p.maxConnections = options.MaxConnections

View File

@ -9,7 +9,7 @@ import (
)
func createConnPool(t *testing.T, maxConnections int) *pgx.ConnPool {
options := pgx.ConnectionPoolOptions{MaxConnections: maxConnections}
options := pgx.ConnPoolConfig{MaxConnections: maxConnections}
pool, err := pgx.NewConnPool(*defaultConnConfig, options)
if err != nil {
t.Fatalf("Unable to create connection pool: %v", err)
@ -24,7 +24,7 @@ func TestNewConnPool(t *testing.T) {
return nil
}
options := pgx.ConnectionPoolOptions{MaxConnections: 2, AfterConnect: afterConnect}
options := pgx.ConnPoolConfig{MaxConnections: 2, AfterConnect: afterConnect}
pool, err := pgx.NewConnPool(*defaultConnConfig, options)
if err != nil {
t.Fatal("Unable to establish connection pool")
@ -43,7 +43,7 @@ func TestNewConnPool(t *testing.T) {
return errAfterConnect
}
options = pgx.ConnectionPoolOptions{MaxConnections: 2, AfterConnect: afterConnect}
options = pgx.ConnPoolConfig{MaxConnections: 2, AfterConnect: afterConnect}
pool, err = pgx.NewConnPool(*defaultConnConfig, options)
if err != errAfterConnect {
t.Errorf("Expected errAfterConnect but received unexpected: %v", err)

View File

@ -102,7 +102,7 @@ func main() {
User: "jack",
Password: "jack",
Database: "url_shortener"}
poolOptions := pgx.ConnectionPoolOptions{MaxConnections: 5, AfterConnect: afterConnect}
poolOptions := pgx.ConnPoolConfig{MaxConnections: 5, AfterConnect: afterConnect}
pool, err = pgx.NewConnectionPool(connectionOptions, poolOptions)
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to create connection pool: %v\n", err)