Add ConnStr getter to Pool and Conn structs.
This commit is contained in:
@@ -29,6 +29,9 @@ type ConnConfig struct {
|
||||
Logger Logger
|
||||
LogLevel LogLevel
|
||||
|
||||
// Original connection string that was parsed into config.
|
||||
ConnStr string
|
||||
|
||||
// BuildStatementCache creates the stmtcache.Cache implementation for connections created with this config. Set
|
||||
// to nil to disable automatic prepared statements.
|
||||
BuildStatementCache BuildStatementCacheFunc
|
||||
@@ -157,6 +160,7 @@ func ParseConfig(connString string) (*ConnConfig, error) {
|
||||
createdByParseConfig: true,
|
||||
LogLevel: LogLevelInfo,
|
||||
BuildStatementCache: buildStatementCache,
|
||||
ConnStr: connString,
|
||||
}
|
||||
|
||||
return connConfig, nil
|
||||
@@ -418,6 +422,9 @@ 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 }
|
||||
|
||||
// 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.
|
||||
func (c *Conn) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) {
|
||||
|
||||
Reference in New Issue
Block a user