packages/sql-semantics/src/Statement/Element.php

1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Statement;
6
7/**
8 * A structured SQL value that writes its own fields and fixed syntax.
9 *
10 * @visibility public
11 * @example Accepting a structured SQL value
12 *     $write = static fn (\SqlSemantics\Statement\Element $value): string => \SqlSemantics\Statement\Writer::render($value);
13 *     $write instanceof \Closure // => true
14 */
15interface Element
16{
17    /**
18     * Writes SQL using this value's data, without a parser or a source tree.
19     */
20    public function write(Writer $writer): void;
21}
22