mirror of https://github.com/jackc/pgx.git
rename ConnStr -> ConnString
parent
7c73e608ff
commit
33cbec368f
8
conn.go
8
conn.go
|
@ -30,7 +30,7 @@ type ConnConfig struct {
|
|||
LogLevel LogLevel
|
||||
|
||||
// Original connection string that was parsed into config.
|
||||
ConnStr string
|
||||
ConnString string
|
||||
|
||||
// BuildStatementCache creates the stmtcache.Cache implementation for connections created with this config. Set
|
||||
// to nil to disable automatic prepared statements.
|
||||
|
@ -160,7 +160,7 @@ func ParseConfig(connString string) (*ConnConfig, error) {
|
|||
createdByParseConfig: true,
|
||||
LogLevel: LogLevelInfo,
|
||||
BuildStatementCache: buildStatementCache,
|
||||
ConnStr: connString,
|
||||
ConnString: connString,
|
||||
}
|
||||
|
||||
return connConfig, nil
|
||||
|
@ -422,8 +422,8 @@ func (c *Conn) StatementCache() stmtcache.Cache { return c.stmtcache }
|
|||
// ConnInfo returns the connection info used for this connection.
|
||||
func (c *Conn) ConnInfo() *pgtype.ConnInfo { return c.connInfo }
|
||||
|
||||
// ConnStr returns the connection string that was used to establish this connection.
|
||||
func (c *Conn) ConnStr() string { return c.config.ConnStr }
|
||||
// ConnString returns the connection string that was used to establish this connection.
|
||||
func (c *Conn) ConnString() string { return c.config.ConnString }
|
||||
|
||||
// Exec executes sql. sql can be either a prepared statement name or an SQL string. arguments should be referenced
|
||||
// positionally from the sql string as $1, $2, etc.
|
||||
|
|
|
@ -28,7 +28,7 @@ func TestCrateDBConnect(t *testing.T) {
|
|||
require.Nil(t, err)
|
||||
defer closeConn(t, conn)
|
||||
|
||||
assert.Equal(t, connString, conn.ConnStr())
|
||||
assert.Equal(t, connString, conn.ConnString())
|
||||
|
||||
var result int
|
||||
err = conn.QueryRow(context.Background(), "select 1 +1").Scan(&result)
|
||||
|
@ -51,7 +51,7 @@ func TestConnect(t *testing.T) {
|
|||
t.Fatalf("Unable to establish connection: %v", err)
|
||||
}
|
||||
|
||||
assert.Equal(t, connStr, conn.ConnStr())
|
||||
assert.Equal(t, connStr, conn.ConnString())
|
||||
|
||||
var currentDB string
|
||||
err = conn.QueryRow(context.Background(), "select current_database()").Scan(¤tDB)
|
||||
|
@ -113,7 +113,7 @@ func TestConfigContainsConnStr(t *testing.T) {
|
|||
connStr := os.Getenv("PGX_TEST_DATABASE")
|
||||
config, err := pgx.ParseConfig(connStr)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, connStr, config.ConnStr)
|
||||
assert.Equal(t, connStr, config.ConnString)
|
||||
}
|
||||
|
||||
func TestParseConfigExtractsStatementCacheOptions(t *testing.T) {
|
||||
|
|
|
@ -69,7 +69,7 @@ func (cr *connResource) getPoolRows(c *Conn, r pgx.Rows) *poolRows {
|
|||
|
||||
type Pool struct {
|
||||
p *puddle.Pool
|
||||
connStr string
|
||||
connString string
|
||||
afterConnect func(context.Context, *pgx.Conn) error
|
||||
beforeAcquire func(context.Context, *pgx.Conn) bool
|
||||
afterRelease func(*pgx.Conn) bool
|
||||
|
@ -142,7 +142,7 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) {
|
|||
}
|
||||
|
||||
p := &Pool{
|
||||
connStr: config.ConnConfig.ConnStr,
|
||||
connString: config.ConnConfig.ConnString,
|
||||
afterConnect: config.AfterConnect,
|
||||
beforeAcquire: config.BeforeAcquire,
|
||||
afterRelease: config.AfterRelease,
|
||||
|
@ -371,8 +371,8 @@ func (p *Pool) AcquireAllIdle(ctx context.Context) []*Conn {
|
|||
return conns
|
||||
}
|
||||
|
||||
// ConnStr returns the connection string that was used to initialize this pool.
|
||||
func (p *Pool) ConnStr() string { return p.connStr }
|
||||
// ConnString returns the connection string that was used to initialize this pool.
|
||||
func (p *Pool) ConnString() string { return p.connString }
|
||||
|
||||
func (p *Pool) Stat() *Stat {
|
||||
return &Stat{s: p.p.Stat()}
|
||||
|
|
|
@ -17,7 +17,7 @@ func TestConnect(t *testing.T) {
|
|||
connStr := os.Getenv("PGX_TEST_DATABASE")
|
||||
pool, err := pgxpool.Connect(context.Background(), connStr)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, connStr, pool.ConnStr())
|
||||
assert.Equal(t, connStr, pool.ConnString())
|
||||
pool.Close()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue