1 | <?php |
||
26 | final class Space |
||
27 | { |
||
28 | public const VSPACE_ID = 281; |
||
29 | public const VINDEX_ID = 289; |
||
30 | |||
31 | private $client; |
||
32 | private $id; |
||
33 | private $indexes = []; |
||
34 | |||
35 | 130 | public function __construct(Client $client, int $id) |
|
40 | |||
41 | 6 | public function getId() : int |
|
45 | |||
46 | 128 | public function select(array $key = [], $index = 0, int $limit = \PHP_INT_MAX &0xffffffff, int $offset = 0, int $iteratorType = IteratorTypes::EQ) : array |
|
47 | { |
||
48 | 128 | if (\is_string($index)) { |
|
49 | 30 | $index = $this->getIndexIdByName($index); |
|
50 | } |
||
51 | |||
52 | 128 | $request = new Select($this->id, $index, $key, $offset, $limit, $iteratorType); |
|
53 | |||
54 | 128 | return $this->client->sendRequest($request)->getBodyField(IProto::DATA); |
|
55 | } |
||
56 | |||
57 | 32 | public function insert(array $values) : array |
|
58 | { |
||
59 | 32 | $request = new Insert($this->id, $values); |
|
60 | |||
61 | 32 | return $this->client->sendRequest($request)->getBodyField(IProto::DATA); |
|
62 | } |
||
63 | |||
64 | 2 | public function replace(array $values) : array |
|
70 | |||
71 | 28 | public function update(array $key, array $operations, $index = 0) : array |
|
81 | |||
82 | 2 | public function upsert(array $values, array $operations) : array |
|
88 | |||
89 | 8 | public function delete(array $key, $index = 0) : array |
|
90 | { |
||
99 | |||
100 | 4 | public function flushIndexes() : void |
|
104 | |||
105 | 36 | private function getIndexIdByName(string $indexName) : int |
|
120 | } |
||
121 |