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)
| 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. |
| 833 | func (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 | } |