2022-08-23 15:18:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Database\Validator\Queries;
|
|
|
|
|
|
2023-02-20 06:29:25 +00:00
|
|
|
use Appwrite\Utopia\Database\Validator\Queries;
|
2022-08-23 16:33:08 +00:00
|
|
|
use Appwrite\Utopia\Database\Validator\Query\Cursor;
|
|
|
|
|
use Appwrite\Utopia\Database\Validator\Query\Filter;
|
2023-02-20 06:29:25 +00:00
|
|
|
use Appwrite\Utopia\Database\Validator\Query\Limit;
|
|
|
|
|
use Appwrite\Utopia\Database\Validator\Query\Offset;
|
2022-08-23 16:33:08 +00:00
|
|
|
use Appwrite\Utopia\Database\Validator\Query\Order;
|
2023-03-22 21:10:47 +00:00
|
|
|
use Appwrite\Utopia\Database\Validator\Query\Select;
|
2022-08-23 16:33:08 +00:00
|
|
|
use Utopia\Database\Database;
|
|
|
|
|
use Utopia\Database\Document;
|
2022-08-23 15:18:59 +00:00
|
|
|
|
2023-02-20 06:29:25 +00:00
|
|
|
class Documents extends Queries
|
2022-08-23 15:18:59 +00:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Expression constructor
|
|
|
|
|
*
|
2022-08-23 16:33:08 +00:00
|
|
|
* @param Document[] $attributes
|
2023-02-20 06:29:25 +00:00
|
|
|
* @throws \Exception
|
2022-08-23 15:18:59 +00:00
|
|
|
*/
|
2023-02-20 06:29:25 +00:00
|
|
|
public function __construct(array $attributes)
|
2022-08-23 15:18:59 +00:00
|
|
|
{
|
2022-08-24 10:31:47 +00:00
|
|
|
$attributes[] = new Document([
|
|
|
|
|
'key' => '$id',
|
|
|
|
|
'type' => Database::VAR_STRING,
|
|
|
|
|
'array' => false,
|
|
|
|
|
]);
|
|
|
|
|
$attributes[] = new Document([
|
|
|
|
|
'key' => '$createdAt',
|
|
|
|
|
'type' => Database::VAR_DATETIME,
|
|
|
|
|
'array' => false,
|
|
|
|
|
]);
|
|
|
|
|
$attributes[] = new Document([
|
|
|
|
|
'key' => '$updatedAt',
|
|
|
|
|
'type' => Database::VAR_DATETIME,
|
|
|
|
|
'array' => false,
|
|
|
|
|
]);
|
|
|
|
|
|
2022-08-23 16:33:08 +00:00
|
|
|
$validators = [
|
|
|
|
|
new Limit(),
|
|
|
|
|
new Offset(),
|
|
|
|
|
new Cursor(),
|
|
|
|
|
new Filter($attributes),
|
|
|
|
|
new Order($attributes),
|
2023-03-23 04:59:23 +00:00
|
|
|
new Select($attributes),
|
2022-08-23 16:33:08 +00:00
|
|
|
];
|
|
|
|
|
|
2023-02-20 06:29:25 +00:00
|
|
|
parent::__construct(...$validators);
|
2022-08-23 15:18:59 +00:00
|
|
|
}
|
|
|
|
|
}
|