pub enum Phase {
Show 52 variants
Start,
SelectProjection,
InProjection,
NextProjection,
AfterStar,
ProjectionAlias,
ExpectTable,
AfterTable,
JoinModifier,
JoinComplete,
OnClause,
UsingClause,
WhereClause,
InPredicate,
AfterGroup,
GroupByList,
AfterOrder,
OrderByList,
HavingClause,
LimitClause,
OffsetClause,
AfterInsert,
AfterInsertTable,
InsertColumnList,
InsertExpectValues,
InsertValuesList,
AfterUpdate,
AfterUpdateTable,
UpdateAssignment,
AfterDelete,
ReturningClause,
AfterCreate,
AfterAlter,
AfterDrop,
AfterAlterTableExpectName,
AfterAlterTableName,
AfterGrantOrRevoke,
AfterGrantOn,
AfterGrantTo,
PlpgsqlBody,
PlpgsqlAssignRhs,
CtlExpectTableName,
CtlBodyStart,
CtlExpectType,
CtlExpectColumnConstraint,
CtlExpectConstraintName,
CtlExpectConstraintKind,
CtlExpectFkTable {},
CtlExpectFkColumn {
table: String,
},
CtlCheckExpr {
table: Option<String>,
},
CastType,
Unknown,
}Variants§
Start
Empty buffer or right after a ;. Top-level statement keywords.
SelectProjection
After SELECT. Expect projection items (columns / * / funcs /
DISTINCT / ALL).
InProjection
Mid-projection identifier (after a column name). Expect AS,
comma to add another column, or FROM.
NextProjection
Right after a comma in the projection list. Expect another column.
AfterStar
Right after * (whole row). Expect FROM or a comma to mix in
more projections like SELECT *, foo FROM ....
ProjectionAlias
Right after AS inside the projection list. Expect alias name.
ExpectTable
After FROM / a comma inside FROM list / JOIN. Expect a table.
AfterTable
After a table name (possibly aliased). Expect comma / JOIN family
/ WHERE / GROUP BY / HAVING / ORDER BY / LIMIT / OFFSET / ;.
JoinModifier
After INNER / LEFT / RIGHT / FULL / CROSS. Expect JOIN
or OUTER.
JoinComplete
After a join completed but before ON / USING.
OnClause
After ON. Expect a predicate.
UsingClause
After USING. Expect (.
WhereClause
After WHERE. Expect a predicate.
InPredicate
Mid-predicate. Expect AND / OR / ORDER BY / GROUP BY / …
AfterGroup
After GROUP (expect BY).
GroupByList
After GROUP BY. Expect columns / numbers / GROUPING SETS / ROLLUP.
AfterOrder
After ORDER (expect BY).
OrderByList
After ORDER BY. Expect column [ASC|DESC] [NULLS FIRST|LAST].
HavingClause
After HAVING. Expect a predicate over aggregates.
LimitClause
After LIMIT. Expect a number.
OffsetClause
After OFFSET. Expect a number.
AfterInsert
AfterInsertTable
InsertColumnList
InsertExpectValues
InsertValuesList
AfterUpdate
AfterUpdateTable
UpdateAssignment
AfterDelete
ReturningClause
After RETURNING in INSERT / UPDATE / DELETE. Expect columns of
the target table (the one named in INTO / UPDATE / DELETE FROM),
plus *. Acts like a SELECT projection scoped to that one table.
AfterCreate
AfterAlter
AfterDrop
AfterAlterTableExpectName
After ALTER TABLE [IF EXISTS] [ONLY] – expect a table name.
Engine surfaces tables here.
AfterAlterTableName
After ALTER TABLE <name> – expect a sub-action keyword
(ADD COLUMN, DROP COLUMN, RENAME, ALTER COLUMN, …). Engine
emits the curated snippet list.
AfterGrantOrRevoke
After GRANT / REVOKE – expect a privilege keyword
(SELECT / INSERT / UPDATE / DELETE / TRUNCATE / REFERENCES /
TRIGGER / USAGE / EXECUTE / CREATE / CONNECT / TEMPORARY) or
ALL [PRIVILEGES]. Engine emits the curated keyword set.
AfterGrantOn
After GRANT/REVOKE ... ON [TABLE|SEQUENCE|FUNCTION|SCHEMA|...]
– expect a target name. Engine emits tables/sequences/funcs.
AfterGrantTo
After GRANT ... TO or REVOKE ... FROM – expect a role
from the catalog, plus the PUBLIC pseudo-role.
PlpgsqlBody
Cursor sits inside a $$ ... $$ body (DO block or function body).
PL/pgSQL keywords + functions + columns make sense here.
PlpgsqlAssignRhs
Right-hand side of a PL/pgSQL assignment (v_x := ... or
NEW.col := ...). Statement-level keywords like SELECT / CREATE
are invalid here – only expressions are.
CtlExpectTableName
After CREATE TABLE [IF NOT EXISTS] – expect a fresh table name.
No completion offered (user invents the name).
CtlBodyStart
Start of an entry inside CREATE TABLE body (after ( or ,).
User could either type a column name or a constraint-line keyword
(CONSTRAINT / PRIMARY KEY / FOREIGN KEY / UNIQUE / CHECK).
CtlExpectType
After a column name – expect a type.
CtlExpectColumnConstraint
After a column type – expect column constraint keywords (NOT NULL, DEFAULT, PRIMARY KEY, REFERENCES, UNIQUE, CHECK, …).
CtlExpectConstraintName
After CONSTRAINT – expect a fresh constraint name. No completion.
CtlExpectConstraintKind
After CONSTRAINT <name> – expect a kind keyword (PRIMARY KEY,
FOREIGN KEY, UNIQUE, CHECK).
CtlExpectFkTable
After REFERENCES – expect a target table.
CtlExpectFkColumn
After REFERENCES tbl ( – expect a column of that table.
CtlCheckExpr
Inside a CHECK ( ... ) expression. Expect this table’s
columns plus the full PG function library and expression
keywords – CHECK bodies are arbitrary boolean expressions.
CastType
Right after the PG :: cast operator. Expect a type (DATE,
NUMERIC, TEXT, JSONB, custom enum/domain, …).
Unknown
Anything we couldn’t classify – the engine falls back to a broad emitter so the menu is never empty.
Trait Implementations§
impl Eq for Phase
impl StructuralPartialEq for Phase
Auto Trait Implementations§
impl Freeze for Phase
impl RefUnwindSafe for Phase
impl Send for Phase
impl Sync for Phase
impl Unpin for Phase
impl UnsafeUnpin for Phase
impl UnwindSafe for Phase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more