From 8097ab3f92c607a423dc57ee9e85948b3d650f61 Mon Sep 17 00:00:00 2001 From: Daniel Widgren Date: Thu, 26 Mar 2026 08:32:52 +0100 Subject: [PATCH] fix: improve type specs for downstream type checkers - Export additional types: pool/0, row/0, options/0, decode_option/0 - Fix result() type: rows field uses [row()] instead of list() - Fix result() type: num_rows uses non_neg_integer() instead of integer() - Fix checkout/checkin specs: use pgo_pool:ref() (was pool_ref/0 which doesn't exist) --- src/pgo.erl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pgo.erl b/src/pgo.erl index b2aab52..c08b5ef 100644 --- a/src/pgo.erl +++ b/src/pgo.erl @@ -29,12 +29,16 @@ -export_type([result/0, error/0, + pool/0, + row/0, + options/0, pool_config/0, - decode_fun/0]). + decode_fun/0, + decode_option/0]). -type result() :: #{command := atom(), - num_rows := integer() | table, - rows := list()} | {error, error()} | {error, any()}. + num_rows := non_neg_integer() | table, + rows := [row()]} | {error, error()} | {error, any()}. -type error() :: {pgo_error, #{error_field() => binary()}} | pg_types:encoding_error(). @@ -219,16 +223,16 @@ with_conn(Conn, Fun) -> end. %% @doc Returns a connection from the pool. --spec checkout(atom()) -> {ok, pgo_pool:pool_ref(), pgo_pool:conn()} | {error, any()}. +-spec checkout(atom()) -> {ok, pgo_pool:ref(), pgo_pool:conn()} | {error, any()}. checkout(Pool) -> pgo_pool:checkout(Pool, []). --spec checkout(atom(), [pool_option()]) -> {ok, pgo_pool:pool_ref(), pgo_pool:conn()} | {error, any()}. +-spec checkout(atom(), [pool_option()]) -> {ok, pgo_pool:ref(), pgo_pool:conn()} | {error, any()}. checkout(Pool, Options) -> pgo_pool:checkout(Pool, Options). %% @doc Return a checked out connection to its pool --spec checkin(pgo_pool:pool_ref(), pgo_pool:conn()) -> ok. +-spec checkin(pgo_pool:ref(), pgo_pool:conn()) -> ok. checkin(Ref, Conn) -> pgo_pool:checkin(Ref, Conn, []).