Close closes a connection. It is safe to call Close on an already closed connection.
(ctx context.Context)
| 299 | // Close closes a connection. It is safe to call Close on an already closed |
| 300 | // connection. |
| 301 | func (c *Conn) Close(ctx context.Context) error { |
| 302 | if c.IsClosed() { |
| 303 | return nil |
| 304 | } |
| 305 | |
| 306 | err := c.pgConn.Close(ctx) |
| 307 | return err |
| 308 | } |
| 309 | |
| 310 | // Prepare creates a prepared statement with name and sql. sql can contain placeholders for bound parameters. These |
| 311 | // placeholders are referenced positionally as $1, $2, etc. name can be used instead of sql with [Conn.Query], |