packages/sql-semantics-postgres/src/Model/Statement/Shape/UniqueField.php

1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\PostgreSql\Model\Statement\Shape;
6
7use SqlSemantics\Platform\PostgreSql\Model\Statement\Snapshot;
8
9/**
10 * Exactly one output field has the looked-up name.
11 *
12 * @visibility public
13 * @example Finding the only field with a name
14 *     $operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 AS a');
15 *     $operation->lookupField('a')->field->position // => 0
16 */
17final class UniqueField implements FieldLookup
18{
19    use Snapshot;
20
21    /**
22     * @param Field $field The field
23     */
24    public function __construct(public readonly Field $field)
25    {
26    }
27}
28