| 87 | } |
| 88 | |
| 89 | type BatchResults interface { |
| 90 | // Exec reads the results from the next query in the batch as if the query has been sent with [Conn.Exec]. Prefer |
| 91 | // calling Exec on the QueuedQuery, or just calling Close. |
| 92 | Exec() (pgconn.CommandTag, error) |
| 93 | |
| 94 | // Query reads the results from the next query in the batch as if the query has been sent with [Conn.Query]. Prefer |
| 95 | // calling [QueuedQuery.Query]. |
| 96 | Query() (Rows, error) |
| 97 | |
| 98 | // QueryRow reads the results from the next query in the batch as if the query has been sent with [Conn.QueryRow]. |
| 99 | // Prefer calling [QueuedQuery.QueryRow]. |
| 100 | QueryRow() Row |
| 101 | |
| 102 | // Close closes the batch operation. All unread results are read and any callback functions registered with |
| 103 | // [QueuedQuery.Query], [QueuedQuery.QueryRow], or [QueuedQuery.Exec] will be called. If a callback function returns an |
| 104 | // error or the batch encounters an error subsequent callback functions will not be called. |
| 105 | // |
| 106 | // For simple batch inserts inside a transaction or similar queries, it's sufficient to not set any callbacks, |
| 107 | // and just handle the return value of Close. |
| 108 | // |
| 109 | // Close must be called before the underlying connection can be used again. Any error that occurred during a batch |
| 110 | // operation may have made it impossible to resyncronize the connection with the server. In this case the underlying |
| 111 | // connection will have been closed. |
| 112 | // |
| 113 | // Close is safe to call multiple times. If it returns an error subsequent calls will return the same error. Callback |
| 114 | // functions will not be rerun. |
| 115 | Close() error |
| 116 | } |
| 117 | |
| 118 | type batchResults struct { |
| 119 | ctx context.Context |
no outgoing calls
no test coverage detected