final class PgSqlConflictTarget
Public API: explicitly declared with @visibility public.

Structured ON CONFLICT arbiter target.

Represent a column-based conflict targetdoctest
$target = new \ZtdQuery\Platform\Postgres\Sql\Conflict\PgSqlConflictTarget(true, ['id']);
    $target->columns // => ['id']
    $target->constraint // => null

Properties§

public bool $specified
public array<int, string> $columns = []
public ?string $predicate = null
public ?string $constraint = null

Methods§

public function __construct(
    public bool $specified,
    public array<int, string> $columns = [],
    public ?string $predicate = null,
    public ?string $constraint = null,
)

Parameters

$specifiedbool
$columnsarray<int, string>
$predicate?string
$constraint?string

Throws

InvalidArgumentException
Calls 1
  • new InvalidArgumentException line 34
public function resolve(
    CandidateKeySet $candidateKeys,
    array<string, PartialUniqueIndex> $partialIndexes,
    string $sql,
): array{keys: CandidateKeySet, predicate: string|null}
Public API: explicitly declared with @visibility public.

Parameters

$candidateKeysCandidateKeySet
$partialIndexesarray<string, PartialUniqueIndex>
$sqlstring

Returns

array{keys: CandidateKeySet, predicate: string|null}
Resolve a conflict target against the catalog's candidate keysdoctest
$target = new \ZtdQuery\Platform\Postgres\Sql\Conflict\PgSqlConflictTarget(true, ['id']);
    $keys = new \ZtdQuery\Schema\Key\CandidateKeySet(['users_pkey' => ['id'], 'users_email_key' => ['email']]);
    $resolved = $target->resolve($keys, [], 'INSERT INTO users VALUES (1) ON CONFLICT (id) DO NOTHING');
    $resolved['keys']->keys() // => ['users_pkey' => ['id']]
    $resolved['predicate'] // => null
Test cases 6
Calls 6

Test cases 26§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 6
Other tests reaching this symbol 20

Relations§

Instantiated in 3
Type declarations 4