diff --git a/src/Connection.php b/src/Connection.php new file mode 100644 index 0000000..75d22d3 --- /dev/null +++ b/src/Connection.php @@ -0,0 +1,19 @@ + + */ +interface Connection extends Link +{ + /** + * @return TConfig The configuration used to create this connection. + */ + public function getConfig(): SqlConfig; +} diff --git a/src/Pool.php b/src/Pool.php index e47d665..f840112 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -6,6 +6,7 @@ * @template TResult of Result * @template TStatement of Statement * @template TTransaction of Transaction + * @template TConfig of SqlConfig * * @extends Link */ @@ -15,9 +16,9 @@ interface Pool extends Link * Gets a single connection from the pool to run a set of queries against a single connection. * Generally a transaction should be used instead of this method. * - * @return Link + * @return Connection */ - public function extractConnection(): Link; + public function extractConnection(): Connection; /** * @return int Total number of active connections in the pool. diff --git a/src/SqlConnector.php b/src/SqlConnector.php index 28366f3..01cb696 100644 --- a/src/SqlConnector.php +++ b/src/SqlConnector.php @@ -6,7 +6,7 @@ /** * @template TConfig of SqlConfig - * @template TLink of Link + * @template TConnection of Connection */ interface SqlConnector { @@ -16,9 +16,9 @@ interface SqlConnector * * @param TConfig $config * - * @return TLink + * @return TConnection * * @throws ConnectionException */ - public function connect(SqlConfig $config, ?Cancellation $cancellation = null): Link; + public function connect(SqlConfig $config, ?Cancellation $cancellation = null): Connection; }