-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
230 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimPod\ClickHouseClient\Client\Http; | ||
|
||
final class RequestSettings | ||
{ | ||
/** @var array<string, float|int|string> */ | ||
public array $settings; | ||
|
||
/** | ||
* @param array<string, float|int|string> $defaultSettings | ||
* @param array<string, float|int|string> $querySettings | ||
*/ | ||
public function __construct( | ||
array $defaultSettings, | ||
array $querySettings, | ||
) { | ||
$this->settings = $querySettings + $defaultSettings; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimPod\ClickHouseClient\Format; | ||
|
||
use SimPod\ClickHouseClient\Output\Basic; | ||
use SimPod\ClickHouseClient\Output\Output; | ||
|
||
/** | ||
* @template T | ||
* @implements Format<Basic<T>> | ||
*/ | ||
final class RowBinary implements Format | ||
{ | ||
public static function output(string $contents): Output | ||
{ | ||
/** @var Basic<T> $output */ | ||
$output = new Basic($contents); | ||
|
||
return $output; | ||
} | ||
|
||
public static function toSql(): string | ||
{ | ||
return 'FORMAT RowBinary'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimPod\ClickHouseClient\Tests\Client\Http; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use SimPod\ClickHouseClient\Client\Http\RequestSettings; | ||
use SimPod\ClickHouseClient\Tests\TestCaseBase; | ||
|
||
#[CoversClass(RequestSettings::class)] | ||
final class RequestSettingsTest extends TestCaseBase | ||
{ | ||
public function testMergeSettings(): void | ||
{ | ||
$requestSettings = new RequestSettings( | ||
['database' => 'foo', 'a' => 1], | ||
['database' => 'bar', 'b' => 2], | ||
); | ||
|
||
self::assertSame('bar', $requestSettings->settings['database']); | ||
self::assertSame(1, $requestSettings->settings['a']); | ||
self::assertSame(2, $requestSettings->settings['b']); | ||
} | ||
} |
Oops, something went wrong.