query and graph

This commit is contained in:
2024-03-23 21:12:07 +02:00
parent b8efa5f586
commit c649077e37
33 changed files with 4335 additions and 908 deletions
+15 -18
View File
@@ -2,21 +2,23 @@
namespace Lucent\Record;
use Lucent\LucentException;
use Lucent\Edge\Edge;
use Lucent\Support\Collection;
use PhpOption\Option;
class QueryRecord
{
/**
* @param Record $record
* @param Option<Edge> $edge
* @param Collection<QueryRecord> $_children
* @param Collection<QueryRecord> $_parents
*/
function __construct(
public string $id,
public string $schema,
public Status $status,
public System $_sys,
public RecordData $data,
public bool $isRoot,
public ?File $_file = null,
public array $_children = [],
public array $_parents = [],
public Record $record,
public Option $edge,
public Collection $_children = new Collection(),
public Collection $_parents = new Collection(),
)
{
}
@@ -24,13 +26,8 @@ class QueryRecord
public static function fromRecord(Record $record): QueryRecord
{
return new QueryRecord(
id: $record->id,
schema: $record->schema,
status: $record->status,
_sys: $record->_sys,
data: $record->data,
isRoot: false,
_file: $record->_file,
record: $record,
edge: none(),
);
}
}