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

Method Ping

stdlib/sql.go:532–546  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

530}
531
532func (c *Conn) Ping(ctx context.Context) error {
533 if c.conn.IsClosed() {
534 return driver.ErrBadConn
535 }
536
537 err := c.conn.Ping(ctx)
538 if err != nil {
539 // A Ping failure implies some sort of fatal state. The connection is almost certainly already closed by the
540 // failure, but manually close it just to be sure.
541 c.Close()
542 return driver.ErrBadConn
543 }
544
545 return nil
546}
547
548func (c *Conn) CheckNamedValue(*driver.NamedValue) error {
549 // Underlying pgx supports sql.Scanner and driver.Valuer interfaces natively. So everything can be passed through directly.

Callers 3

ResetSessionMethod · 0.45

Calls 2

CloseMethod · 0.95
IsClosedMethod · 0.45

Tested by 2