2016-09-14 16:27:39 +02:00
|
|
|
<?php declare(strict_types = 1);
|
|
|
|
|
|
|
|
namespace Amp\Postgres;
|
|
|
|
|
2016-11-15 18:06:21 +01:00
|
|
|
use Interop\Async\Promise;
|
2016-09-14 16:27:39 +02:00
|
|
|
|
|
|
|
interface Executor {
|
|
|
|
/**
|
|
|
|
* @param string $sql
|
|
|
|
*
|
2016-11-15 18:06:21 +01:00
|
|
|
* @return \Interop\Async\Promise<\Amp\Postgres\Result>
|
2016-09-14 16:27:39 +02:00
|
|
|
*
|
|
|
|
* @throws \Amp\Postgres\FailureException
|
|
|
|
*/
|
2016-11-15 18:06:21 +01:00
|
|
|
public function query(string $sql): Promise;
|
2016-09-14 16:27:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $sql
|
|
|
|
* @param mixed ...$params
|
|
|
|
*
|
2016-11-15 18:06:21 +01:00
|
|
|
* @return \Interop\Async\Promise<\Amp\Postgres\Result>
|
2016-09-14 16:27:39 +02:00
|
|
|
*
|
|
|
|
* @throws \Amp\Postgres\FailureException
|
|
|
|
*/
|
2016-11-15 18:06:21 +01:00
|
|
|
public function execute(string $sql, ...$params): Promise;
|
2016-09-14 16:27:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $sql
|
|
|
|
*
|
2016-11-15 18:06:21 +01:00
|
|
|
* @return \Interop\Async\Promise<\Amp\Postgres\Statement>
|
2016-09-14 16:27:39 +02:00
|
|
|
*
|
|
|
|
* @throws \Amp\Postgres\FailureException
|
|
|
|
*/
|
2016-11-15 18:06:21 +01:00
|
|
|
public function prepare(string $sql): Promise;
|
2016-09-21 07:18:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $channel Channel name.
|
|
|
|
* @param string $payload Notification payload.
|
|
|
|
*
|
2016-11-15 18:06:21 +01:00
|
|
|
* @return \Interop\Async\Promise<\Amp\Postgres\CommandResult>
|
2016-09-21 07:18:24 +02:00
|
|
|
*/
|
2016-11-15 18:06:21 +01:00
|
|
|
public function notify(string $channel, string $payload = ""): Promise;
|
2016-09-14 16:27:39 +02:00
|
|
|
}
|