Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
d0ce9e47af | |||
b2088df8fb | |||
cb1388722c | |||
![]() |
11be80b0ad | ||
![]() |
48a8908afd | ||
![]() |
8f5f5b44de | ||
![]() |
8e7972d933 |
2
.gitignore
vendored
Normal file → Executable file
2
.gitignore
vendored
Normal file → Executable file
@@ -1 +1,3 @@
|
||||
vendor
|
||||
composer.lock
|
||||
!.gitignore
|
||||
|
11
LICENSE
Normal file
11
LICENSE
Normal file
@@ -0,0 +1,11 @@
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# PHP 8.2 Framework for working with ArangoDB
|
||||
|
||||
🤟 Very simple and flexible, easy to scale and integrate
|
2
composer.json
Normal file → Executable file
2
composer.json
Normal file → Executable file
@@ -28,7 +28,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"php": "^8.2",
|
||||
"triagens/arangodb": "~3.8"
|
||||
},
|
||||
"require-dev": {
|
||||
|
2098
composer.lock
generated
2098
composer.lock
generated
File diff suppressed because it is too large
Load Diff
21
mirzaev/arangodb/system/collection.php
Normal file → Executable file
21
mirzaev/arangodb/system/collection.php
Normal file → Executable file
@@ -68,29 +68,36 @@ class collection
|
||||
*
|
||||
* @param _connection $session Сессия соединения с базой данных
|
||||
* @param string $query AQL-запрос
|
||||
* @param array $binds Binds for query [bind => value]
|
||||
*
|
||||
* @return _document|null Инстанция документа
|
||||
* @return _document|array|string|int|null Инстанция документа
|
||||
*/
|
||||
public static function search(_connection $session, string $query): ?_document
|
||||
public static function search(_connection $session, string $query, array $binds = []): _document|string|array|int|null
|
||||
{
|
||||
// Поиск журнала
|
||||
$journal = (new _statement(
|
||||
// Statement instance initialization
|
||||
$instance = new _statement(
|
||||
$session,
|
||||
[
|
||||
'query' => $query,
|
||||
"batchSize" => 1000,
|
||||
"sanitize" => true
|
||||
]
|
||||
))->execute();
|
||||
);
|
||||
|
||||
// Binds application
|
||||
$instance->bind($binds);
|
||||
|
||||
// Sending the request
|
||||
$response = $instance->execute();
|
||||
|
||||
// Инициализация буфера вывода
|
||||
$buffer = [];
|
||||
|
||||
foreach ($journal as $key => $value) {
|
||||
foreach ($response->getAll() as $key => $value) {
|
||||
$buffer[$key] = $value;
|
||||
}
|
||||
|
||||
return $buffer[0] ?? null;
|
||||
return is_array($buffer) && count($buffer) > 1 ? $buffer : $buffer[0] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
0
mirzaev/arangodb/system/connection.php
Normal file → Executable file
0
mirzaev/arangodb/system/connection.php
Normal file → Executable file
8
mirzaev/arangodb/system/document.php
Normal file → Executable file
8
mirzaev/arangodb/system/document.php
Normal file → Executable file
@@ -61,7 +61,10 @@ class document
|
||||
$document = new _document();
|
||||
}
|
||||
|
||||
foreach (['created' => time()] + $data as $key => $value) {
|
||||
// Инициализация даты создания
|
||||
$created = time();
|
||||
|
||||
foreach (['created' => $created, 'updated' => $created] + $data as $key => $value) {
|
||||
// Перебор параметров
|
||||
|
||||
// Запись в инстанцию документа
|
||||
@@ -102,6 +105,9 @@ class document
|
||||
// Инициализация обработчика вершин
|
||||
$documents = new _document_handler($session);
|
||||
|
||||
// Запись даты обновления в инстанцию документа
|
||||
$document->set('updated', time());
|
||||
|
||||
// Запись в базу данных
|
||||
return $documents->update($document);
|
||||
}
|
||||
|
0
mirzaev/arangodb/system/terminal.php
Normal file → Executable file
0
mirzaev/arangodb/system/terminal.php
Normal file → Executable file
Reference in New Issue
Block a user