diff --git a/async_postgres/pg_client.nim b/async_postgres/pg_client.nim index 642a95e..61f02dc 100644 --- a/async_postgres/pg_client.nim +++ b/async_postgres/pg_client.nim @@ -2485,7 +2485,7 @@ proc closeCursorImpl( cursor.exhausted = true -proc closeCursor*(cursor: Cursor): Future[void] {.async.} = +proc close*(cursor: Cursor): Future[void] {.async.} = ## Close the cursor and return the connection to ready state. ## On timeout, the connection is marked csClosed (protocol out of sync). if cursor.timeout > ZeroDuration: @@ -2512,7 +2512,7 @@ template withCursor*( try: body finally: - await cursorName.closeCursor() + await cursorName.close() proc openCursor*( conn: PgConnection, diff --git a/tests/test_e2e.nim b/tests/test_e2e.nim index f61b57f..d025e86 100644 --- a/tests/test_e2e.nim +++ b/tests/test_e2e.nim @@ -2129,7 +2129,7 @@ suite "E2E: Cursor/Streaming": waitFor t() - test "mid-stream closeCursor returns conn to ready": + test "mid-stream close returns conn to ready": proc t() {.async.} = let conn = await connect(plainConfig()) discard await conn.exec("DROP TABLE IF EXISTS test_cursor_close") @@ -2145,7 +2145,7 @@ suite "E2E: Cursor/Streaming": let chunk1 = await cursor.fetchNext() doAssert chunk1.len == 10 - await cursor.closeCursor() + await cursor.close() doAssert conn.state == csReady # Connection is usable after closing cursor mid-stream @@ -2498,7 +2498,7 @@ suite "E2E: Cursor/Streaming": waitFor t() - test "closeCursor on already exhausted cursor": + test "close on already exhausted cursor": proc t() {.async.} = let conn = await connect(plainConfig()) let cursor = await conn.openCursor("SELECT 1 AS x", chunkSize = 10) @@ -2506,8 +2506,8 @@ suite "E2E: Cursor/Streaming": doAssert chunk.len == 1 doAssert cursor.exhausted - # closeCursor on exhausted cursor should be safe no-op - await cursor.closeCursor() + # close on exhausted cursor should be safe no-op + await cursor.close() doAssert conn.state == csReady let res = await conn.query("SELECT 2 AS y")