Skip to content

Commit 9a751cf

Browse files
authoredJan 21, 2025
export query/4 to support manually passing connection (#95)
* export query/4 to support manually passing connection * add changelog entry for export/4
1 parent 7f39da0 commit 9a751cf

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
 

‎CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
- Support unix domain socket host names
88
[#90](https://github.com/erleans/pgo/pull/90)
9+
- Export `pgo:query/4` to support passing a connection directly to `query`
10+
[#95](https://github.com/erleans/pgo/pull/95)
911

1012
### Fixed
1113

‎src/pgo.erl

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
query/1,
1414
query/2,
1515
query/3,
16+
query/4,
1617
transaction/1,
1718
transaction/2,
1819
transaction/3,

‎test/pgo_basic_SUITE.erl

+11-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ cases() ->
2222
rows_as_maps, json_jsonb, types,
2323
int4_range, ts_range, tstz_range, numerics,
2424
hstore, records, circle, path, polygon, line,
25-
line_segment, tid, bit_string, arrays, tsvector].
25+
line_segment, tid, bit_string, arrays, tsvector,
26+
query_arity_4].
2627

2728
init_per_suite(Config) ->
2829
application:load(pg_types),
@@ -437,3 +438,12 @@ tsvector(_Config) ->
437438
pgo:query("SELECT $1::tsvector", [[{<<"a">>,[{1,'A'}]},
438439
{<<"cat">>,[{5,null}]},
439440
{<<"fat">>,[{2,'B'},{4,'C'}]}]])).
441+
442+
query_arity_4(_Config) ->
443+
{ok, Ref, Conn} = pgo:checkout(default),
444+
445+
?assertMatch(#{rows := [{1}]}, pgo:query("select 1", [], #{}, Conn)),
446+
447+
pgo:checkin(Ref, Conn),
448+
449+
ok.

0 commit comments

Comments
 (0)