MCPcopy
hub / github.com/jackc/pgx / Conn

Struct Conn

stdlib/sql.go:405–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405type Conn struct {
406 conn *pgx.Conn
407 close func(context.Context) error
408 driver *Driver
409 connConfig pgx.ConnConfig
410 resetSessionFunc func(context.Context, *pgx.Conn) error // Function is called before a connection is reused
411 shouldPing func(context.Context, ShouldPingParams) bool // Function to decide if stdlib should ping before reusing a connection
412 lastResetSessionTime time.Time
413
414 // psRefCounts contains reference counts for prepared statements. Prepare uses the underlying pgx logic to generate
415 // deterministic statement names from the statement text. If this query has already been prepared then the existing
416 // *pgconn.StatementDescription will be returned. However, this means that if Close is called on the returned Stmt
417 // then the underlying prepared statement will be closed even when the underlying prepared statement is still in use
418 // by another database/sql Stmt. To prevent this psRefCounts keeps track of how many database/sql statements are using
419 // the same underlying statement and only closes the underlying statement when the reference count reaches 0.
420 psRefCounts map[*pgconn.StatementDescription]int
421}
422
423// Conn returns the underlying *pgx.Conn
424func (c *Conn) Conn() *pgx.Conn {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected