classCreateOperatorClass
final class CreateOperatorClass
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.CREATE OPERATOR CLASS name [DEFAULT] FOR TYPE type USING method [FAMILY family] AS item, ...: defines an operator class.
Mirrors PostgreSQL's CreateOpClassStmt and CreateOpClassItem. Source: https://www.postgresql.org/docs/17/sql-createopclass.html.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE OPERATOR CLASS c DEFAULT FOR TYPE int4 USING btree AS OPERATOR 1 <, FUNCTION 1 btint4cmp(int4, int4)');
[$operation->statement->method->value, $operation->statement->isDefault, count($operation->statement->items)] // => ['btree', true, 2]Properties§
public non-empty-list<OperatorClassItem> $itemspublic DottedName $namepublic TypeName $typepublic Name $methodpublic bool $isDefault = falsepublic DottedName|null $family = nullMethods§
public function __construct(
public DottedName $name,
public TypeName $type,
public Name $method,
list<OperatorClassItem> $items,
public bool $isDefault = false,
public DottedName|null $family = null,
)Parameters
$name | DottedName | The class name |
$type | TypeName | The indexed data type |
$method | Name | The index access method |
$items | list<OperatorClassItem> | The operators, support functions and storage type; at least one |
$isDefault | bool | Whether DEFAULT is written: the class is the default for the type |
$family | DottedName|null | The operator family the class joins, if written |
Calls 2
- static-call Check::listOf() line 53
- class-const OperatorClassItem::class() line 53
public function deriveStatement(Derivation $derivation): voidDerives the type and the items.
Parameters
$derivation | Derivation |
Calls 2
- method-call Derivation::environment() line 61
- method-call TypeName::deriveClause() line 62
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 73
- class-const NameUse::Column() line 77
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.