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.

Reading the access methoddoctest
$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> $items
public DottedName $name
public TypeName $type
public Name $method
public bool $isDefault = false
public DottedName|null $family = null

Methods§

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

$nameDottedNameThe class name
$typeTypeNameThe indexed data type
$methodNameThe index access method
$itemslist<OperatorClassItem>The operators, support functions and storage type; at least one
$isDefaultboolWhether DEFAULT is written: the class is the default for the type
$familyDottedName|nullThe operator family the class joins, if written
Calls 2
public function deriveStatement(Derivation $derivation): void

Derives the type and the items.

Parameters

$derivationDerivation
Calls 2
public function render(Output $out): void

Writes the statement.

Parameters

$outOutput
Calls 2

Test cases 2§

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

Dedicated tests 1
Other tests reaching this symbol 1

Relations§

Instantiated in 1