/
ClickHouseClientAdapterInterface.php
63 lines (57 loc) · 1.83 KB
/
ClickHouseClientAdapterInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace Borislav\Clickhouse\Client\Adapter\Interfaces;
use Borislav\Clickhouse\Client\Response\Interfaces\ClickHouseResponseInterface;
use Borislav\Clickhouse\Client\Response\Interfaces\ClickHouseSyncResponseInterface;
use Borislav\Clickhouse\Exception\ClickHouseBadRequestException;
use Borislav\Clickhouse\Exception\ClickHouseConfigNotFoundException;
use Borislav\Clickhouse\Exception\ClickHouseTransportException;
interface ClickHouseClientAdapterInterface
{
/**
* @param string $sql
* @param array $params
*
* @return ClickHouseResponseInterface
*
* @throws ClickHouseConfigNotFoundException
* @throws ClickHouseTransportException
*/
public function select(string $sql, array $params = []): ClickHouseResponseInterface;
/**
* @param string $table
* @param array $values
* @param array|null $columns
*
* @return ClickHouseResponseInterface
*
* @throws ClickHouseConfigNotFoundException
* @throws ClickHouseTransportException
*/
public function insert(string $table, array $values, array|null $columns = null): ClickHouseResponseInterface;
/**
* If $isAwaitableQuery === false, then @see ClickHouseResponseInterface
* else @see ClickHouseSyncResponseInterface
*
* @param string $sql
* @param array $params
* @param bool $isAwaitableQuery
*
* @return ClickHouseResponseInterface|ClickHouseSyncResponseInterface
*
* @throws ClickHouseBadRequestException
* @throws ClickHouseConfigNotFoundException
* @throws ClickHouseTransportException
*/
public function query(
string $sql,
array $params = [],
bool $isAwaitableQuery = false
): ClickHouseResponseInterface|ClickHouseSyncResponseInterface;
/**
* @return bool
*
* @throws ClickHouseConfigNotFoundException
* @throws ClickHouseTransportException
*/
public function ping(): bool;
}