Skip to content

Commit

Permalink
rename the func to __simpleQuery for now
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiBM committed Aug 25, 2024
1 parent 94eeb8a commit d8d8abb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Sources/PostgresNIO/Connection/PostgresConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ extension PostgresConnection {
}
}

/// Run a query on the Postgres server the connection is connected to.
/// Run a simple text-only query on the Postgres server the connection is connected to.
/// WARNING: This functions is not yet API and is incomplete.
/// The return type will change to another stream.
///
/// - Parameters:
/// - query: The simple query to run
Expand All @@ -448,7 +450,7 @@ extension PostgresConnection {
/// - Returns: A ``PostgresRowSequence`` containing the rows the server sent as the query result.
/// The sequence be discarded.
@discardableResult
public func simpleQuery(
public func __simpleQuery(
_ query: String,
logger: Logger,
file: String = #fileID,
Expand Down
4 changes: 2 additions & 2 deletions Tests/IntegrationTests/AsyncTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class AsyncPostgresConnectionTests: XCTestCase {

try await withTestConnection(on: eventLoop) { connection in
for _ in 0..<1_000 {
let rows = try await connection.simpleQuery("SELECT version()", logger: .psqlTest)
let rows = try await connection.__simpleQuery("SELECT version()", logger: .psqlTest)
var iterator = rows.makeAsyncIterator()
let firstRow = try await iterator.next()
XCTAssertEqual(try firstRow?.decode(String.self, context: .default).contains("PostgreSQL"), true)
Expand All @@ -50,7 +50,7 @@ final class AsyncPostgresConnectionTests: XCTestCase {
try await withTestConnection(on: eventLoop) { connection in
for _ in 0..<1_000 {
let nonExistentOID = 1928394819
let rows = try await connection.simpleQuery("SELECT * FROM pg_class WHERE oid = \(nonExistentOID)", logger: .psqlTest)
let rows = try await connection.__simpleQuery("SELECT * FROM pg_class WHERE oid = \(nonExistentOID)", logger: .psqlTest)
var iterator = rows.makeAsyncIterator()
let first = try await iterator.next()
XCTAssertEqual(first, nil)
Expand Down

0 comments on commit d8d8abb

Please sign in to comment.