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

Method Ping

pgxpool/pool.go:833–840  ·  view source on GitHub ↗

Ping acquires a connection from the [Pool] and executes an empty sql statement against it. If the sql returns without error, the database [Pool.Ping] is considered successful, otherwise, the error is returned.

(ctx context.Context)

Source from the content-addressed store, hash-verified

831// Ping acquires a connection from the [Pool] and executes an empty sql statement against it.
832// If the sql returns without error, the database [Pool.Ping] is considered successful, otherwise, the error is returned.
833func (p *Pool) Ping(ctx context.Context) error {
834 c, err := p.Acquire(ctx)
835 if err != nil {
836 return err
837 }
838 defer c.Release()
839 return c.Ping(ctx)
840}

Callers 1

AcquireMethod · 0.45

Calls 2

AcquireMethod · 0.95
ReleaseMethod · 0.80

Tested by

no test coverage detected