-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathClickHouseClient.php
More file actions
157 lines (145 loc) · 4.17 KB
/
ClickHouseClient.php
File metadata and controls
157 lines (145 loc) · 4.17 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?php
declare(strict_types=1);
namespace SimPod\ClickHouseClient\Client;
use Psr\Http\Client\ClientExceptionInterface;
use Psr\Http\Message\StreamInterface;
use SimPod\ClickHouseClient\Exception\CannotInsert;
use SimPod\ClickHouseClient\Exception\ServerError;
use SimPod\ClickHouseClient\Exception\UnsupportedParamType;
use SimPod\ClickHouseClient\Exception\UnsupportedParamValue;
use SimPod\ClickHouseClient\Format\Format;
use SimPod\ClickHouseClient\Output\Output;
use SimPod\ClickHouseClient\Schema\Table;
use SimPod\ClickHouseClient\Settings\EmptySettingsProvider;
use SimPod\ClickHouseClient\Settings\SettingsProvider;
/** @phpstan-import-type Settings from SettingsProvider */
interface ClickHouseClient
{
/**
* @throws ClientExceptionInterface
* @throws ServerError
*/
public function executeQuery(string $query, SettingsProvider $settings = new EmptySettingsProvider()): void;
/**
* @param array<string, mixed> $params
*
* @throws ClientExceptionInterface
* @throws ServerError
* @throws UnsupportedParamType
* @throws UnsupportedParamValue
*/
public function executeQueryWithParams(
string $query,
array $params,
SettingsProvider $settings = new EmptySettingsProvider(),
): void;
/**
* @param Format<O> $outputFormat
*
* @return O
*
* @throws ClientExceptionInterface
* @throws ServerError
*
* @template O of Output
*/
public function select(
string $query,
Format $outputFormat,
SettingsProvider $settings = new EmptySettingsProvider(),
): Output;
/**
* @param array<string, mixed> $params
* @param Format<O> $outputFormat
*
* @return O
*
* @throws ClientExceptionInterface
* @throws ServerError
* @throws UnsupportedParamType
* @throws UnsupportedParamValue
*
* @template O of Output
*/
public function selectWithParams(
string $query,
array $params,
Format $outputFormat,
SettingsProvider $settings = new EmptySettingsProvider(),
): Output;
/**
* @param Format<O> $outputFormat
*
* @throws ClientExceptionInterface
* @throws ServerError
*
* @template O of Output
*/
public function selectStream(
string $query,
Format $outputFormat,
SettingsProvider $settings = new EmptySettingsProvider(),
): StreamInterface;
/**
* @param array<string, mixed> $params
* @param Format<O> $outputFormat
*
* @throws ClientExceptionInterface
* @throws ServerError
* @throws UnsupportedParamType
* @throws UnsupportedParamValue
*
* @template O of Output
*/
public function selectStreamWithParams(
string $query,
array $params,
Format $outputFormat,
SettingsProvider $settings = new EmptySettingsProvider(),
): StreamInterface;
/**
* @param array<array<mixed>> $values
* @param list<string>|array<string, string>|null $columns
*
* @throws CannotInsert
* @throws ClientExceptionInterface
* @throws ServerError
* @throws UnsupportedParamType
* @throws UnsupportedParamValue
*/
public function insert(
Table|string $table,
array $values,
array|null $columns = null,
SettingsProvider $settings = new EmptySettingsProvider(),
): void;
/**
* @param Format<O> $inputFormat
*
* @throws ClientExceptionInterface
* @throws ServerError
*
* @template O of Output
*/
public function insertWithFormat(
Table|string $table,
Format $inputFormat,
string $data,
SettingsProvider $settings = new EmptySettingsProvider(),
): void;
/**
* @param list<string> $columns
* @param Format<Output<mixed>> $inputFormat
*
* @throws ClientExceptionInterface
* @throws CannotInsert
* @throws ServerError
*/
public function insertPayload(
Table|string $table,
Format $inputFormat,
StreamInterface $payload,
array $columns = [],
SettingsProvider $settings = new EmptySettingsProvider(),
): void;
}