1use crate::tokens::Span;
34use serde::{Deserialize, Serialize};
35use std::fmt;
36#[cfg(feature = "bindings")]
37use ts_rs::TS;
38
39fn default_true() -> bool {
41 true
42}
43
44fn is_true(v: &bool) -> bool {
45 *v
46}
47
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
77#[cfg_attr(feature = "bindings", derive(TS))]
78#[serde(rename_all = "snake_case")]
79#[cfg_attr(feature = "bindings", ts(export))]
80pub enum Expression {
81 Literal(Literal),
83 Boolean(BooleanLiteral),
84 Null(Null),
85
86 Identifier(Identifier),
88 Column(Column),
89 Table(TableRef),
90 Star(Star),
91 BracedWildcard(Box<Expression>),
93
94 Select(Box<Select>),
96 Union(Box<Union>),
97 Intersect(Box<Intersect>),
98 Except(Box<Except>),
99 Subquery(Box<Subquery>),
100 PipeOperator(Box<PipeOperator>),
101 Pivot(Box<Pivot>),
102 PivotAlias(Box<PivotAlias>),
103 Unpivot(Box<Unpivot>),
104 Values(Box<Values>),
105 PreWhere(Box<PreWhere>),
106 Stream(Box<Stream>),
107 UsingData(Box<UsingData>),
108 XmlNamespace(Box<XmlNamespace>),
109
110 Insert(Box<Insert>),
112 Update(Box<Update>),
113 Delete(Box<Delete>),
114 Copy(Box<CopyStmt>),
115 Put(Box<PutStmt>),
116 StageReference(Box<StageReference>),
117
118 Alias(Box<Alias>),
120 Cast(Box<Cast>),
121 Collation(Box<CollationExpr>),
122 Case(Box<Case>),
123
124 And(Box<BinaryOp>),
126 Or(Box<BinaryOp>),
127 Add(Box<BinaryOp>),
128 Sub(Box<BinaryOp>),
129 Mul(Box<BinaryOp>),
130 Div(Box<BinaryOp>),
131 Mod(Box<BinaryOp>),
132 Eq(Box<BinaryOp>),
133 Neq(Box<BinaryOp>),
134 Lt(Box<BinaryOp>),
135 Lte(Box<BinaryOp>),
136 Gt(Box<BinaryOp>),
137 Gte(Box<BinaryOp>),
138 Like(Box<LikeOp>),
139 ILike(Box<LikeOp>),
140 Match(Box<BinaryOp>),
142 BitwiseAnd(Box<BinaryOp>),
143 BitwiseOr(Box<BinaryOp>),
144 BitwiseXor(Box<BinaryOp>),
145 Concat(Box<BinaryOp>),
146 Adjacent(Box<BinaryOp>), TsMatch(Box<BinaryOp>), PropertyEQ(Box<BinaryOp>), ArrayContainsAll(Box<BinaryOp>), ArrayContainedBy(Box<BinaryOp>), ArrayOverlaps(Box<BinaryOp>), JSONBContainsAllTopKeys(Box<BinaryOp>), JSONBContainsAnyTopKeys(Box<BinaryOp>), JSONBDeleteAtPath(Box<BinaryOp>), ExtendsLeft(Box<BinaryOp>), ExtendsRight(Box<BinaryOp>), Not(Box<UnaryOp>),
162 Neg(Box<UnaryOp>),
163 BitwiseNot(Box<UnaryOp>),
164
165 In(Box<In>),
167 Between(Box<Between>),
168 IsNull(Box<IsNull>),
169 IsTrue(Box<IsTrueFalse>),
170 IsFalse(Box<IsTrueFalse>),
171 IsJson(Box<IsJson>),
172 Is(Box<BinaryOp>), Exists(Box<Exists>),
174 MemberOf(Box<BinaryOp>),
176
177 Function(Box<Function>),
179 AggregateFunction(Box<AggregateFunction>),
180 WindowFunction(Box<WindowFunction>),
181
182 From(Box<From>),
184 Join(Box<Join>),
185 JoinedTable(Box<JoinedTable>),
186 Where(Box<Where>),
187 GroupBy(Box<GroupBy>),
188 Having(Box<Having>),
189 OrderBy(Box<OrderBy>),
190 Limit(Box<Limit>),
191 Offset(Box<Offset>),
192 Qualify(Box<Qualify>),
193 With(Box<With>),
194 Cte(Box<Cte>),
195 DistributeBy(Box<DistributeBy>),
196 ClusterBy(Box<ClusterBy>),
197 SortBy(Box<SortBy>),
198 LateralView(Box<LateralView>),
199 Hint(Box<Hint>),
200 Pseudocolumn(Pseudocolumn),
201
202 Connect(Box<Connect>),
204 Prior(Box<Prior>),
205 ConnectByRoot(Box<ConnectByRoot>),
206
207 MatchRecognize(Box<MatchRecognize>),
209
210 Ordered(Box<Ordered>),
212
213 Window(Box<WindowSpec>),
215 Over(Box<Over>),
216 WithinGroup(Box<WithinGroup>),
217
218 DataType(DataType),
220
221 Array(Box<Array>),
223 Struct(Box<Struct>),
224 Tuple(Box<Tuple>),
225
226 Interval(Box<Interval>),
228
229 ConcatWs(Box<ConcatWs>),
231 Substring(Box<SubstringFunc>),
232 Upper(Box<UnaryFunc>),
233 Lower(Box<UnaryFunc>),
234 Length(Box<UnaryFunc>),
235 Trim(Box<TrimFunc>),
236 LTrim(Box<UnaryFunc>),
237 RTrim(Box<UnaryFunc>),
238 Replace(Box<ReplaceFunc>),
239 Reverse(Box<UnaryFunc>),
240 Left(Box<LeftRightFunc>),
241 Right(Box<LeftRightFunc>),
242 Repeat(Box<RepeatFunc>),
243 Lpad(Box<PadFunc>),
244 Rpad(Box<PadFunc>),
245 Split(Box<SplitFunc>),
246 RegexpLike(Box<RegexpFunc>),
247 RegexpReplace(Box<RegexpReplaceFunc>),
248 RegexpExtract(Box<RegexpExtractFunc>),
249 Overlay(Box<OverlayFunc>),
250
251 Abs(Box<UnaryFunc>),
253 Round(Box<RoundFunc>),
254 Floor(Box<FloorFunc>),
255 Ceil(Box<CeilFunc>),
256 Power(Box<BinaryFunc>),
257 Sqrt(Box<UnaryFunc>),
258 Cbrt(Box<UnaryFunc>),
259 Ln(Box<UnaryFunc>),
260 Log(Box<LogFunc>),
261 Exp(Box<UnaryFunc>),
262 Sign(Box<UnaryFunc>),
263 Greatest(Box<VarArgFunc>),
264 Least(Box<VarArgFunc>),
265
266 CurrentDate(CurrentDate),
268 CurrentTime(CurrentTime),
269 CurrentTimestamp(CurrentTimestamp),
270 CurrentTimestampLTZ(CurrentTimestampLTZ),
271 AtTimeZone(Box<AtTimeZone>),
272 DateAdd(Box<DateAddFunc>),
273 DateSub(Box<DateAddFunc>),
274 DateDiff(Box<DateDiffFunc>),
275 DateTrunc(Box<DateTruncFunc>),
276 Extract(Box<ExtractFunc>),
277 ToDate(Box<ToDateFunc>),
278 ToTimestamp(Box<ToTimestampFunc>),
279 Date(Box<UnaryFunc>),
280 Time(Box<UnaryFunc>),
281 DateFromUnixDate(Box<UnaryFunc>),
282 UnixDate(Box<UnaryFunc>),
283 UnixSeconds(Box<UnaryFunc>),
284 UnixMillis(Box<UnaryFunc>),
285 UnixMicros(Box<UnaryFunc>),
286 UnixToTimeStr(Box<BinaryFunc>),
287 TimeStrToDate(Box<UnaryFunc>),
288 DateToDi(Box<UnaryFunc>),
289 DiToDate(Box<UnaryFunc>),
290 TsOrDiToDi(Box<UnaryFunc>),
291 TsOrDsToDatetime(Box<UnaryFunc>),
292 TsOrDsToTimestamp(Box<UnaryFunc>),
293 YearOfWeek(Box<UnaryFunc>),
294 YearOfWeekIso(Box<UnaryFunc>),
295
296 Coalesce(Box<VarArgFunc>),
298 NullIf(Box<BinaryFunc>),
299 IfFunc(Box<IfFunc>),
300 IfNull(Box<BinaryFunc>),
301 Nvl(Box<BinaryFunc>),
302 Nvl2(Box<Nvl2Func>),
303
304 TryCast(Box<Cast>),
306 SafeCast(Box<Cast>),
307
308 Count(Box<CountFunc>),
310 Sum(Box<AggFunc>),
311 Avg(Box<AggFunc>),
312 Min(Box<AggFunc>),
313 Max(Box<AggFunc>),
314 GroupConcat(Box<GroupConcatFunc>),
315 StringAgg(Box<StringAggFunc>),
316 ListAgg(Box<ListAggFunc>),
317 ArrayAgg(Box<AggFunc>),
318 CountIf(Box<AggFunc>),
319 SumIf(Box<SumIfFunc>),
320 Stddev(Box<AggFunc>),
321 StddevPop(Box<AggFunc>),
322 StddevSamp(Box<AggFunc>),
323 Variance(Box<AggFunc>),
324 VarPop(Box<AggFunc>),
325 VarSamp(Box<AggFunc>),
326 Median(Box<AggFunc>),
327 Mode(Box<AggFunc>),
328 First(Box<AggFunc>),
329 Last(Box<AggFunc>),
330 AnyValue(Box<AggFunc>),
331 ApproxDistinct(Box<AggFunc>),
332 ApproxCountDistinct(Box<AggFunc>),
333 ApproxPercentile(Box<ApproxPercentileFunc>),
334 Percentile(Box<PercentileFunc>),
335 LogicalAnd(Box<AggFunc>),
336 LogicalOr(Box<AggFunc>),
337 Skewness(Box<AggFunc>),
338 BitwiseCount(Box<UnaryFunc>),
339 ArrayConcatAgg(Box<AggFunc>),
340 ArrayUniqueAgg(Box<AggFunc>),
341 BoolXorAgg(Box<AggFunc>),
342
343 RowNumber(RowNumber),
345 Rank(Rank),
346 DenseRank(DenseRank),
347 NTile(Box<NTileFunc>),
348 Lead(Box<LeadLagFunc>),
349 Lag(Box<LeadLagFunc>),
350 FirstValue(Box<ValueFunc>),
351 LastValue(Box<ValueFunc>),
352 NthValue(Box<NthValueFunc>),
353 PercentRank(PercentRank),
354 CumeDist(CumeDist),
355 PercentileCont(Box<PercentileFunc>),
356 PercentileDisc(Box<PercentileFunc>),
357
358 Contains(Box<BinaryFunc>),
360 StartsWith(Box<BinaryFunc>),
361 EndsWith(Box<BinaryFunc>),
362 Position(Box<PositionFunc>),
363 Initcap(Box<UnaryFunc>),
364 Ascii(Box<UnaryFunc>),
365 Chr(Box<UnaryFunc>),
366 CharFunc(Box<CharFunc>),
368 Soundex(Box<UnaryFunc>),
369 Levenshtein(Box<BinaryFunc>),
370 ByteLength(Box<UnaryFunc>),
371 Hex(Box<UnaryFunc>),
372 LowerHex(Box<UnaryFunc>),
373 Unicode(Box<UnaryFunc>),
374
375 ModFunc(Box<BinaryFunc>),
377 Random(Random),
378 Rand(Box<Rand>),
379 TruncFunc(Box<TruncateFunc>),
380 Pi(Pi),
381 Radians(Box<UnaryFunc>),
382 Degrees(Box<UnaryFunc>),
383 Sin(Box<UnaryFunc>),
384 Cos(Box<UnaryFunc>),
385 Tan(Box<UnaryFunc>),
386 Asin(Box<UnaryFunc>),
387 Acos(Box<UnaryFunc>),
388 Atan(Box<UnaryFunc>),
389 Atan2(Box<BinaryFunc>),
390 IsNan(Box<UnaryFunc>),
391 IsInf(Box<UnaryFunc>),
392 IntDiv(Box<BinaryFunc>),
393
394 Decode(Box<DecodeFunc>),
396
397 DateFormat(Box<DateFormatFunc>),
399 FormatDate(Box<DateFormatFunc>),
400 Year(Box<UnaryFunc>),
401 Month(Box<UnaryFunc>),
402 Day(Box<UnaryFunc>),
403 Hour(Box<UnaryFunc>),
404 Minute(Box<UnaryFunc>),
405 Second(Box<UnaryFunc>),
406 DayOfWeek(Box<UnaryFunc>),
407 DayOfWeekIso(Box<UnaryFunc>),
408 DayOfMonth(Box<UnaryFunc>),
409 DayOfYear(Box<UnaryFunc>),
410 WeekOfYear(Box<UnaryFunc>),
411 Quarter(Box<UnaryFunc>),
412 AddMonths(Box<BinaryFunc>),
413 MonthsBetween(Box<BinaryFunc>),
414 LastDay(Box<LastDayFunc>),
415 NextDay(Box<BinaryFunc>),
416 Epoch(Box<UnaryFunc>),
417 EpochMs(Box<UnaryFunc>),
418 FromUnixtime(Box<FromUnixtimeFunc>),
419 UnixTimestamp(Box<UnixTimestampFunc>),
420 MakeDate(Box<MakeDateFunc>),
421 MakeTimestamp(Box<MakeTimestampFunc>),
422 TimestampTrunc(Box<DateTruncFunc>),
423 TimeStrToUnix(Box<UnaryFunc>),
424
425 SessionUser(SessionUser),
427
428 SHA(Box<UnaryFunc>),
430 SHA1Digest(Box<UnaryFunc>),
431
432 TimeToUnix(Box<UnaryFunc>),
434
435 ArrayFunc(Box<ArrayConstructor>),
437 ArrayLength(Box<UnaryFunc>),
438 ArraySize(Box<UnaryFunc>),
439 Cardinality(Box<UnaryFunc>),
440 ArrayContains(Box<BinaryFunc>),
441 ArrayPosition(Box<BinaryFunc>),
442 ArrayAppend(Box<BinaryFunc>),
443 ArrayPrepend(Box<BinaryFunc>),
444 ArrayConcat(Box<VarArgFunc>),
445 ArraySort(Box<ArraySortFunc>),
446 ArrayReverse(Box<UnaryFunc>),
447 ArrayDistinct(Box<UnaryFunc>),
448 ArrayJoin(Box<ArrayJoinFunc>),
449 ArrayToString(Box<ArrayJoinFunc>),
450 Unnest(Box<UnnestFunc>),
451 Explode(Box<UnaryFunc>),
452 ExplodeOuter(Box<UnaryFunc>),
453 ArrayFilter(Box<ArrayFilterFunc>),
454 ArrayTransform(Box<ArrayTransformFunc>),
455 ArrayFlatten(Box<UnaryFunc>),
456 ArrayCompact(Box<UnaryFunc>),
457 ArrayIntersect(Box<VarArgFunc>),
458 ArrayUnion(Box<BinaryFunc>),
459 ArrayExcept(Box<BinaryFunc>),
460 ArrayRemove(Box<BinaryFunc>),
461 ArrayZip(Box<VarArgFunc>),
462 Sequence(Box<SequenceFunc>),
463 Generate(Box<SequenceFunc>),
464 ExplodingGenerateSeries(Box<SequenceFunc>),
465 ToArray(Box<UnaryFunc>),
466 StarMap(Box<BinaryFunc>),
467
468 StructFunc(Box<StructConstructor>),
470 StructExtract(Box<StructExtractFunc>),
471 NamedStruct(Box<NamedStructFunc>),
472
473 MapFunc(Box<MapConstructor>),
475 MapFromEntries(Box<UnaryFunc>),
476 MapFromArrays(Box<BinaryFunc>),
477 MapKeys(Box<UnaryFunc>),
478 MapValues(Box<UnaryFunc>),
479 MapContainsKey(Box<BinaryFunc>),
480 MapConcat(Box<VarArgFunc>),
481 ElementAt(Box<BinaryFunc>),
482 TransformKeys(Box<TransformFunc>),
483 TransformValues(Box<TransformFunc>),
484
485 JsonExtract(Box<JsonExtractFunc>),
487 JsonExtractScalar(Box<JsonExtractFunc>),
488 JsonExtractPath(Box<JsonPathFunc>),
489 JsonArray(Box<VarArgFunc>),
490 JsonObject(Box<JsonObjectFunc>),
491 JsonQuery(Box<JsonExtractFunc>),
492 JsonValue(Box<JsonExtractFunc>),
493 JsonArrayLength(Box<UnaryFunc>),
494 JsonKeys(Box<UnaryFunc>),
495 JsonType(Box<UnaryFunc>),
496 ParseJson(Box<UnaryFunc>),
497 ToJson(Box<UnaryFunc>),
498 JsonSet(Box<JsonModifyFunc>),
499 JsonInsert(Box<JsonModifyFunc>),
500 JsonRemove(Box<JsonPathFunc>),
501 JsonMergePatch(Box<BinaryFunc>),
502 JsonArrayAgg(Box<JsonArrayAggFunc>),
503 JsonObjectAgg(Box<JsonObjectAggFunc>),
504
505 Convert(Box<ConvertFunc>),
507 Typeof(Box<UnaryFunc>),
508
509 Lambda(Box<LambdaExpr>),
511 Parameter(Box<Parameter>),
512 Placeholder(Placeholder),
513 NamedArgument(Box<NamedArgument>),
514 TableArgument(Box<TableArgument>),
517 SqlComment(Box<SqlComment>),
518
519 NullSafeEq(Box<BinaryOp>),
521 NullSafeNeq(Box<BinaryOp>),
522 Glob(Box<BinaryOp>),
523 SimilarTo(Box<SimilarToExpr>),
524 Any(Box<QuantifiedExpr>),
525 All(Box<QuantifiedExpr>),
526 Overlaps(Box<OverlapsExpr>),
527
528 BitwiseLeftShift(Box<BinaryOp>),
530 BitwiseRightShift(Box<BinaryOp>),
531 BitwiseAndAgg(Box<AggFunc>),
532 BitwiseOrAgg(Box<AggFunc>),
533 BitwiseXorAgg(Box<AggFunc>),
534
535 Subscript(Box<Subscript>),
537 Dot(Box<DotAccess>),
538 MethodCall(Box<MethodCall>),
539 ArraySlice(Box<ArraySlice>),
540
541 CreateTable(Box<CreateTable>),
543 DropTable(Box<DropTable>),
544 AlterTable(Box<AlterTable>),
545 CreateIndex(Box<CreateIndex>),
546 DropIndex(Box<DropIndex>),
547 CreateView(Box<CreateView>),
548 DropView(Box<DropView>),
549 AlterView(Box<AlterView>),
550 AlterIndex(Box<AlterIndex>),
551 Truncate(Box<Truncate>),
552 Use(Box<Use>),
553 Cache(Box<Cache>),
554 Uncache(Box<Uncache>),
555 LoadData(Box<LoadData>),
556 Pragma(Box<Pragma>),
557 Grant(Box<Grant>),
558 Revoke(Box<Revoke>),
559 Comment(Box<Comment>),
560 SetStatement(Box<SetStatement>),
561 CreateSchema(Box<CreateSchema>),
563 DropSchema(Box<DropSchema>),
564 DropNamespace(Box<DropNamespace>),
565 CreateDatabase(Box<CreateDatabase>),
566 DropDatabase(Box<DropDatabase>),
567 CreateFunction(Box<CreateFunction>),
568 DropFunction(Box<DropFunction>),
569 CreateProcedure(Box<CreateProcedure>),
570 DropProcedure(Box<DropProcedure>),
571 CreateSequence(Box<CreateSequence>),
572 DropSequence(Box<DropSequence>),
573 AlterSequence(Box<AlterSequence>),
574 CreateTrigger(Box<CreateTrigger>),
575 DropTrigger(Box<DropTrigger>),
576 CreateType(Box<CreateType>),
577 DropType(Box<DropType>),
578 Describe(Box<Describe>),
579 Show(Box<Show>),
580
581 Command(Box<Command>),
583 Kill(Box<Kill>),
584 Execute(Box<ExecuteStatement>),
586
587 Raw(Raw),
589
590 Paren(Box<Paren>),
592
593 Annotated(Box<Annotated>),
595
596 Refresh(Box<Refresh>),
599 LockingStatement(Box<LockingStatement>),
600 SequenceProperties(Box<SequenceProperties>),
601 TruncateTable(Box<TruncateTable>),
602 Clone(Box<Clone>),
603 Attach(Box<Attach>),
604 Detach(Box<Detach>),
605 Install(Box<Install>),
606 Summarize(Box<Summarize>),
607 Declare(Box<Declare>),
608 DeclareItem(Box<DeclareItem>),
609 Set(Box<Set>),
610 Heredoc(Box<Heredoc>),
611 SetItem(Box<SetItem>),
612 QueryBand(Box<QueryBand>),
613 UserDefinedFunction(Box<UserDefinedFunction>),
614 RecursiveWithSearch(Box<RecursiveWithSearch>),
615 ProjectionDef(Box<ProjectionDef>),
616 TableAlias(Box<TableAlias>),
617 ByteString(Box<ByteString>),
618 HexStringExpr(Box<HexStringExpr>),
619 UnicodeString(Box<UnicodeString>),
620 ColumnPosition(Box<ColumnPosition>),
621 ColumnDef(Box<ColumnDef>),
622 AlterColumn(Box<AlterColumn>),
623 AlterSortKey(Box<AlterSortKey>),
624 AlterSet(Box<AlterSet>),
625 RenameColumn(Box<RenameColumn>),
626 Comprehension(Box<Comprehension>),
627 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
628 MergeTreeTTL(Box<MergeTreeTTL>),
629 IndexConstraintOption(Box<IndexConstraintOption>),
630 ColumnConstraint(Box<ColumnConstraint>),
631 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
632 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
633 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
634 CheckColumnConstraint(Box<CheckColumnConstraint>),
635 CompressColumnConstraint(Box<CompressColumnConstraint>),
636 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
637 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
638 WithOperator(Box<WithOperator>),
639 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
640 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
641 CommentColumnConstraint(CommentColumnConstraint),
642 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
643 IndexColumnConstraint(Box<IndexColumnConstraint>),
644 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
645 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
646 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
647 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
648 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
649 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
650 InOutColumnConstraint(Box<InOutColumnConstraint>),
651 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
652 PathColumnConstraint(Box<PathColumnConstraint>),
653 Constraint(Box<Constraint>),
654 Export(Box<Export>),
655 Filter(Box<Filter>),
656 Changes(Box<Changes>),
657 CopyParameter(Box<CopyParameter>),
658 Credentials(Box<Credentials>),
659 Directory(Box<Directory>),
660 ForeignKey(Box<ForeignKey>),
661 ColumnPrefix(Box<ColumnPrefix>),
662 PrimaryKey(Box<PrimaryKey>),
663 IntoClause(Box<IntoClause>),
664 JoinHint(Box<JoinHint>),
665 Opclass(Box<Opclass>),
666 Index(Box<Index>),
667 IndexParameters(Box<IndexParameters>),
668 ConditionalInsert(Box<ConditionalInsert>),
669 MultitableInserts(Box<MultitableInserts>),
670 OnConflict(Box<OnConflict>),
671 OnCondition(Box<OnCondition>),
672 Returning(Box<Returning>),
673 Introducer(Box<Introducer>),
674 PartitionRange(Box<PartitionRange>),
675 Fetch(Box<Fetch>),
676 Group(Box<Group>),
677 Cube(Box<Cube>),
678 Rollup(Box<Rollup>),
679 GroupingSets(Box<GroupingSets>),
680 LimitOptions(Box<LimitOptions>),
681 Lateral(Box<Lateral>),
682 TableFromRows(Box<TableFromRows>),
683 RowsFrom(Box<RowsFrom>),
684 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
685 WithFill(Box<WithFill>),
686 Property(Box<Property>),
687 GrantPrivilege(Box<GrantPrivilege>),
688 GrantPrincipal(Box<GrantPrincipal>),
689 AllowedValuesProperty(Box<AllowedValuesProperty>),
690 AlgorithmProperty(Box<AlgorithmProperty>),
691 AutoIncrementProperty(Box<AutoIncrementProperty>),
692 AutoRefreshProperty(Box<AutoRefreshProperty>),
693 BackupProperty(Box<BackupProperty>),
694 BuildProperty(Box<BuildProperty>),
695 BlockCompressionProperty(Box<BlockCompressionProperty>),
696 CharacterSetProperty(Box<CharacterSetProperty>),
697 ChecksumProperty(Box<ChecksumProperty>),
698 CollateProperty(Box<CollateProperty>),
699 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
700 DataDeletionProperty(Box<DataDeletionProperty>),
701 DefinerProperty(Box<DefinerProperty>),
702 DistKeyProperty(Box<DistKeyProperty>),
703 DistributedByProperty(Box<DistributedByProperty>),
704 DistStyleProperty(Box<DistStyleProperty>),
705 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
706 EngineProperty(Box<EngineProperty>),
707 ToTableProperty(Box<ToTableProperty>),
708 ExecuteAsProperty(Box<ExecuteAsProperty>),
709 ExternalProperty(Box<ExternalProperty>),
710 FallbackProperty(Box<FallbackProperty>),
711 FileFormatProperty(Box<FileFormatProperty>),
712 CredentialsProperty(Box<CredentialsProperty>),
713 FreespaceProperty(Box<FreespaceProperty>),
714 InheritsProperty(Box<InheritsProperty>),
715 InputModelProperty(Box<InputModelProperty>),
716 OutputModelProperty(Box<OutputModelProperty>),
717 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
718 JournalProperty(Box<JournalProperty>),
719 LanguageProperty(Box<LanguageProperty>),
720 EnviromentProperty(Box<EnviromentProperty>),
721 ClusteredByProperty(Box<ClusteredByProperty>),
722 DictProperty(Box<DictProperty>),
723 DictRange(Box<DictRange>),
724 OnCluster(Box<OnCluster>),
725 LikeProperty(Box<LikeProperty>),
726 LocationProperty(Box<LocationProperty>),
727 LockProperty(Box<LockProperty>),
728 LockingProperty(Box<LockingProperty>),
729 LogProperty(Box<LogProperty>),
730 MaterializedProperty(Box<MaterializedProperty>),
731 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
732 OnProperty(Box<OnProperty>),
733 OnCommitProperty(Box<OnCommitProperty>),
734 PartitionedByProperty(Box<PartitionedByProperty>),
735 PartitionByProperty(Box<PartitionByProperty>),
736 PartitionedByBucket(Box<PartitionedByBucket>),
737 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
738 PartitionByTruncate(Box<PartitionByTruncate>),
739 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
740 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
741 PartitionByListProperty(Box<PartitionByListProperty>),
742 PartitionList(Box<PartitionList>),
743 Partition(Box<Partition>),
744 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
745 UniqueKeyProperty(Box<UniqueKeyProperty>),
746 RollupProperty(Box<RollupProperty>),
747 PartitionBoundSpec(Box<PartitionBoundSpec>),
748 PartitionedOfProperty(Box<PartitionedOfProperty>),
749 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
750 ReturnsProperty(Box<ReturnsProperty>),
751 RowFormatProperty(Box<RowFormatProperty>),
752 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
753 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
754 QueryTransform(Box<QueryTransform>),
755 SampleProperty(Box<SampleProperty>),
756 SecurityProperty(Box<SecurityProperty>),
757 SchemaCommentProperty(Box<SchemaCommentProperty>),
758 SemanticView(Box<SemanticView>),
759 SerdeProperties(Box<SerdeProperties>),
760 SetProperty(Box<SetProperty>),
761 SharingProperty(Box<SharingProperty>),
762 SetConfigProperty(Box<SetConfigProperty>),
763 SettingsProperty(Box<SettingsProperty>),
764 SortKeyProperty(Box<SortKeyProperty>),
765 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
766 SqlSecurityProperty(Box<SqlSecurityProperty>),
767 StabilityProperty(Box<StabilityProperty>),
768 StorageHandlerProperty(Box<StorageHandlerProperty>),
769 TemporaryProperty(Box<TemporaryProperty>),
770 Tags(Box<Tags>),
771 TransformModelProperty(Box<TransformModelProperty>),
772 TransientProperty(Box<TransientProperty>),
773 UsingTemplateProperty(Box<UsingTemplateProperty>),
774 ViewAttributeProperty(Box<ViewAttributeProperty>),
775 VolatileProperty(Box<VolatileProperty>),
776 WithDataProperty(Box<WithDataProperty>),
777 WithJournalTableProperty(Box<WithJournalTableProperty>),
778 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
779 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
780 WithProcedureOptions(Box<WithProcedureOptions>),
781 EncodeProperty(Box<EncodeProperty>),
782 IncludeProperty(Box<IncludeProperty>),
783 Properties(Box<Properties>),
784 OptionsProperty(Box<OptionsProperty>),
785 InputOutputFormat(Box<InputOutputFormat>),
786 Reference(Box<Reference>),
787 QueryOption(Box<QueryOption>),
788 WithTableHint(Box<WithTableHint>),
789 IndexTableHint(Box<IndexTableHint>),
790 HistoricalData(Box<HistoricalData>),
791 Get(Box<Get>),
792 SetOperation(Box<SetOperation>),
793 Var(Box<Var>),
794 Variadic(Box<Variadic>),
795 Version(Box<Version>),
796 Schema(Box<Schema>),
797 Lock(Box<Lock>),
798 TableSample(Box<TableSample>),
799 Tag(Box<Tag>),
800 UnpivotColumns(Box<UnpivotColumns>),
801 WindowSpec(Box<WindowSpec>),
802 SessionParameter(Box<SessionParameter>),
803 PseudoType(Box<PseudoType>),
804 ObjectIdentifier(Box<ObjectIdentifier>),
805 Transaction(Box<Transaction>),
806 Commit(Box<Commit>),
807 Rollback(Box<Rollback>),
808 AlterSession(Box<AlterSession>),
809 Analyze(Box<Analyze>),
810 AnalyzeStatistics(Box<AnalyzeStatistics>),
811 AnalyzeHistogram(Box<AnalyzeHistogram>),
812 AnalyzeSample(Box<AnalyzeSample>),
813 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
814 AnalyzeDelete(Box<AnalyzeDelete>),
815 AnalyzeWith(Box<AnalyzeWith>),
816 AnalyzeValidate(Box<AnalyzeValidate>),
817 AddPartition(Box<AddPartition>),
818 AttachOption(Box<AttachOption>),
819 DropPartition(Box<DropPartition>),
820 ReplacePartition(Box<ReplacePartition>),
821 DPipe(Box<DPipe>),
822 Operator(Box<Operator>),
823 PivotAny(Box<PivotAny>),
824 Aliases(Box<Aliases>),
825 AtIndex(Box<AtIndex>),
826 FromTimeZone(Box<FromTimeZone>),
827 FormatPhrase(Box<FormatPhrase>),
828 ForIn(Box<ForIn>),
829 TimeUnit(Box<TimeUnit>),
830 IntervalOp(Box<IntervalOp>),
831 IntervalSpan(Box<IntervalSpan>),
832 HavingMax(Box<HavingMax>),
833 CosineDistance(Box<CosineDistance>),
834 DotProduct(Box<DotProduct>),
835 EuclideanDistance(Box<EuclideanDistance>),
836 ManhattanDistance(Box<ManhattanDistance>),
837 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
838 Booland(Box<Booland>),
839 Boolor(Box<Boolor>),
840 ParameterizedAgg(Box<ParameterizedAgg>),
841 ArgMax(Box<ArgMax>),
842 ArgMin(Box<ArgMin>),
843 ApproxTopK(Box<ApproxTopK>),
844 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
845 ApproxTopKCombine(Box<ApproxTopKCombine>),
846 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
847 ApproxTopSum(Box<ApproxTopSum>),
848 ApproxQuantiles(Box<ApproxQuantiles>),
849 Minhash(Box<Minhash>),
850 FarmFingerprint(Box<FarmFingerprint>),
851 Float64(Box<Float64>),
852 Transform(Box<Transform>),
853 Translate(Box<Translate>),
854 Grouping(Box<Grouping>),
855 GroupingId(Box<GroupingId>),
856 Anonymous(Box<Anonymous>),
857 AnonymousAggFunc(Box<AnonymousAggFunc>),
858 CombinedAggFunc(Box<CombinedAggFunc>),
859 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
860 HashAgg(Box<HashAgg>),
861 Hll(Box<Hll>),
862 Apply(Box<Apply>),
863 ToBoolean(Box<ToBoolean>),
864 List(Box<List>),
865 ToMap(Box<ToMap>),
866 Pad(Box<Pad>),
867 ToChar(Box<ToChar>),
868 ToNumber(Box<ToNumber>),
869 ToDouble(Box<ToDouble>),
870 Int64(Box<UnaryFunc>),
871 StringFunc(Box<StringFunc>),
872 ToDecfloat(Box<ToDecfloat>),
873 TryToDecfloat(Box<TryToDecfloat>),
874 ToFile(Box<ToFile>),
875 Columns(Box<Columns>),
876 ConvertToCharset(Box<ConvertToCharset>),
877 ConvertTimezone(Box<ConvertTimezone>),
878 GenerateSeries(Box<GenerateSeries>),
879 AIAgg(Box<AIAgg>),
880 AIClassify(Box<AIClassify>),
881 ArrayAll(Box<ArrayAll>),
882 ArrayAny(Box<ArrayAny>),
883 ArrayConstructCompact(Box<ArrayConstructCompact>),
884 StPoint(Box<StPoint>),
885 StDistance(Box<StDistance>),
886 StringToArray(Box<StringToArray>),
887 ArraySum(Box<ArraySum>),
888 ObjectAgg(Box<ObjectAgg>),
889 CastToStrType(Box<CastToStrType>),
890 CheckJson(Box<CheckJson>),
891 CheckXml(Box<CheckXml>),
892 TranslateCharacters(Box<TranslateCharacters>),
893 CurrentSchemas(Box<CurrentSchemas>),
894 CurrentDatetime(Box<CurrentDatetime>),
895 Localtime(Box<Localtime>),
896 Localtimestamp(Box<Localtimestamp>),
897 Systimestamp(Box<Systimestamp>),
898 CurrentSchema(Box<CurrentSchema>),
899 CurrentUser(Box<CurrentUser>),
900 UtcTime(Box<UtcTime>),
901 UtcTimestamp(Box<UtcTimestamp>),
902 Timestamp(Box<TimestampFunc>),
903 DateBin(Box<DateBin>),
904 Datetime(Box<Datetime>),
905 DatetimeAdd(Box<DatetimeAdd>),
906 DatetimeSub(Box<DatetimeSub>),
907 DatetimeDiff(Box<DatetimeDiff>),
908 DatetimeTrunc(Box<DatetimeTrunc>),
909 Dayname(Box<Dayname>),
910 MakeInterval(Box<MakeInterval>),
911 PreviousDay(Box<PreviousDay>),
912 Elt(Box<Elt>),
913 TimestampAdd(Box<TimestampAdd>),
914 TimestampSub(Box<TimestampSub>),
915 TimestampDiff(Box<TimestampDiff>),
916 TimeSlice(Box<TimeSlice>),
917 TimeAdd(Box<TimeAdd>),
918 TimeSub(Box<TimeSub>),
919 TimeDiff(Box<TimeDiff>),
920 TimeTrunc(Box<TimeTrunc>),
921 DateFromParts(Box<DateFromParts>),
922 TimeFromParts(Box<TimeFromParts>),
923 DecodeCase(Box<DecodeCase>),
924 Decrypt(Box<Decrypt>),
925 DecryptRaw(Box<DecryptRaw>),
926 Encode(Box<Encode>),
927 Encrypt(Box<Encrypt>),
928 EncryptRaw(Box<EncryptRaw>),
929 EqualNull(Box<EqualNull>),
930 ToBinary(Box<ToBinary>),
931 Base64DecodeBinary(Box<Base64DecodeBinary>),
932 Base64DecodeString(Box<Base64DecodeString>),
933 Base64Encode(Box<Base64Encode>),
934 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
935 TryBase64DecodeString(Box<TryBase64DecodeString>),
936 GapFill(Box<GapFill>),
937 GenerateDateArray(Box<GenerateDateArray>),
938 GenerateTimestampArray(Box<GenerateTimestampArray>),
939 GetExtract(Box<GetExtract>),
940 Getbit(Box<Getbit>),
941 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
942 HexEncode(Box<HexEncode>),
943 Compress(Box<Compress>),
944 DecompressBinary(Box<DecompressBinary>),
945 DecompressString(Box<DecompressString>),
946 Xor(Box<Xor>),
947 Nullif(Box<Nullif>),
948 JSON(Box<JSON>),
949 JSONPath(Box<JSONPath>),
950 JSONPathFilter(Box<JSONPathFilter>),
951 JSONPathKey(Box<JSONPathKey>),
952 JSONPathRecursive(Box<JSONPathRecursive>),
953 JSONPathScript(Box<JSONPathScript>),
954 JSONPathSlice(Box<JSONPathSlice>),
955 JSONPathSelector(Box<JSONPathSelector>),
956 JSONPathSubscript(Box<JSONPathSubscript>),
957 JSONPathUnion(Box<JSONPathUnion>),
958 Format(Box<Format>),
959 JSONKeys(Box<JSONKeys>),
960 JSONKeyValue(Box<JSONKeyValue>),
961 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
962 JSONObject(Box<JSONObject>),
963 JSONObjectAgg(Box<JSONObjectAgg>),
964 JSONBObjectAgg(Box<JSONBObjectAgg>),
965 JSONArray(Box<JSONArray>),
966 JSONArrayAgg(Box<JSONArrayAgg>),
967 JSONExists(Box<JSONExists>),
968 JSONColumnDef(Box<JSONColumnDef>),
969 JSONSchema(Box<JSONSchema>),
970 JSONSet(Box<JSONSet>),
971 JSONStripNulls(Box<JSONStripNulls>),
972 JSONValue(Box<JSONValue>),
973 JSONValueArray(Box<JSONValueArray>),
974 JSONRemove(Box<JSONRemove>),
975 JSONTable(Box<JSONTable>),
976 JSONType(Box<JSONType>),
977 ObjectInsert(Box<ObjectInsert>),
978 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
979 OpenJSON(Box<OpenJSON>),
980 JSONBExists(Box<JSONBExists>),
981 JSONBContains(Box<BinaryFunc>),
982 JSONBExtract(Box<BinaryFunc>),
983 JSONCast(Box<JSONCast>),
984 JSONExtract(Box<JSONExtract>),
985 JSONExtractQuote(Box<JSONExtractQuote>),
986 JSONExtractArray(Box<JSONExtractArray>),
987 JSONExtractScalar(Box<JSONExtractScalar>),
988 JSONBExtractScalar(Box<JSONBExtractScalar>),
989 JSONFormat(Box<JSONFormat>),
990 JSONBool(Box<UnaryFunc>),
991 JSONPathRoot(JSONPathRoot),
992 JSONArrayAppend(Box<JSONArrayAppend>),
993 JSONArrayContains(Box<JSONArrayContains>),
994 JSONArrayInsert(Box<JSONArrayInsert>),
995 ParseJSON(Box<ParseJSON>),
996 ParseUrl(Box<ParseUrl>),
997 ParseIp(Box<ParseIp>),
998 ParseTime(Box<ParseTime>),
999 ParseDatetime(Box<ParseDatetime>),
1000 Map(Box<Map>),
1001 MapCat(Box<MapCat>),
1002 MapDelete(Box<MapDelete>),
1003 MapInsert(Box<MapInsert>),
1004 MapPick(Box<MapPick>),
1005 ScopeResolution(Box<ScopeResolution>),
1006 Slice(Box<Slice>),
1007 VarMap(Box<VarMap>),
1008 MatchAgainst(Box<MatchAgainst>),
1009 MD5Digest(Box<MD5Digest>),
1010 MD5NumberLower64(Box<UnaryFunc>),
1011 MD5NumberUpper64(Box<UnaryFunc>),
1012 Monthname(Box<Monthname>),
1013 Ntile(Box<Ntile>),
1014 Normalize(Box<Normalize>),
1015 Normal(Box<Normal>),
1016 Predict(Box<Predict>),
1017 MLTranslate(Box<MLTranslate>),
1018 FeaturesAtTime(Box<FeaturesAtTime>),
1019 GenerateEmbedding(Box<GenerateEmbedding>),
1020 MLForecast(Box<MLForecast>),
1021 ModelAttribute(Box<ModelAttribute>),
1022 VectorSearch(Box<VectorSearch>),
1023 Quantile(Box<Quantile>),
1024 ApproxQuantile(Box<ApproxQuantile>),
1025 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1026 Randn(Box<Randn>),
1027 Randstr(Box<Randstr>),
1028 RangeN(Box<RangeN>),
1029 RangeBucket(Box<RangeBucket>),
1030 ReadCSV(Box<ReadCSV>),
1031 ReadParquet(Box<ReadParquet>),
1032 Reduce(Box<Reduce>),
1033 RegexpExtractAll(Box<RegexpExtractAll>),
1034 RegexpILike(Box<RegexpILike>),
1035 RegexpFullMatch(Box<RegexpFullMatch>),
1036 RegexpInstr(Box<RegexpInstr>),
1037 RegexpSplit(Box<RegexpSplit>),
1038 RegexpCount(Box<RegexpCount>),
1039 RegrValx(Box<RegrValx>),
1040 RegrValy(Box<RegrValy>),
1041 RegrAvgy(Box<RegrAvgy>),
1042 RegrAvgx(Box<RegrAvgx>),
1043 RegrCount(Box<RegrCount>),
1044 RegrIntercept(Box<RegrIntercept>),
1045 RegrR2(Box<RegrR2>),
1046 RegrSxx(Box<RegrSxx>),
1047 RegrSxy(Box<RegrSxy>),
1048 RegrSyy(Box<RegrSyy>),
1049 RegrSlope(Box<RegrSlope>),
1050 SafeAdd(Box<SafeAdd>),
1051 SafeDivide(Box<SafeDivide>),
1052 SafeMultiply(Box<SafeMultiply>),
1053 SafeSubtract(Box<SafeSubtract>),
1054 SHA2(Box<SHA2>),
1055 SHA2Digest(Box<SHA2Digest>),
1056 SortArray(Box<SortArray>),
1057 SplitPart(Box<SplitPart>),
1058 SubstringIndex(Box<SubstringIndex>),
1059 StandardHash(Box<StandardHash>),
1060 StrPosition(Box<StrPosition>),
1061 Search(Box<Search>),
1062 SearchIp(Box<SearchIp>),
1063 StrToDate(Box<StrToDate>),
1064 DateStrToDate(Box<UnaryFunc>),
1065 DateToDateStr(Box<UnaryFunc>),
1066 StrToTime(Box<StrToTime>),
1067 StrToUnix(Box<StrToUnix>),
1068 StrToMap(Box<StrToMap>),
1069 NumberToStr(Box<NumberToStr>),
1070 FromBase(Box<FromBase>),
1071 Stuff(Box<Stuff>),
1072 TimeToStr(Box<TimeToStr>),
1073 TimeStrToTime(Box<TimeStrToTime>),
1074 TsOrDsAdd(Box<TsOrDsAdd>),
1075 TsOrDsDiff(Box<TsOrDsDiff>),
1076 TsOrDsToDate(Box<TsOrDsToDate>),
1077 TsOrDsToTime(Box<TsOrDsToTime>),
1078 Unhex(Box<Unhex>),
1079 Uniform(Box<Uniform>),
1080 UnixToStr(Box<UnixToStr>),
1081 UnixToTime(Box<UnixToTime>),
1082 Uuid(Box<Uuid>),
1083 TimestampFromParts(Box<TimestampFromParts>),
1084 TimestampTzFromParts(Box<TimestampTzFromParts>),
1085 Corr(Box<Corr>),
1086 WidthBucket(Box<WidthBucket>),
1087 CovarSamp(Box<CovarSamp>),
1088 CovarPop(Box<CovarPop>),
1089 Week(Box<Week>),
1090 XMLElement(Box<XMLElement>),
1091 XMLGet(Box<XMLGet>),
1092 XMLTable(Box<XMLTable>),
1093 XMLKeyValueOption(Box<XMLKeyValueOption>),
1094 Zipf(Box<Zipf>),
1095 Merge(Box<Merge>),
1096 When(Box<When>),
1097 Whens(Box<Whens>),
1098 NextValueFor(Box<NextValueFor>),
1099 ReturnStmt(Box<Expression>),
1101}
1102
1103impl Expression {
1104 pub fn is_statement(&self) -> bool {
1111 match self {
1112 Expression::Select(_)
1114 | Expression::Union(_)
1115 | Expression::Intersect(_)
1116 | Expression::Except(_)
1117 | Expression::Subquery(_)
1118 | Expression::Values(_)
1119 | Expression::PipeOperator(_)
1120
1121 | Expression::Insert(_)
1123 | Expression::Update(_)
1124 | Expression::Delete(_)
1125 | Expression::Copy(_)
1126 | Expression::Put(_)
1127 | Expression::Merge(_)
1128
1129 | Expression::CreateTable(_)
1131 | Expression::DropTable(_)
1132 | Expression::AlterTable(_)
1133 | Expression::CreateIndex(_)
1134 | Expression::DropIndex(_)
1135 | Expression::CreateView(_)
1136 | Expression::DropView(_)
1137 | Expression::AlterView(_)
1138 | Expression::AlterIndex(_)
1139 | Expression::Truncate(_)
1140 | Expression::TruncateTable(_)
1141 | Expression::CreateSchema(_)
1142 | Expression::DropSchema(_)
1143 | Expression::DropNamespace(_)
1144 | Expression::CreateDatabase(_)
1145 | Expression::DropDatabase(_)
1146 | Expression::CreateFunction(_)
1147 | Expression::DropFunction(_)
1148 | Expression::CreateProcedure(_)
1149 | Expression::DropProcedure(_)
1150 | Expression::CreateSequence(_)
1151 | Expression::DropSequence(_)
1152 | Expression::AlterSequence(_)
1153 | Expression::CreateTrigger(_)
1154 | Expression::DropTrigger(_)
1155 | Expression::CreateType(_)
1156 | Expression::DropType(_)
1157 | Expression::Comment(_)
1158
1159 | Expression::Use(_)
1161 | Expression::Set(_)
1162 | Expression::SetStatement(_)
1163 | Expression::Transaction(_)
1164 | Expression::Commit(_)
1165 | Expression::Rollback(_)
1166 | Expression::Grant(_)
1167 | Expression::Revoke(_)
1168 | Expression::Cache(_)
1169 | Expression::Uncache(_)
1170 | Expression::LoadData(_)
1171 | Expression::Pragma(_)
1172 | Expression::Describe(_)
1173 | Expression::Show(_)
1174 | Expression::Kill(_)
1175 | Expression::Execute(_)
1176 | Expression::Declare(_)
1177 | Expression::Refresh(_)
1178 | Expression::AlterSession(_)
1179 | Expression::LockingStatement(_)
1180
1181 | Expression::Analyze(_)
1183 | Expression::AnalyzeStatistics(_)
1184 | Expression::AnalyzeHistogram(_)
1185 | Expression::AnalyzeSample(_)
1186 | Expression::AnalyzeListChainedRows(_)
1187 | Expression::AnalyzeDelete(_)
1188
1189 | Expression::Attach(_)
1191 | Expression::Detach(_)
1192 | Expression::Install(_)
1193 | Expression::Summarize(_)
1194
1195 | Expression::Pivot(_)
1197 | Expression::Unpivot(_)
1198
1199 | Expression::Command(_)
1201 | Expression::Raw(_)
1202
1203 | Expression::ReturnStmt(_) => true,
1205
1206 Expression::Annotated(a) => a.this.is_statement(),
1208
1209 Expression::Alias(a) => a.this.is_statement(),
1211
1212 _ => false,
1214 }
1215 }
1216
1217 pub fn number(n: i64) -> Self {
1219 Expression::Literal(Literal::Number(n.to_string()))
1220 }
1221
1222 pub fn string(s: impl Into<String>) -> Self {
1224 Expression::Literal(Literal::String(s.into()))
1225 }
1226
1227 pub fn float(f: f64) -> Self {
1229 Expression::Literal(Literal::Number(f.to_string()))
1230 }
1231
1232 pub fn column(name: impl Into<String>) -> Self {
1234 Expression::Column(Column {
1235 name: Identifier::new(name),
1236 table: None,
1237 join_mark: false,
1238 trailing_comments: Vec::new(),
1239 span: None,
1240 })
1241 }
1242
1243 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1245 Expression::Column(Column {
1246 name: Identifier::new(column),
1247 table: Some(Identifier::new(table)),
1248 join_mark: false,
1249 trailing_comments: Vec::new(),
1250 span: None,
1251 })
1252 }
1253
1254 pub fn identifier(name: impl Into<String>) -> Self {
1256 Expression::Identifier(Identifier::new(name))
1257 }
1258
1259 pub fn null() -> Self {
1261 Expression::Null(Null)
1262 }
1263
1264 pub fn true_() -> Self {
1266 Expression::Boolean(BooleanLiteral { value: true })
1267 }
1268
1269 pub fn false_() -> Self {
1271 Expression::Boolean(BooleanLiteral { value: false })
1272 }
1273
1274 pub fn star() -> Self {
1276 Expression::Star(Star {
1277 table: None,
1278 except: None,
1279 replace: None,
1280 rename: None,
1281 trailing_comments: Vec::new(),
1282 span: None,
1283 })
1284 }
1285
1286 pub fn alias(self, name: impl Into<String>) -> Self {
1288 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1289 }
1290
1291 pub fn is_select(&self) -> bool {
1293 matches!(self, Expression::Select(_))
1294 }
1295
1296 pub fn as_select(&self) -> Option<&Select> {
1298 match self {
1299 Expression::Select(s) => Some(s),
1300 _ => None,
1301 }
1302 }
1303
1304 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1306 match self {
1307 Expression::Select(s) => Some(s),
1308 _ => None,
1309 }
1310 }
1311
1312 pub fn sql(&self) -> String {
1317 crate::generator::Generator::sql(self).unwrap_or_default()
1318 }
1319
1320 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1326 crate::generate(self, dialect).unwrap_or_default()
1327 }
1328}
1329
1330impl fmt::Display for Expression {
1331 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1332 match self {
1334 Expression::Literal(lit) => write!(f, "{}", lit),
1335 Expression::Identifier(id) => write!(f, "{}", id),
1336 Expression::Column(col) => write!(f, "{}", col),
1337 Expression::Star(_) => write!(f, "*"),
1338 Expression::Null(_) => write!(f, "NULL"),
1339 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
1340 Expression::Select(_) => write!(f, "SELECT ..."),
1341 _ => write!(f, "{:?}", self),
1342 }
1343 }
1344}
1345
1346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1356#[cfg_attr(feature = "bindings", derive(TS))]
1357#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
1358pub enum Literal {
1359 String(String),
1361 Number(String),
1363 HexString(String),
1365 HexNumber(String),
1367 BitString(String),
1368 ByteString(String),
1370 NationalString(String),
1372 Date(String),
1374 Time(String),
1376 Timestamp(String),
1378 Datetime(String),
1380 TripleQuotedString(String, char),
1383 EscapeString(String),
1385 DollarString(String),
1387 RawString(String),
1391}
1392
1393impl fmt::Display for Literal {
1394 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1395 match self {
1396 Literal::String(s) => write!(f, "'{}'", s),
1397 Literal::Number(n) => write!(f, "{}", n),
1398 Literal::HexString(h) => write!(f, "X'{}'", h),
1399 Literal::HexNumber(h) => write!(f, "0x{}", h),
1400 Literal::BitString(b) => write!(f, "B'{}'", b),
1401 Literal::ByteString(b) => write!(f, "b'{}'", b),
1402 Literal::NationalString(s) => write!(f, "N'{}'", s),
1403 Literal::Date(d) => write!(f, "DATE '{}'", d),
1404 Literal::Time(t) => write!(f, "TIME '{}'", t),
1405 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
1406 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
1407 Literal::TripleQuotedString(s, q) => {
1408 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
1409 }
1410 Literal::EscapeString(s) => write!(f, "E'{}'", s),
1411 Literal::DollarString(s) => write!(f, "$${}$$", s),
1412 Literal::RawString(s) => write!(f, "r'{}'", s),
1413 }
1414 }
1415}
1416
1417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1419#[cfg_attr(feature = "bindings", derive(TS))]
1420pub struct BooleanLiteral {
1421 pub value: bool,
1422}
1423
1424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1426#[cfg_attr(feature = "bindings", derive(TS))]
1427pub struct Null;
1428
1429#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1436#[cfg_attr(feature = "bindings", derive(TS))]
1437pub struct Identifier {
1438 pub name: String,
1440 pub quoted: bool,
1442 #[serde(default)]
1443 pub trailing_comments: Vec<String>,
1444 #[serde(default, skip_serializing_if = "Option::is_none")]
1446 pub span: Option<Span>,
1447}
1448
1449impl Identifier {
1450 pub fn new(name: impl Into<String>) -> Self {
1451 Self {
1452 name: name.into(),
1453 quoted: false,
1454 trailing_comments: Vec::new(),
1455 span: None,
1456 }
1457 }
1458
1459 pub fn quoted(name: impl Into<String>) -> Self {
1460 Self {
1461 name: name.into(),
1462 quoted: true,
1463 trailing_comments: Vec::new(),
1464 span: None,
1465 }
1466 }
1467
1468 pub fn empty() -> Self {
1469 Self {
1470 name: String::new(),
1471 quoted: false,
1472 trailing_comments: Vec::new(),
1473 span: None,
1474 }
1475 }
1476
1477 pub fn is_empty(&self) -> bool {
1478 self.name.is_empty()
1479 }
1480
1481 pub fn with_span(mut self, span: Span) -> Self {
1483 self.span = Some(span);
1484 self
1485 }
1486}
1487
1488impl fmt::Display for Identifier {
1489 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1490 if self.quoted {
1491 write!(f, "\"{}\"", self.name)
1492 } else {
1493 write!(f, "{}", self.name)
1494 }
1495 }
1496}
1497
1498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1504#[cfg_attr(feature = "bindings", derive(TS))]
1505pub struct Column {
1506 pub name: Identifier,
1508 pub table: Option<Identifier>,
1510 #[serde(default)]
1512 pub join_mark: bool,
1513 #[serde(default)]
1515 pub trailing_comments: Vec<String>,
1516 #[serde(default, skip_serializing_if = "Option::is_none")]
1518 pub span: Option<Span>,
1519}
1520
1521impl fmt::Display for Column {
1522 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1523 if let Some(table) = &self.table {
1524 write!(f, "{}.{}", table, self.name)
1525 } else {
1526 write!(f, "{}", self.name)
1527 }
1528 }
1529}
1530
1531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1538#[cfg_attr(feature = "bindings", derive(TS))]
1539pub struct TableRef {
1540 pub name: Identifier,
1542 pub schema: Option<Identifier>,
1544 pub catalog: Option<Identifier>,
1546 pub alias: Option<Identifier>,
1548 #[serde(default)]
1550 pub alias_explicit_as: bool,
1551 #[serde(default)]
1553 pub column_aliases: Vec<Identifier>,
1554 #[serde(default)]
1556 pub trailing_comments: Vec<String>,
1557 #[serde(default)]
1559 pub when: Option<Box<HistoricalData>>,
1560 #[serde(default)]
1562 pub only: bool,
1563 #[serde(default)]
1565 pub final_: bool,
1566 #[serde(default, skip_serializing_if = "Option::is_none")]
1568 pub table_sample: Option<Box<Sample>>,
1569 #[serde(default)]
1571 pub hints: Vec<Expression>,
1572 #[serde(default, skip_serializing_if = "Option::is_none")]
1575 pub system_time: Option<String>,
1576 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1578 pub partitions: Vec<Identifier>,
1579 #[serde(default, skip_serializing_if = "Option::is_none")]
1582 pub identifier_func: Option<Box<Expression>>,
1583 #[serde(default, skip_serializing_if = "Option::is_none")]
1585 pub changes: Option<Box<Changes>>,
1586 #[serde(default, skip_serializing_if = "Option::is_none")]
1588 pub version: Option<Box<Version>>,
1589 #[serde(default, skip_serializing_if = "Option::is_none")]
1591 pub span: Option<Span>,
1592}
1593
1594impl TableRef {
1595 pub fn new(name: impl Into<String>) -> Self {
1596 Self {
1597 name: Identifier::new(name),
1598 schema: None,
1599 catalog: None,
1600 alias: None,
1601 alias_explicit_as: false,
1602 column_aliases: Vec::new(),
1603 trailing_comments: Vec::new(),
1604 when: None,
1605 only: false,
1606 final_: false,
1607 table_sample: None,
1608 hints: Vec::new(),
1609 system_time: None,
1610 partitions: Vec::new(),
1611 identifier_func: None,
1612 changes: None,
1613 version: None,
1614 span: None,
1615 }
1616 }
1617
1618 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
1620 let mut t = Self::new(name);
1621 t.schema = Some(Identifier::new(schema));
1622 t
1623 }
1624
1625 pub fn new_with_catalog(
1627 name: impl Into<String>,
1628 schema: impl Into<String>,
1629 catalog: impl Into<String>,
1630 ) -> Self {
1631 let mut t = Self::new(name);
1632 t.schema = Some(Identifier::new(schema));
1633 t.catalog = Some(Identifier::new(catalog));
1634 t
1635 }
1636
1637 pub fn from_identifier(name: Identifier) -> Self {
1639 Self {
1640 name,
1641 schema: None,
1642 catalog: None,
1643 alias: None,
1644 alias_explicit_as: false,
1645 column_aliases: Vec::new(),
1646 trailing_comments: Vec::new(),
1647 when: None,
1648 only: false,
1649 final_: false,
1650 table_sample: None,
1651 hints: Vec::new(),
1652 system_time: None,
1653 partitions: Vec::new(),
1654 identifier_func: None,
1655 changes: None,
1656 version: None,
1657 span: None,
1658 }
1659 }
1660
1661 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
1662 self.alias = Some(Identifier::new(alias));
1663 self
1664 }
1665
1666 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
1667 self.schema = Some(Identifier::new(schema));
1668 self
1669 }
1670}
1671
1672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1677#[cfg_attr(feature = "bindings", derive(TS))]
1678pub struct Star {
1679 pub table: Option<Identifier>,
1681 pub except: Option<Vec<Identifier>>,
1683 pub replace: Option<Vec<Alias>>,
1685 pub rename: Option<Vec<(Identifier, Identifier)>>,
1687 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1689 pub trailing_comments: Vec<String>,
1690 #[serde(default, skip_serializing_if = "Option::is_none")]
1692 pub span: Option<Span>,
1693}
1694
1695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1719#[cfg_attr(feature = "bindings", derive(TS))]
1720pub struct Select {
1721 pub expressions: Vec<Expression>,
1723 pub from: Option<From>,
1725 pub joins: Vec<Join>,
1727 pub lateral_views: Vec<LateralView>,
1728 #[serde(default, skip_serializing_if = "Option::is_none")]
1730 pub prewhere: Option<Expression>,
1731 pub where_clause: Option<Where>,
1732 pub group_by: Option<GroupBy>,
1733 pub having: Option<Having>,
1734 pub qualify: Option<Qualify>,
1735 pub order_by: Option<OrderBy>,
1736 pub distribute_by: Option<DistributeBy>,
1737 pub cluster_by: Option<ClusterBy>,
1738 pub sort_by: Option<SortBy>,
1739 pub limit: Option<Limit>,
1740 pub offset: Option<Offset>,
1741 #[serde(default, skip_serializing_if = "Option::is_none")]
1743 pub limit_by: Option<Vec<Expression>>,
1744 pub fetch: Option<Fetch>,
1745 pub distinct: bool,
1746 pub distinct_on: Option<Vec<Expression>>,
1747 pub top: Option<Top>,
1748 pub with: Option<With>,
1749 pub sample: Option<Sample>,
1750 #[serde(default, skip_serializing_if = "Option::is_none")]
1752 pub settings: Option<Vec<Expression>>,
1753 #[serde(default, skip_serializing_if = "Option::is_none")]
1755 pub format: Option<Expression>,
1756 pub windows: Option<Vec<NamedWindow>>,
1757 pub hint: Option<Hint>,
1758 pub connect: Option<Connect>,
1760 pub into: Option<SelectInto>,
1762 #[serde(default)]
1764 pub locks: Vec<Lock>,
1765 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1767 pub for_xml: Vec<Expression>,
1768 #[serde(default)]
1770 pub leading_comments: Vec<String>,
1771 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1774 pub post_select_comments: Vec<String>,
1775 #[serde(default, skip_serializing_if = "Option::is_none")]
1777 pub kind: Option<String>,
1778 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1780 pub operation_modifiers: Vec<String>,
1781 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
1783 pub qualify_after_window: bool,
1784 #[serde(default, skip_serializing_if = "Option::is_none")]
1786 pub option: Option<String>,
1787}
1788
1789impl Select {
1790 pub fn new() -> Self {
1791 Self {
1792 expressions: Vec::new(),
1793 from: None,
1794 joins: Vec::new(),
1795 lateral_views: Vec::new(),
1796 prewhere: None,
1797 where_clause: None,
1798 group_by: None,
1799 having: None,
1800 qualify: None,
1801 order_by: None,
1802 distribute_by: None,
1803 cluster_by: None,
1804 sort_by: None,
1805 limit: None,
1806 offset: None,
1807 limit_by: None,
1808 fetch: None,
1809 distinct: false,
1810 distinct_on: None,
1811 top: None,
1812 with: None,
1813 sample: None,
1814 settings: None,
1815 format: None,
1816 windows: None,
1817 hint: None,
1818 connect: None,
1819 into: None,
1820 locks: Vec::new(),
1821 for_xml: Vec::new(),
1822 leading_comments: Vec::new(),
1823 post_select_comments: Vec::new(),
1824 kind: None,
1825 operation_modifiers: Vec::new(),
1826 qualify_after_window: false,
1827 option: None,
1828 }
1829 }
1830
1831 pub fn column(mut self, expr: Expression) -> Self {
1833 self.expressions.push(expr);
1834 self
1835 }
1836
1837 pub fn from(mut self, table: Expression) -> Self {
1839 self.from = Some(From {
1840 expressions: vec![table],
1841 });
1842 self
1843 }
1844
1845 pub fn where_(mut self, condition: Expression) -> Self {
1847 self.where_clause = Some(Where { this: condition });
1848 self
1849 }
1850
1851 pub fn distinct(mut self) -> Self {
1853 self.distinct = true;
1854 self
1855 }
1856
1857 pub fn join(mut self, join: Join) -> Self {
1859 self.joins.push(join);
1860 self
1861 }
1862
1863 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
1865 self.order_by = Some(OrderBy {
1866 expressions,
1867 siblings: false,
1868 comments: Vec::new(),
1869 });
1870 self
1871 }
1872
1873 pub fn limit(mut self, n: Expression) -> Self {
1875 self.limit = Some(Limit {
1876 this: n,
1877 percent: false,
1878 comments: Vec::new(),
1879 });
1880 self
1881 }
1882
1883 pub fn offset(mut self, n: Expression) -> Self {
1885 self.offset = Some(Offset {
1886 this: n,
1887 rows: None,
1888 });
1889 self
1890 }
1891}
1892
1893impl Default for Select {
1894 fn default() -> Self {
1895 Self::new()
1896 }
1897}
1898
1899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1905#[cfg_attr(feature = "bindings", derive(TS))]
1906pub struct Union {
1907 pub left: Expression,
1909 pub right: Expression,
1911 pub all: bool,
1913 #[serde(default)]
1915 pub distinct: bool,
1916 pub with: Option<With>,
1918 pub order_by: Option<OrderBy>,
1920 pub limit: Option<Box<Expression>>,
1922 pub offset: Option<Box<Expression>>,
1924 #[serde(default, skip_serializing_if = "Option::is_none")]
1926 pub distribute_by: Option<DistributeBy>,
1927 #[serde(default, skip_serializing_if = "Option::is_none")]
1929 pub sort_by: Option<SortBy>,
1930 #[serde(default, skip_serializing_if = "Option::is_none")]
1932 pub cluster_by: Option<ClusterBy>,
1933 #[serde(default)]
1935 pub by_name: bool,
1936 #[serde(default, skip_serializing_if = "Option::is_none")]
1938 pub side: Option<String>,
1939 #[serde(default, skip_serializing_if = "Option::is_none")]
1941 pub kind: Option<String>,
1942 #[serde(default)]
1944 pub corresponding: bool,
1945 #[serde(default)]
1947 pub strict: bool,
1948 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1950 pub on_columns: Vec<Expression>,
1951}
1952
1953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1958#[cfg_attr(feature = "bindings", derive(TS))]
1959pub struct Intersect {
1960 pub left: Expression,
1962 pub right: Expression,
1964 pub all: bool,
1966 #[serde(default)]
1968 pub distinct: bool,
1969 pub with: Option<With>,
1971 pub order_by: Option<OrderBy>,
1973 pub limit: Option<Box<Expression>>,
1975 pub offset: Option<Box<Expression>>,
1977 #[serde(default, skip_serializing_if = "Option::is_none")]
1979 pub distribute_by: Option<DistributeBy>,
1980 #[serde(default, skip_serializing_if = "Option::is_none")]
1982 pub sort_by: Option<SortBy>,
1983 #[serde(default, skip_serializing_if = "Option::is_none")]
1985 pub cluster_by: Option<ClusterBy>,
1986 #[serde(default)]
1988 pub by_name: bool,
1989 #[serde(default, skip_serializing_if = "Option::is_none")]
1991 pub side: Option<String>,
1992 #[serde(default, skip_serializing_if = "Option::is_none")]
1994 pub kind: Option<String>,
1995 #[serde(default)]
1997 pub corresponding: bool,
1998 #[serde(default)]
2000 pub strict: bool,
2001 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2003 pub on_columns: Vec<Expression>,
2004}
2005
2006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2011#[cfg_attr(feature = "bindings", derive(TS))]
2012pub struct Except {
2013 pub left: Expression,
2015 pub right: Expression,
2017 pub all: bool,
2019 #[serde(default)]
2021 pub distinct: bool,
2022 pub with: Option<With>,
2024 pub order_by: Option<OrderBy>,
2026 pub limit: Option<Box<Expression>>,
2028 pub offset: Option<Box<Expression>>,
2030 #[serde(default, skip_serializing_if = "Option::is_none")]
2032 pub distribute_by: Option<DistributeBy>,
2033 #[serde(default, skip_serializing_if = "Option::is_none")]
2035 pub sort_by: Option<SortBy>,
2036 #[serde(default, skip_serializing_if = "Option::is_none")]
2038 pub cluster_by: Option<ClusterBy>,
2039 #[serde(default)]
2041 pub by_name: bool,
2042 #[serde(default, skip_serializing_if = "Option::is_none")]
2044 pub side: Option<String>,
2045 #[serde(default, skip_serializing_if = "Option::is_none")]
2047 pub kind: Option<String>,
2048 #[serde(default)]
2050 pub corresponding: bool,
2051 #[serde(default)]
2053 pub strict: bool,
2054 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2056 pub on_columns: Vec<Expression>,
2057}
2058
2059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2061#[cfg_attr(feature = "bindings", derive(TS))]
2062pub struct SelectInto {
2063 pub this: Expression,
2065 #[serde(default)]
2067 pub temporary: bool,
2068 #[serde(default)]
2070 pub unlogged: bool,
2071 #[serde(default)]
2073 pub bulk_collect: bool,
2074 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2076 pub expressions: Vec<Expression>,
2077}
2078
2079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2089#[cfg_attr(feature = "bindings", derive(TS))]
2090pub struct Subquery {
2091 pub this: Expression,
2093 pub alias: Option<Identifier>,
2095 pub column_aliases: Vec<Identifier>,
2097 pub order_by: Option<OrderBy>,
2099 pub limit: Option<Limit>,
2101 pub offset: Option<Offset>,
2103 #[serde(default, skip_serializing_if = "Option::is_none")]
2105 pub distribute_by: Option<DistributeBy>,
2106 #[serde(default, skip_serializing_if = "Option::is_none")]
2108 pub sort_by: Option<SortBy>,
2109 #[serde(default, skip_serializing_if = "Option::is_none")]
2111 pub cluster_by: Option<ClusterBy>,
2112 #[serde(default)]
2114 pub lateral: bool,
2115 #[serde(default)]
2119 pub modifiers_inside: bool,
2120 #[serde(default)]
2122 pub trailing_comments: Vec<String>,
2123}
2124
2125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2130#[cfg_attr(feature = "bindings", derive(TS))]
2131pub struct PipeOperator {
2132 pub this: Expression,
2134 pub expression: Expression,
2136}
2137
2138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2140#[cfg_attr(feature = "bindings", derive(TS))]
2141pub struct Values {
2142 pub expressions: Vec<Tuple>,
2144 pub alias: Option<Identifier>,
2146 pub column_aliases: Vec<Identifier>,
2148}
2149
2150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2160#[cfg_attr(feature = "bindings", derive(TS))]
2161pub struct Pivot {
2162 pub this: Expression,
2164 #[serde(default)]
2167 pub expressions: Vec<Expression>,
2168 #[serde(default)]
2170 pub fields: Vec<Expression>,
2171 #[serde(default)]
2173 pub using: Vec<Expression>,
2174 #[serde(default)]
2176 pub group: Option<Box<Expression>>,
2177 #[serde(default)]
2179 pub unpivot: bool,
2180 #[serde(default)]
2182 pub into: Option<Box<Expression>>,
2183 #[serde(default)]
2185 pub alias: Option<Identifier>,
2186 #[serde(default)]
2188 pub include_nulls: Option<bool>,
2189 #[serde(default)]
2191 pub default_on_null: Option<Box<Expression>>,
2192 #[serde(default, skip_serializing_if = "Option::is_none")]
2194 pub with: Option<With>,
2195}
2196
2197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2199#[cfg_attr(feature = "bindings", derive(TS))]
2200pub struct Unpivot {
2201 pub this: Expression,
2202 pub value_column: Identifier,
2203 pub name_column: Identifier,
2204 pub columns: Vec<Expression>,
2205 pub alias: Option<Identifier>,
2206 #[serde(default)]
2208 pub value_column_parenthesized: bool,
2209 #[serde(default)]
2211 pub include_nulls: Option<bool>,
2212 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2214 pub extra_value_columns: Vec<Identifier>,
2215}
2216
2217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2220#[cfg_attr(feature = "bindings", derive(TS))]
2221pub struct PivotAlias {
2222 pub this: Expression,
2223 pub alias: Expression,
2224}
2225
2226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2228#[cfg_attr(feature = "bindings", derive(TS))]
2229pub struct PreWhere {
2230 pub this: Expression,
2231}
2232
2233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2235#[cfg_attr(feature = "bindings", derive(TS))]
2236pub struct Stream {
2237 pub this: Expression,
2238 #[serde(skip_serializing_if = "Option::is_none")]
2239 pub on: Option<Expression>,
2240 #[serde(skip_serializing_if = "Option::is_none")]
2241 pub show_initial_rows: Option<bool>,
2242}
2243
2244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2246#[cfg_attr(feature = "bindings", derive(TS))]
2247pub struct UsingData {
2248 pub this: Expression,
2249}
2250
2251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2253#[cfg_attr(feature = "bindings", derive(TS))]
2254pub struct XmlNamespace {
2255 pub this: Expression,
2256 #[serde(skip_serializing_if = "Option::is_none")]
2257 pub alias: Option<Identifier>,
2258}
2259
2260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2262#[cfg_attr(feature = "bindings", derive(TS))]
2263pub struct RowFormat {
2264 pub delimited: bool,
2265 pub fields_terminated_by: Option<String>,
2266 pub collection_items_terminated_by: Option<String>,
2267 pub map_keys_terminated_by: Option<String>,
2268 pub lines_terminated_by: Option<String>,
2269 pub null_defined_as: Option<String>,
2270}
2271
2272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2274#[cfg_attr(feature = "bindings", derive(TS))]
2275pub struct DirectoryInsert {
2276 pub local: bool,
2277 pub path: String,
2278 pub row_format: Option<RowFormat>,
2279 #[serde(default)]
2281 pub stored_as: Option<String>,
2282}
2283
2284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2286#[cfg_attr(feature = "bindings", derive(TS))]
2287pub struct Insert {
2288 pub table: TableRef,
2289 pub columns: Vec<Identifier>,
2290 pub values: Vec<Vec<Expression>>,
2291 pub query: Option<Expression>,
2292 pub overwrite: bool,
2294 pub partition: Vec<(Identifier, Option<Expression>)>,
2296 #[serde(default)]
2298 pub directory: Option<DirectoryInsert>,
2299 #[serde(default)]
2301 pub returning: Vec<Expression>,
2302 #[serde(default)]
2304 pub output: Option<OutputClause>,
2305 #[serde(default)]
2307 pub on_conflict: Option<Box<Expression>>,
2308 #[serde(default)]
2310 pub leading_comments: Vec<String>,
2311 #[serde(default)]
2313 pub if_exists: bool,
2314 #[serde(default)]
2316 pub with: Option<With>,
2317 #[serde(default)]
2319 pub ignore: bool,
2320 #[serde(default)]
2322 pub source_alias: Option<Identifier>,
2323 #[serde(default)]
2325 pub alias: Option<Identifier>,
2326 #[serde(default)]
2328 pub alias_explicit_as: bool,
2329 #[serde(default)]
2331 pub default_values: bool,
2332 #[serde(default)]
2334 pub by_name: bool,
2335 #[serde(default, skip_serializing_if = "Option::is_none")]
2337 pub conflict_action: Option<String>,
2338 #[serde(default)]
2340 pub is_replace: bool,
2341 #[serde(default, skip_serializing_if = "Option::is_none")]
2343 pub hint: Option<Hint>,
2344 #[serde(default)]
2346 pub replace_where: Option<Box<Expression>>,
2347 #[serde(default)]
2349 pub source: Option<Box<Expression>>,
2350 #[serde(default, skip_serializing_if = "Option::is_none")]
2352 pub function_target: Option<Box<Expression>>,
2353 #[serde(default, skip_serializing_if = "Option::is_none")]
2355 pub partition_by: Option<Box<Expression>>,
2356 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2358 pub settings: Vec<Expression>,
2359}
2360
2361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2363#[cfg_attr(feature = "bindings", derive(TS))]
2364pub struct OutputClause {
2365 pub columns: Vec<Expression>,
2367 #[serde(default)]
2369 pub into_table: Option<Expression>,
2370}
2371
2372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2374#[cfg_attr(feature = "bindings", derive(TS))]
2375pub struct Update {
2376 pub table: TableRef,
2377 #[serde(default)]
2379 pub extra_tables: Vec<TableRef>,
2380 #[serde(default)]
2382 pub table_joins: Vec<Join>,
2383 pub set: Vec<(Identifier, Expression)>,
2384 pub from_clause: Option<From>,
2385 #[serde(default)]
2387 pub from_joins: Vec<Join>,
2388 pub where_clause: Option<Where>,
2389 #[serde(default)]
2391 pub returning: Vec<Expression>,
2392 #[serde(default)]
2394 pub output: Option<OutputClause>,
2395 #[serde(default)]
2397 pub with: Option<With>,
2398 #[serde(default)]
2400 pub leading_comments: Vec<String>,
2401 #[serde(default)]
2403 pub limit: Option<Expression>,
2404 #[serde(default)]
2406 pub order_by: Option<OrderBy>,
2407 #[serde(default)]
2409 pub from_before_set: bool,
2410}
2411
2412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2414#[cfg_attr(feature = "bindings", derive(TS))]
2415pub struct Delete {
2416 pub table: TableRef,
2417 #[serde(default, skip_serializing_if = "Option::is_none")]
2419 pub on_cluster: Option<OnCluster>,
2420 pub alias: Option<Identifier>,
2422 #[serde(default)]
2424 pub alias_explicit_as: bool,
2425 pub using: Vec<TableRef>,
2427 pub where_clause: Option<Where>,
2428 #[serde(default)]
2430 pub output: Option<OutputClause>,
2431 #[serde(default)]
2433 pub leading_comments: Vec<String>,
2434 #[serde(default)]
2436 pub with: Option<With>,
2437 #[serde(default)]
2439 pub limit: Option<Expression>,
2440 #[serde(default)]
2442 pub order_by: Option<OrderBy>,
2443 #[serde(default)]
2445 pub returning: Vec<Expression>,
2446 #[serde(default)]
2449 pub tables: Vec<TableRef>,
2450 #[serde(default)]
2453 pub tables_from_using: bool,
2454 #[serde(default)]
2456 pub joins: Vec<Join>,
2457 #[serde(default)]
2459 pub force_index: Option<String>,
2460 #[serde(default)]
2462 pub no_from: bool,
2463}
2464
2465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2467#[cfg_attr(feature = "bindings", derive(TS))]
2468pub struct CopyStmt {
2469 pub this: Expression,
2471 pub kind: bool,
2473 pub files: Vec<Expression>,
2475 #[serde(default)]
2477 pub params: Vec<CopyParameter>,
2478 #[serde(default)]
2480 pub credentials: Option<Box<Credentials>>,
2481 #[serde(default)]
2483 pub is_into: bool,
2484 #[serde(default)]
2486 pub with_wrapped: bool,
2487}
2488
2489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2491#[cfg_attr(feature = "bindings", derive(TS))]
2492pub struct CopyParameter {
2493 pub name: String,
2494 pub value: Option<Expression>,
2495 pub values: Vec<Expression>,
2496 #[serde(default)]
2498 pub eq: bool,
2499}
2500
2501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2503#[cfg_attr(feature = "bindings", derive(TS))]
2504pub struct Credentials {
2505 pub credentials: Vec<(String, String)>,
2506 pub encryption: Option<String>,
2507 pub storage: Option<String>,
2508}
2509
2510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2512#[cfg_attr(feature = "bindings", derive(TS))]
2513pub struct PutStmt {
2514 pub source: String,
2516 #[serde(default)]
2518 pub source_quoted: bool,
2519 pub target: Expression,
2521 #[serde(default)]
2523 pub params: Vec<CopyParameter>,
2524}
2525
2526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2528#[cfg_attr(feature = "bindings", derive(TS))]
2529pub struct StageReference {
2530 pub name: String,
2532 #[serde(default)]
2534 pub path: Option<String>,
2535 #[serde(default)]
2537 pub file_format: Option<Expression>,
2538 #[serde(default)]
2540 pub pattern: Option<String>,
2541 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2543 pub quoted: bool,
2544}
2545
2546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2548#[cfg_attr(feature = "bindings", derive(TS))]
2549pub struct HistoricalData {
2550 pub this: Box<Expression>,
2552 pub kind: String,
2554 pub expression: Box<Expression>,
2556}
2557
2558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2563#[cfg_attr(feature = "bindings", derive(TS))]
2564pub struct Alias {
2565 pub this: Expression,
2567 pub alias: Identifier,
2569 #[serde(default)]
2571 pub column_aliases: Vec<Identifier>,
2572 #[serde(default)]
2574 pub pre_alias_comments: Vec<String>,
2575 #[serde(default)]
2577 pub trailing_comments: Vec<String>,
2578}
2579
2580impl Alias {
2581 pub fn new(this: Expression, alias: Identifier) -> Self {
2583 Self {
2584 this,
2585 alias,
2586 column_aliases: Vec::new(),
2587 pre_alias_comments: Vec::new(),
2588 trailing_comments: Vec::new(),
2589 }
2590 }
2591
2592 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
2594 Self {
2595 this,
2596 alias: Identifier::empty(),
2597 column_aliases,
2598 pre_alias_comments: Vec::new(),
2599 trailing_comments: Vec::new(),
2600 }
2601 }
2602}
2603
2604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2611#[cfg_attr(feature = "bindings", derive(TS))]
2612pub struct Cast {
2613 pub this: Expression,
2615 pub to: DataType,
2617 #[serde(default)]
2618 pub trailing_comments: Vec<String>,
2619 #[serde(default)]
2621 pub double_colon_syntax: bool,
2622 #[serde(skip_serializing_if = "Option::is_none", default)]
2624 pub format: Option<Box<Expression>>,
2625 #[serde(skip_serializing_if = "Option::is_none", default)]
2627 pub default: Option<Box<Expression>>,
2628}
2629
2630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2632#[cfg_attr(feature = "bindings", derive(TS))]
2633pub struct CollationExpr {
2634 pub this: Expression,
2635 pub collation: String,
2636 #[serde(default)]
2638 pub quoted: bool,
2639 #[serde(default)]
2641 pub double_quoted: bool,
2642}
2643
2644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2650#[cfg_attr(feature = "bindings", derive(TS))]
2651pub struct Case {
2652 pub operand: Option<Expression>,
2654 pub whens: Vec<(Expression, Expression)>,
2656 pub else_: Option<Expression>,
2658 #[serde(default)]
2660 #[serde(skip_serializing_if = "Vec::is_empty")]
2661 pub comments: Vec<String>,
2662}
2663
2664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2672#[cfg_attr(feature = "bindings", derive(TS))]
2673pub struct BinaryOp {
2674 pub left: Expression,
2675 pub right: Expression,
2676 #[serde(default)]
2678 pub left_comments: Vec<String>,
2679 #[serde(default)]
2681 pub operator_comments: Vec<String>,
2682 #[serde(default)]
2684 pub trailing_comments: Vec<String>,
2685}
2686
2687impl BinaryOp {
2688 pub fn new(left: Expression, right: Expression) -> Self {
2689 Self {
2690 left,
2691 right,
2692 left_comments: Vec::new(),
2693 operator_comments: Vec::new(),
2694 trailing_comments: Vec::new(),
2695 }
2696 }
2697}
2698
2699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2701#[cfg_attr(feature = "bindings", derive(TS))]
2702pub struct LikeOp {
2703 pub left: Expression,
2704 pub right: Expression,
2705 #[serde(default)]
2707 pub escape: Option<Expression>,
2708 #[serde(default)]
2710 pub quantifier: Option<String>,
2711}
2712
2713impl LikeOp {
2714 pub fn new(left: Expression, right: Expression) -> Self {
2715 Self {
2716 left,
2717 right,
2718 escape: None,
2719 quantifier: None,
2720 }
2721 }
2722
2723 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
2724 Self {
2725 left,
2726 right,
2727 escape: Some(escape),
2728 quantifier: None,
2729 }
2730 }
2731}
2732
2733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2737#[cfg_attr(feature = "bindings", derive(TS))]
2738pub struct UnaryOp {
2739 pub this: Expression,
2741}
2742
2743impl UnaryOp {
2744 pub fn new(this: Expression) -> Self {
2745 Self { this }
2746 }
2747}
2748
2749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2754#[cfg_attr(feature = "bindings", derive(TS))]
2755pub struct In {
2756 pub this: Expression,
2758 pub expressions: Vec<Expression>,
2760 pub query: Option<Expression>,
2762 pub not: bool,
2764 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2765 pub global: bool,
2766 #[serde(default, skip_serializing_if = "Option::is_none")]
2768 pub unnest: Option<Box<Expression>>,
2769 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2773 pub is_field: bool,
2774}
2775
2776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2778#[cfg_attr(feature = "bindings", derive(TS))]
2779pub struct Between {
2780 pub this: Expression,
2782 pub low: Expression,
2784 pub high: Expression,
2786 pub not: bool,
2788 #[serde(default)]
2790 pub symmetric: Option<bool>,
2791}
2792
2793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2795#[cfg_attr(feature = "bindings", derive(TS))]
2796pub struct IsNull {
2797 pub this: Expression,
2798 pub not: bool,
2799 #[serde(default)]
2801 pub postfix_form: bool,
2802}
2803
2804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2806#[cfg_attr(feature = "bindings", derive(TS))]
2807pub struct IsTrueFalse {
2808 pub this: Expression,
2809 pub not: bool,
2810}
2811
2812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2815#[cfg_attr(feature = "bindings", derive(TS))]
2816pub struct IsJson {
2817 pub this: Expression,
2818 pub json_type: Option<String>,
2820 pub unique_keys: Option<JsonUniqueKeys>,
2822 pub negated: bool,
2824}
2825
2826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2828#[cfg_attr(feature = "bindings", derive(TS))]
2829pub enum JsonUniqueKeys {
2830 With,
2832 Without,
2834 Shorthand,
2836}
2837
2838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2840#[cfg_attr(feature = "bindings", derive(TS))]
2841pub struct Exists {
2842 pub this: Expression,
2844 pub not: bool,
2846}
2847
2848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2855#[cfg_attr(feature = "bindings", derive(TS))]
2856pub struct Function {
2857 pub name: String,
2859 pub args: Vec<Expression>,
2861 pub distinct: bool,
2863 #[serde(default)]
2864 pub trailing_comments: Vec<String>,
2865 #[serde(default)]
2867 pub use_bracket_syntax: bool,
2868 #[serde(default)]
2870 pub no_parens: bool,
2871 #[serde(default)]
2873 pub quoted: bool,
2874 #[serde(default, skip_serializing_if = "Option::is_none")]
2876 pub span: Option<Span>,
2877}
2878
2879impl Default for Function {
2880 fn default() -> Self {
2881 Self {
2882 name: String::new(),
2883 args: Vec::new(),
2884 distinct: false,
2885 trailing_comments: Vec::new(),
2886 use_bracket_syntax: false,
2887 no_parens: false,
2888 quoted: false,
2889 span: None,
2890 }
2891 }
2892}
2893
2894impl Function {
2895 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
2896 Self {
2897 name: name.into(),
2898 args,
2899 distinct: false,
2900 trailing_comments: Vec::new(),
2901 use_bracket_syntax: false,
2902 no_parens: false,
2903 quoted: false,
2904 span: None,
2905 }
2906 }
2907}
2908
2909#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
2916#[cfg_attr(feature = "bindings", derive(TS))]
2917pub struct AggregateFunction {
2918 pub name: String,
2920 pub args: Vec<Expression>,
2922 pub distinct: bool,
2924 pub filter: Option<Expression>,
2926 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2928 pub order_by: Vec<Ordered>,
2929 #[serde(default, skip_serializing_if = "Option::is_none")]
2931 pub limit: Option<Box<Expression>>,
2932 #[serde(default, skip_serializing_if = "Option::is_none")]
2934 pub ignore_nulls: Option<bool>,
2935}
2936
2937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2944#[cfg_attr(feature = "bindings", derive(TS))]
2945pub struct WindowFunction {
2946 pub this: Expression,
2948 pub over: Over,
2950 #[serde(default, skip_serializing_if = "Option::is_none")]
2952 pub keep: Option<Keep>,
2953}
2954
2955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2958#[cfg_attr(feature = "bindings", derive(TS))]
2959pub struct Keep {
2960 pub first: bool,
2962 pub order_by: Vec<Ordered>,
2964}
2965
2966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2968#[cfg_attr(feature = "bindings", derive(TS))]
2969pub struct WithinGroup {
2970 pub this: Expression,
2972 pub order_by: Vec<Ordered>,
2974}
2975
2976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2981#[cfg_attr(feature = "bindings", derive(TS))]
2982pub struct From {
2983 pub expressions: Vec<Expression>,
2985}
2986
2987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2993#[cfg_attr(feature = "bindings", derive(TS))]
2994pub struct Join {
2995 pub this: Expression,
2997 pub on: Option<Expression>,
2999 pub using: Vec<Identifier>,
3001 pub kind: JoinKind,
3003 pub use_inner_keyword: bool,
3005 pub use_outer_keyword: bool,
3007 pub deferred_condition: bool,
3009 #[serde(default, skip_serializing_if = "Option::is_none")]
3011 pub join_hint: Option<String>,
3012 #[serde(default, skip_serializing_if = "Option::is_none")]
3014 pub match_condition: Option<Expression>,
3015 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3017 pub pivots: Vec<Expression>,
3018 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3020 pub comments: Vec<String>,
3021 #[serde(default)]
3025 pub nesting_group: usize,
3026 #[serde(default)]
3028 pub directed: bool,
3029}
3030
3031#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3038#[cfg_attr(feature = "bindings", derive(TS))]
3039pub enum JoinKind {
3040 Inner,
3041 Left,
3042 Right,
3043 Full,
3044 Outer, Cross,
3046 Natural,
3047 NaturalLeft,
3048 NaturalRight,
3049 NaturalFull,
3050 Semi,
3051 Anti,
3052 LeftSemi,
3054 LeftAnti,
3055 RightSemi,
3056 RightAnti,
3057 CrossApply,
3059 OuterApply,
3060 AsOf,
3062 AsOfLeft,
3063 AsOfRight,
3064 Lateral,
3066 LeftLateral,
3067 Straight,
3069 Implicit,
3071 Array,
3073 LeftArray,
3074 Paste,
3076}
3077
3078impl Default for JoinKind {
3079 fn default() -> Self {
3080 JoinKind::Inner
3081 }
3082}
3083
3084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3087#[cfg_attr(feature = "bindings", derive(TS))]
3088pub struct JoinedTable {
3089 pub left: Expression,
3091 pub joins: Vec<Join>,
3093 pub lateral_views: Vec<LateralView>,
3095 pub alias: Option<Identifier>,
3097}
3098
3099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3101#[cfg_attr(feature = "bindings", derive(TS))]
3102pub struct Where {
3103 pub this: Expression,
3105}
3106
3107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3112#[cfg_attr(feature = "bindings", derive(TS))]
3113pub struct GroupBy {
3114 pub expressions: Vec<Expression>,
3116 #[serde(default)]
3118 pub all: Option<bool>,
3119 #[serde(default)]
3121 pub totals: bool,
3122 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3124 pub comments: Vec<String>,
3125}
3126
3127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3129#[cfg_attr(feature = "bindings", derive(TS))]
3130pub struct Having {
3131 pub this: Expression,
3133 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3135 pub comments: Vec<String>,
3136}
3137
3138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3140#[cfg_attr(feature = "bindings", derive(TS))]
3141pub struct OrderBy {
3142 pub expressions: Vec<Ordered>,
3144 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3146 pub siblings: bool,
3147 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3149 pub comments: Vec<String>,
3150}
3151
3152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3159#[cfg_attr(feature = "bindings", derive(TS))]
3160pub struct Ordered {
3161 pub this: Expression,
3163 pub desc: bool,
3165 pub nulls_first: Option<bool>,
3167 #[serde(default)]
3169 pub explicit_asc: bool,
3170 #[serde(default, skip_serializing_if = "Option::is_none")]
3172 pub with_fill: Option<Box<WithFill>>,
3173}
3174
3175impl Ordered {
3176 pub fn asc(expr: Expression) -> Self {
3177 Self {
3178 this: expr,
3179 desc: false,
3180 nulls_first: None,
3181 explicit_asc: false,
3182 with_fill: None,
3183 }
3184 }
3185
3186 pub fn desc(expr: Expression) -> Self {
3187 Self {
3188 this: expr,
3189 desc: true,
3190 nulls_first: None,
3191 explicit_asc: false,
3192 with_fill: None,
3193 }
3194 }
3195}
3196
3197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3200#[cfg_attr(feature = "bindings", derive(TS))]
3201#[cfg_attr(feature = "bindings", ts(export))]
3202pub struct DistributeBy {
3203 pub expressions: Vec<Expression>,
3204}
3205
3206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3209#[cfg_attr(feature = "bindings", derive(TS))]
3210#[cfg_attr(feature = "bindings", ts(export))]
3211pub struct ClusterBy {
3212 pub expressions: Vec<Ordered>,
3213}
3214
3215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3218#[cfg_attr(feature = "bindings", derive(TS))]
3219#[cfg_attr(feature = "bindings", ts(export))]
3220pub struct SortBy {
3221 pub expressions: Vec<Ordered>,
3222}
3223
3224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3227#[cfg_attr(feature = "bindings", derive(TS))]
3228#[cfg_attr(feature = "bindings", ts(export))]
3229pub struct LateralView {
3230 pub this: Expression,
3232 pub table_alias: Option<Identifier>,
3234 pub column_aliases: Vec<Identifier>,
3236 pub outer: bool,
3238}
3239
3240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3242#[cfg_attr(feature = "bindings", derive(TS))]
3243#[cfg_attr(feature = "bindings", ts(export))]
3244pub struct Hint {
3245 pub expressions: Vec<HintExpression>,
3246}
3247
3248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3250#[cfg_attr(feature = "bindings", derive(TS))]
3251#[cfg_attr(feature = "bindings", ts(export))]
3252pub enum HintExpression {
3253 Function { name: String, args: Vec<Expression> },
3255 Identifier(String),
3257 Raw(String),
3259}
3260
3261#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3263#[cfg_attr(feature = "bindings", derive(TS))]
3264#[cfg_attr(feature = "bindings", ts(export))]
3265pub enum PseudocolumnType {
3266 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
3273
3274impl PseudocolumnType {
3275 pub fn as_str(&self) -> &'static str {
3276 match self {
3277 PseudocolumnType::Rownum => "ROWNUM",
3278 PseudocolumnType::Rowid => "ROWID",
3279 PseudocolumnType::Level => "LEVEL",
3280 PseudocolumnType::Sysdate => "SYSDATE",
3281 PseudocolumnType::ObjectId => "OBJECT_ID",
3282 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
3283 }
3284 }
3285
3286 pub fn from_str(s: &str) -> Option<Self> {
3287 match s.to_uppercase().as_str() {
3288 "ROWNUM" => Some(PseudocolumnType::Rownum),
3289 "ROWID" => Some(PseudocolumnType::Rowid),
3290 "LEVEL" => Some(PseudocolumnType::Level),
3291 "SYSDATE" => Some(PseudocolumnType::Sysdate),
3292 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
3293 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
3294 _ => None,
3295 }
3296 }
3297}
3298
3299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3302#[cfg_attr(feature = "bindings", derive(TS))]
3303#[cfg_attr(feature = "bindings", ts(export))]
3304pub struct Pseudocolumn {
3305 pub kind: PseudocolumnType,
3306}
3307
3308impl Pseudocolumn {
3309 pub fn rownum() -> Self {
3310 Self {
3311 kind: PseudocolumnType::Rownum,
3312 }
3313 }
3314
3315 pub fn rowid() -> Self {
3316 Self {
3317 kind: PseudocolumnType::Rowid,
3318 }
3319 }
3320
3321 pub fn level() -> Self {
3322 Self {
3323 kind: PseudocolumnType::Level,
3324 }
3325 }
3326}
3327
3328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3330#[cfg_attr(feature = "bindings", derive(TS))]
3331#[cfg_attr(feature = "bindings", ts(export))]
3332pub struct Connect {
3333 pub start: Option<Expression>,
3335 pub connect: Expression,
3337 pub nocycle: bool,
3339}
3340
3341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3343#[cfg_attr(feature = "bindings", derive(TS))]
3344#[cfg_attr(feature = "bindings", ts(export))]
3345pub struct Prior {
3346 pub this: Expression,
3347}
3348
3349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3351#[cfg_attr(feature = "bindings", derive(TS))]
3352#[cfg_attr(feature = "bindings", ts(export))]
3353pub struct ConnectByRoot {
3354 pub this: Expression,
3355}
3356
3357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3359#[cfg_attr(feature = "bindings", derive(TS))]
3360#[cfg_attr(feature = "bindings", ts(export))]
3361pub struct MatchRecognize {
3362 pub this: Option<Box<Expression>>,
3364 pub partition_by: Option<Vec<Expression>>,
3366 pub order_by: Option<Vec<Ordered>>,
3368 pub measures: Option<Vec<MatchRecognizeMeasure>>,
3370 pub rows: Option<MatchRecognizeRows>,
3372 pub after: Option<MatchRecognizeAfter>,
3374 pub pattern: Option<String>,
3376 pub define: Option<Vec<(Identifier, Expression)>>,
3378 pub alias: Option<Identifier>,
3380 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3382 pub alias_explicit_as: bool,
3383}
3384
3385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3387#[cfg_attr(feature = "bindings", derive(TS))]
3388#[cfg_attr(feature = "bindings", ts(export))]
3389pub struct MatchRecognizeMeasure {
3390 pub this: Expression,
3392 pub window_frame: Option<MatchRecognizeSemantics>,
3394}
3395
3396#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3398#[cfg_attr(feature = "bindings", derive(TS))]
3399#[cfg_attr(feature = "bindings", ts(export))]
3400pub enum MatchRecognizeSemantics {
3401 Running,
3402 Final,
3403}
3404
3405#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3407#[cfg_attr(feature = "bindings", derive(TS))]
3408#[cfg_attr(feature = "bindings", ts(export))]
3409pub enum MatchRecognizeRows {
3410 OneRowPerMatch,
3411 AllRowsPerMatch,
3412 AllRowsPerMatchShowEmptyMatches,
3413 AllRowsPerMatchOmitEmptyMatches,
3414 AllRowsPerMatchWithUnmatchedRows,
3415}
3416
3417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3419#[cfg_attr(feature = "bindings", derive(TS))]
3420#[cfg_attr(feature = "bindings", ts(export))]
3421pub enum MatchRecognizeAfter {
3422 PastLastRow,
3423 ToNextRow,
3424 ToFirst(Identifier),
3425 ToLast(Identifier),
3426}
3427
3428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3430#[cfg_attr(feature = "bindings", derive(TS))]
3431pub struct Limit {
3432 pub this: Expression,
3434 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3436 pub percent: bool,
3437 #[serde(default)]
3439 #[serde(skip_serializing_if = "Vec::is_empty")]
3440 pub comments: Vec<String>,
3441}
3442
3443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3445#[cfg_attr(feature = "bindings", derive(TS))]
3446pub struct Offset {
3447 pub this: Expression,
3448 #[serde(skip_serializing_if = "Option::is_none", default)]
3450 pub rows: Option<bool>,
3451}
3452
3453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3455#[cfg_attr(feature = "bindings", derive(TS))]
3456pub struct Top {
3457 pub this: Expression,
3458 pub percent: bool,
3459 pub with_ties: bool,
3460 #[serde(default)]
3462 pub parenthesized: bool,
3463}
3464
3465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3467#[cfg_attr(feature = "bindings", derive(TS))]
3468pub struct Fetch {
3469 pub direction: String,
3471 pub count: Option<Expression>,
3473 pub percent: bool,
3475 pub rows: bool,
3477 pub with_ties: bool,
3479}
3480
3481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3487#[cfg_attr(feature = "bindings", derive(TS))]
3488pub struct Qualify {
3489 pub this: Expression,
3491}
3492
3493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3495#[cfg_attr(feature = "bindings", derive(TS))]
3496pub struct Sample {
3497 pub method: SampleMethod,
3498 pub size: Expression,
3499 pub seed: Option<Expression>,
3500 #[serde(default)]
3502 pub offset: Option<Expression>,
3503 pub unit_after_size: bool,
3505 #[serde(default)]
3507 pub use_sample_keyword: bool,
3508 #[serde(default)]
3510 pub explicit_method: bool,
3511 #[serde(default)]
3513 pub method_before_size: bool,
3514 #[serde(default)]
3516 pub use_seed_keyword: bool,
3517 pub bucket_numerator: Option<Box<Expression>>,
3519 pub bucket_denominator: Option<Box<Expression>>,
3521 pub bucket_field: Option<Box<Expression>>,
3523 #[serde(default)]
3525 pub is_using_sample: bool,
3526 #[serde(default)]
3528 pub is_percent: bool,
3529 #[serde(default)]
3531 pub suppress_method_output: bool,
3532}
3533
3534#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3536#[cfg_attr(feature = "bindings", derive(TS))]
3537pub enum SampleMethod {
3538 Bernoulli,
3539 System,
3540 Block,
3541 Row,
3542 Percent,
3543 Bucket,
3545 Reservoir,
3547}
3548
3549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3551#[cfg_attr(feature = "bindings", derive(TS))]
3552pub struct NamedWindow {
3553 pub name: Identifier,
3554 pub spec: Over,
3555}
3556
3557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3563#[cfg_attr(feature = "bindings", derive(TS))]
3564pub struct With {
3565 pub ctes: Vec<Cte>,
3567 pub recursive: bool,
3569 #[serde(default)]
3571 pub leading_comments: Vec<String>,
3572 #[serde(default, skip_serializing_if = "Option::is_none")]
3574 pub search: Option<Box<Expression>>,
3575}
3576
3577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3584#[cfg_attr(feature = "bindings", derive(TS))]
3585pub struct Cte {
3586 pub alias: Identifier,
3588 pub this: Expression,
3590 pub columns: Vec<Identifier>,
3592 pub materialized: Option<bool>,
3594 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3596 pub key_expressions: Vec<Identifier>,
3597 #[serde(default)]
3599 pub alias_first: bool,
3600 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3602 pub comments: Vec<String>,
3603}
3604
3605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3607#[cfg_attr(feature = "bindings", derive(TS))]
3608pub struct WindowSpec {
3609 pub partition_by: Vec<Expression>,
3610 pub order_by: Vec<Ordered>,
3611 pub frame: Option<WindowFrame>,
3612}
3613
3614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3616#[cfg_attr(feature = "bindings", derive(TS))]
3617pub struct Over {
3618 pub window_name: Option<Identifier>,
3620 pub partition_by: Vec<Expression>,
3621 pub order_by: Vec<Ordered>,
3622 pub frame: Option<WindowFrame>,
3623 pub alias: Option<Identifier>,
3624}
3625
3626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3628#[cfg_attr(feature = "bindings", derive(TS))]
3629pub struct WindowFrame {
3630 pub kind: WindowFrameKind,
3631 pub start: WindowFrameBound,
3632 pub end: Option<WindowFrameBound>,
3633 pub exclude: Option<WindowFrameExclude>,
3634 #[serde(default, skip_serializing_if = "Option::is_none")]
3636 pub kind_text: Option<String>,
3637 #[serde(default, skip_serializing_if = "Option::is_none")]
3639 pub start_side_text: Option<String>,
3640 #[serde(default, skip_serializing_if = "Option::is_none")]
3642 pub end_side_text: Option<String>,
3643}
3644
3645#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3646#[cfg_attr(feature = "bindings", derive(TS))]
3647pub enum WindowFrameKind {
3648 Rows,
3649 Range,
3650 Groups,
3651}
3652
3653#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3655#[cfg_attr(feature = "bindings", derive(TS))]
3656pub enum WindowFrameExclude {
3657 CurrentRow,
3658 Group,
3659 Ties,
3660 NoOthers,
3661}
3662
3663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3664#[cfg_attr(feature = "bindings", derive(TS))]
3665pub enum WindowFrameBound {
3666 CurrentRow,
3667 UnboundedPreceding,
3668 UnboundedFollowing,
3669 Preceding(Box<Expression>),
3670 Following(Box<Expression>),
3671 BarePreceding,
3673 BareFollowing,
3675 Value(Box<Expression>),
3677}
3678
3679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3681#[cfg_attr(feature = "bindings", derive(TS))]
3682pub struct StructField {
3683 pub name: String,
3684 pub data_type: DataType,
3685 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3686 pub options: Vec<Expression>,
3687 #[serde(default, skip_serializing_if = "Option::is_none")]
3688 pub comment: Option<String>,
3689}
3690
3691impl StructField {
3692 pub fn new(name: String, data_type: DataType) -> Self {
3694 Self {
3695 name,
3696 data_type,
3697 options: Vec::new(),
3698 comment: None,
3699 }
3700 }
3701
3702 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
3704 Self {
3705 name,
3706 data_type,
3707 options,
3708 comment: None,
3709 }
3710 }
3711
3712 pub fn with_options_and_comment(
3714 name: String,
3715 data_type: DataType,
3716 options: Vec<Expression>,
3717 comment: Option<String>,
3718 ) -> Self {
3719 Self {
3720 name,
3721 data_type,
3722 options,
3723 comment,
3724 }
3725 }
3726}
3727
3728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3740#[cfg_attr(feature = "bindings", derive(TS))]
3741#[serde(tag = "data_type", rename_all = "snake_case")]
3742pub enum DataType {
3743 Boolean,
3745 TinyInt {
3746 length: Option<u32>,
3747 },
3748 SmallInt {
3749 length: Option<u32>,
3750 },
3751 Int {
3755 length: Option<u32>,
3756 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3757 integer_spelling: bool,
3758 },
3759 BigInt {
3760 length: Option<u32>,
3761 },
3762 Float {
3766 precision: Option<u32>,
3767 scale: Option<u32>,
3768 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3769 real_spelling: bool,
3770 },
3771 Double {
3772 precision: Option<u32>,
3773 scale: Option<u32>,
3774 },
3775 Decimal {
3776 precision: Option<u32>,
3777 scale: Option<u32>,
3778 },
3779
3780 Char {
3782 length: Option<u32>,
3783 },
3784 VarChar {
3787 length: Option<u32>,
3788 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3789 parenthesized_length: bool,
3790 },
3791 String {
3793 length: Option<u32>,
3794 },
3795 Text,
3796 TextWithLength {
3798 length: u32,
3799 },
3800
3801 Binary {
3803 length: Option<u32>,
3804 },
3805 VarBinary {
3806 length: Option<u32>,
3807 },
3808 Blob,
3809
3810 Bit {
3812 length: Option<u32>,
3813 },
3814 VarBit {
3815 length: Option<u32>,
3816 },
3817
3818 Date,
3820 Time {
3821 precision: Option<u32>,
3822 #[serde(default)]
3823 timezone: bool,
3824 },
3825 Timestamp {
3826 precision: Option<u32>,
3827 timezone: bool,
3828 },
3829 Interval {
3830 unit: Option<String>,
3831 #[serde(default, skip_serializing_if = "Option::is_none")]
3833 to: Option<String>,
3834 },
3835
3836 Json,
3838 JsonB,
3839
3840 Uuid,
3842
3843 Array {
3845 element_type: Box<DataType>,
3846 #[serde(default, skip_serializing_if = "Option::is_none")]
3848 dimension: Option<u32>,
3849 },
3850
3851 List {
3854 element_type: Box<DataType>,
3855 },
3856
3857 Struct {
3861 fields: Vec<StructField>,
3862 nested: bool,
3863 },
3864 Map {
3865 key_type: Box<DataType>,
3866 value_type: Box<DataType>,
3867 },
3868
3869 Enum {
3871 values: Vec<String>,
3872 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3873 assignments: Vec<Option<String>>,
3874 },
3875
3876 Set {
3878 values: Vec<String>,
3879 },
3880
3881 Union {
3883 fields: Vec<(String, DataType)>,
3884 },
3885
3886 Vector {
3888 #[serde(default)]
3889 element_type: Option<Box<DataType>>,
3890 dimension: Option<u32>,
3891 },
3892
3893 Object {
3896 fields: Vec<(String, DataType, bool)>,
3897 modifier: Option<String>,
3898 },
3899
3900 Nullable {
3902 inner: Box<DataType>,
3903 },
3904
3905 Custom {
3907 name: String,
3908 },
3909
3910 Geometry {
3912 subtype: Option<String>,
3913 srid: Option<u32>,
3914 },
3915 Geography {
3916 subtype: Option<String>,
3917 srid: Option<u32>,
3918 },
3919
3920 CharacterSet {
3923 name: String,
3924 },
3925
3926 Unknown,
3928}
3929
3930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3932#[cfg_attr(feature = "bindings", derive(TS))]
3933#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
3934pub struct Array {
3935 pub expressions: Vec<Expression>,
3936}
3937
3938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3940#[cfg_attr(feature = "bindings", derive(TS))]
3941pub struct Struct {
3942 pub fields: Vec<(Option<String>, Expression)>,
3943}
3944
3945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3947#[cfg_attr(feature = "bindings", derive(TS))]
3948pub struct Tuple {
3949 pub expressions: Vec<Expression>,
3950}
3951
3952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3954#[cfg_attr(feature = "bindings", derive(TS))]
3955pub struct Interval {
3956 pub this: Option<Expression>,
3958 pub unit: Option<IntervalUnitSpec>,
3960}
3961
3962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3964#[cfg_attr(feature = "bindings", derive(TS))]
3965#[serde(tag = "type", rename_all = "snake_case")]
3966pub enum IntervalUnitSpec {
3967 Simple {
3969 unit: IntervalUnit,
3970 use_plural: bool,
3972 },
3973 Span(IntervalSpan),
3975 ExprSpan(IntervalSpanExpr),
3978 Expr(Box<Expression>),
3980}
3981
3982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3984#[cfg_attr(feature = "bindings", derive(TS))]
3985pub struct IntervalSpan {
3986 pub this: IntervalUnit,
3988 pub expression: IntervalUnit,
3990}
3991
3992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3995#[cfg_attr(feature = "bindings", derive(TS))]
3996pub struct IntervalSpanExpr {
3997 pub this: Box<Expression>,
3999 pub expression: Box<Expression>,
4001}
4002
4003#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4004#[cfg_attr(feature = "bindings", derive(TS))]
4005pub enum IntervalUnit {
4006 Year,
4007 Quarter,
4008 Month,
4009 Week,
4010 Day,
4011 Hour,
4012 Minute,
4013 Second,
4014 Millisecond,
4015 Microsecond,
4016 Nanosecond,
4017}
4018
4019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4021#[cfg_attr(feature = "bindings", derive(TS))]
4022pub struct Command {
4023 pub this: String,
4025}
4026
4027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4030#[cfg_attr(feature = "bindings", derive(TS))]
4031pub struct ExecuteStatement {
4032 pub this: Expression,
4034 #[serde(default)]
4036 pub parameters: Vec<ExecuteParameter>,
4037}
4038
4039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4041#[cfg_attr(feature = "bindings", derive(TS))]
4042pub struct ExecuteParameter {
4043 pub name: String,
4045 pub value: Expression,
4047}
4048
4049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4052#[cfg_attr(feature = "bindings", derive(TS))]
4053pub struct Kill {
4054 pub this: Expression,
4056 pub kind: Option<String>,
4058}
4059
4060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4062#[cfg_attr(feature = "bindings", derive(TS))]
4063pub struct Raw {
4064 pub sql: String,
4065}
4066
4067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4073#[cfg_attr(feature = "bindings", derive(TS))]
4074pub struct UnaryFunc {
4075 pub this: Expression,
4076 #[serde(skip_serializing_if = "Option::is_none", default)]
4078 pub original_name: Option<String>,
4079}
4080
4081impl UnaryFunc {
4082 pub fn new(this: Expression) -> Self {
4084 Self {
4085 this,
4086 original_name: None,
4087 }
4088 }
4089
4090 pub fn with_name(this: Expression, name: String) -> Self {
4092 Self {
4093 this,
4094 original_name: Some(name),
4095 }
4096 }
4097}
4098
4099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4103#[cfg_attr(feature = "bindings", derive(TS))]
4104pub struct CharFunc {
4105 pub args: Vec<Expression>,
4106 #[serde(skip_serializing_if = "Option::is_none", default)]
4107 pub charset: Option<String>,
4108 #[serde(skip_serializing_if = "Option::is_none", default)]
4110 pub name: Option<String>,
4111}
4112
4113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4115#[cfg_attr(feature = "bindings", derive(TS))]
4116pub struct BinaryFunc {
4117 pub this: Expression,
4118 pub expression: Expression,
4119 #[serde(skip_serializing_if = "Option::is_none", default)]
4121 pub original_name: Option<String>,
4122}
4123
4124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4126#[cfg_attr(feature = "bindings", derive(TS))]
4127pub struct VarArgFunc {
4128 pub expressions: Vec<Expression>,
4129 #[serde(skip_serializing_if = "Option::is_none", default)]
4131 pub original_name: Option<String>,
4132}
4133
4134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4136#[cfg_attr(feature = "bindings", derive(TS))]
4137pub struct ConcatWs {
4138 pub separator: Expression,
4139 pub expressions: Vec<Expression>,
4140}
4141
4142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4144#[cfg_attr(feature = "bindings", derive(TS))]
4145pub struct SubstringFunc {
4146 pub this: Expression,
4147 pub start: Expression,
4148 pub length: Option<Expression>,
4149 #[serde(default)]
4151 pub from_for_syntax: bool,
4152}
4153
4154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4156#[cfg_attr(feature = "bindings", derive(TS))]
4157pub struct OverlayFunc {
4158 pub this: Expression,
4159 pub replacement: Expression,
4160 pub from: Expression,
4161 pub length: Option<Expression>,
4162}
4163
4164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4166#[cfg_attr(feature = "bindings", derive(TS))]
4167pub struct TrimFunc {
4168 pub this: Expression,
4169 pub characters: Option<Expression>,
4170 pub position: TrimPosition,
4171 #[serde(default)]
4173 pub sql_standard_syntax: bool,
4174 #[serde(default)]
4176 pub position_explicit: bool,
4177}
4178
4179#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4180#[cfg_attr(feature = "bindings", derive(TS))]
4181pub enum TrimPosition {
4182 Both,
4183 Leading,
4184 Trailing,
4185}
4186
4187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4189#[cfg_attr(feature = "bindings", derive(TS))]
4190pub struct ReplaceFunc {
4191 pub this: Expression,
4192 pub old: Expression,
4193 pub new: Expression,
4194}
4195
4196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4198#[cfg_attr(feature = "bindings", derive(TS))]
4199pub struct LeftRightFunc {
4200 pub this: Expression,
4201 pub length: Expression,
4202}
4203
4204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4206#[cfg_attr(feature = "bindings", derive(TS))]
4207pub struct RepeatFunc {
4208 pub this: Expression,
4209 pub times: Expression,
4210}
4211
4212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4214#[cfg_attr(feature = "bindings", derive(TS))]
4215pub struct PadFunc {
4216 pub this: Expression,
4217 pub length: Expression,
4218 pub fill: Option<Expression>,
4219}
4220
4221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4223#[cfg_attr(feature = "bindings", derive(TS))]
4224pub struct SplitFunc {
4225 pub this: Expression,
4226 pub delimiter: Expression,
4227}
4228
4229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4231#[cfg_attr(feature = "bindings", derive(TS))]
4232pub struct RegexpFunc {
4233 pub this: Expression,
4234 pub pattern: Expression,
4235 pub flags: Option<Expression>,
4236}
4237
4238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4240#[cfg_attr(feature = "bindings", derive(TS))]
4241pub struct RegexpReplaceFunc {
4242 pub this: Expression,
4243 pub pattern: Expression,
4244 pub replacement: Expression,
4245 pub flags: Option<Expression>,
4246}
4247
4248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4250#[cfg_attr(feature = "bindings", derive(TS))]
4251pub struct RegexpExtractFunc {
4252 pub this: Expression,
4253 pub pattern: Expression,
4254 pub group: Option<Expression>,
4255}
4256
4257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4259#[cfg_attr(feature = "bindings", derive(TS))]
4260pub struct RoundFunc {
4261 pub this: Expression,
4262 pub decimals: Option<Expression>,
4263}
4264
4265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4267#[cfg_attr(feature = "bindings", derive(TS))]
4268pub struct FloorFunc {
4269 pub this: Expression,
4270 pub scale: Option<Expression>,
4271 #[serde(skip_serializing_if = "Option::is_none", default)]
4273 pub to: Option<Expression>,
4274}
4275
4276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4278#[cfg_attr(feature = "bindings", derive(TS))]
4279pub struct CeilFunc {
4280 pub this: Expression,
4281 #[serde(skip_serializing_if = "Option::is_none", default)]
4282 pub decimals: Option<Expression>,
4283 #[serde(skip_serializing_if = "Option::is_none", default)]
4285 pub to: Option<Expression>,
4286}
4287
4288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4290#[cfg_attr(feature = "bindings", derive(TS))]
4291pub struct LogFunc {
4292 pub this: Expression,
4293 pub base: Option<Expression>,
4294}
4295
4296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4298#[cfg_attr(feature = "bindings", derive(TS))]
4299pub struct CurrentDate;
4300
4301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4303#[cfg_attr(feature = "bindings", derive(TS))]
4304pub struct CurrentTime {
4305 pub precision: Option<u32>,
4306}
4307
4308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4310#[cfg_attr(feature = "bindings", derive(TS))]
4311pub struct CurrentTimestamp {
4312 pub precision: Option<u32>,
4313 #[serde(default)]
4315 pub sysdate: bool,
4316}
4317
4318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4320#[cfg_attr(feature = "bindings", derive(TS))]
4321pub struct CurrentTimestampLTZ {
4322 pub precision: Option<u32>,
4323}
4324
4325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4327#[cfg_attr(feature = "bindings", derive(TS))]
4328pub struct AtTimeZone {
4329 pub this: Expression,
4331 pub zone: Expression,
4333}
4334
4335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4337#[cfg_attr(feature = "bindings", derive(TS))]
4338pub struct DateAddFunc {
4339 pub this: Expression,
4340 pub interval: Expression,
4341 pub unit: IntervalUnit,
4342}
4343
4344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4346#[cfg_attr(feature = "bindings", derive(TS))]
4347pub struct DateDiffFunc {
4348 pub this: Expression,
4349 pub expression: Expression,
4350 pub unit: Option<IntervalUnit>,
4351}
4352
4353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4355#[cfg_attr(feature = "bindings", derive(TS))]
4356pub struct DateTruncFunc {
4357 pub this: Expression,
4358 pub unit: DateTimeField,
4359}
4360
4361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4363#[cfg_attr(feature = "bindings", derive(TS))]
4364pub struct ExtractFunc {
4365 pub this: Expression,
4366 pub field: DateTimeField,
4367}
4368
4369#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4370#[cfg_attr(feature = "bindings", derive(TS))]
4371pub enum DateTimeField {
4372 Year,
4373 Month,
4374 Day,
4375 Hour,
4376 Minute,
4377 Second,
4378 Millisecond,
4379 Microsecond,
4380 DayOfWeek,
4381 DayOfYear,
4382 Week,
4383 WeekWithModifier(String),
4385 Quarter,
4386 Epoch,
4387 Timezone,
4388 TimezoneHour,
4389 TimezoneMinute,
4390 Date,
4391 Time,
4392 Custom(String),
4394}
4395
4396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4398#[cfg_attr(feature = "bindings", derive(TS))]
4399pub struct ToDateFunc {
4400 pub this: Expression,
4401 pub format: Option<Expression>,
4402}
4403
4404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4406#[cfg_attr(feature = "bindings", derive(TS))]
4407pub struct ToTimestampFunc {
4408 pub this: Expression,
4409 pub format: Option<Expression>,
4410}
4411
4412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4414#[cfg_attr(feature = "bindings", derive(TS))]
4415pub struct IfFunc {
4416 pub condition: Expression,
4417 pub true_value: Expression,
4418 pub false_value: Option<Expression>,
4419 #[serde(skip_serializing_if = "Option::is_none", default)]
4421 pub original_name: Option<String>,
4422}
4423
4424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4426#[cfg_attr(feature = "bindings", derive(TS))]
4427pub struct Nvl2Func {
4428 pub this: Expression,
4429 pub true_value: Expression,
4430 pub false_value: Expression,
4431}
4432
4433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4439#[cfg_attr(feature = "bindings", derive(TS))]
4440pub struct AggFunc {
4441 pub this: Expression,
4442 pub distinct: bool,
4443 pub filter: Option<Expression>,
4444 pub order_by: Vec<Ordered>,
4445 #[serde(skip_serializing_if = "Option::is_none", default)]
4447 pub name: Option<String>,
4448 #[serde(skip_serializing_if = "Option::is_none", default)]
4450 pub ignore_nulls: Option<bool>,
4451 #[serde(skip_serializing_if = "Option::is_none", default)]
4454 pub having_max: Option<(Box<Expression>, bool)>,
4455 #[serde(skip_serializing_if = "Option::is_none", default)]
4457 pub limit: Option<Box<Expression>>,
4458}
4459
4460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4462#[cfg_attr(feature = "bindings", derive(TS))]
4463pub struct CountFunc {
4464 pub this: Option<Expression>,
4465 pub star: bool,
4466 pub distinct: bool,
4467 pub filter: Option<Expression>,
4468 #[serde(default, skip_serializing_if = "Option::is_none")]
4470 pub ignore_nulls: Option<bool>,
4471 #[serde(default, skip_serializing_if = "Option::is_none")]
4473 pub original_name: Option<String>,
4474}
4475
4476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4478#[cfg_attr(feature = "bindings", derive(TS))]
4479pub struct GroupConcatFunc {
4480 pub this: Expression,
4481 pub separator: Option<Expression>,
4482 pub order_by: Option<Vec<Ordered>>,
4483 pub distinct: bool,
4484 pub filter: Option<Expression>,
4485}
4486
4487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4489#[cfg_attr(feature = "bindings", derive(TS))]
4490pub struct StringAggFunc {
4491 pub this: Expression,
4492 #[serde(default)]
4493 pub separator: Option<Expression>,
4494 #[serde(default)]
4495 pub order_by: Option<Vec<Ordered>>,
4496 #[serde(default)]
4497 pub distinct: bool,
4498 #[serde(default)]
4499 pub filter: Option<Expression>,
4500 #[serde(default, skip_serializing_if = "Option::is_none")]
4502 pub limit: Option<Box<Expression>>,
4503}
4504
4505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4507#[cfg_attr(feature = "bindings", derive(TS))]
4508pub struct ListAggFunc {
4509 pub this: Expression,
4510 pub separator: Option<Expression>,
4511 pub on_overflow: Option<ListAggOverflow>,
4512 pub order_by: Option<Vec<Ordered>>,
4513 pub distinct: bool,
4514 pub filter: Option<Expression>,
4515}
4516
4517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4519#[cfg_attr(feature = "bindings", derive(TS))]
4520pub enum ListAggOverflow {
4521 Error,
4522 Truncate {
4523 filler: Option<Expression>,
4524 with_count: bool,
4525 },
4526}
4527
4528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4530#[cfg_attr(feature = "bindings", derive(TS))]
4531pub struct SumIfFunc {
4532 pub this: Expression,
4533 pub condition: Expression,
4534 pub filter: Option<Expression>,
4535}
4536
4537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4539#[cfg_attr(feature = "bindings", derive(TS))]
4540pub struct ApproxPercentileFunc {
4541 pub this: Expression,
4542 pub percentile: Expression,
4543 pub accuracy: Option<Expression>,
4544 pub filter: Option<Expression>,
4545}
4546
4547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4549#[cfg_attr(feature = "bindings", derive(TS))]
4550pub struct PercentileFunc {
4551 pub this: Expression,
4552 pub percentile: Expression,
4553 pub order_by: Option<Vec<Ordered>>,
4554 pub filter: Option<Expression>,
4555}
4556
4557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4563#[cfg_attr(feature = "bindings", derive(TS))]
4564pub struct RowNumber;
4565
4566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4568#[cfg_attr(feature = "bindings", derive(TS))]
4569pub struct Rank {
4570 #[serde(default, skip_serializing_if = "Option::is_none")]
4572 pub order_by: Option<Vec<Ordered>>,
4573 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4575 pub args: Vec<Expression>,
4576}
4577
4578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4580#[cfg_attr(feature = "bindings", derive(TS))]
4581pub struct DenseRank {
4582 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4584 pub args: Vec<Expression>,
4585}
4586
4587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4589#[cfg_attr(feature = "bindings", derive(TS))]
4590pub struct NTileFunc {
4591 #[serde(default, skip_serializing_if = "Option::is_none")]
4593 pub num_buckets: Option<Expression>,
4594 #[serde(default, skip_serializing_if = "Option::is_none")]
4596 pub order_by: Option<Vec<Ordered>>,
4597}
4598
4599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4601#[cfg_attr(feature = "bindings", derive(TS))]
4602pub struct LeadLagFunc {
4603 pub this: Expression,
4604 pub offset: Option<Expression>,
4605 pub default: Option<Expression>,
4606 pub ignore_nulls: bool,
4607}
4608
4609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4611#[cfg_attr(feature = "bindings", derive(TS))]
4612pub struct ValueFunc {
4613 pub this: Expression,
4614 #[serde(default, skip_serializing_if = "Option::is_none")]
4616 pub ignore_nulls: Option<bool>,
4617}
4618
4619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4621#[cfg_attr(feature = "bindings", derive(TS))]
4622pub struct NthValueFunc {
4623 pub this: Expression,
4624 pub offset: Expression,
4625 #[serde(default, skip_serializing_if = "Option::is_none")]
4627 pub ignore_nulls: Option<bool>,
4628 #[serde(default, skip_serializing_if = "Option::is_none")]
4631 pub from_first: Option<bool>,
4632}
4633
4634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4636#[cfg_attr(feature = "bindings", derive(TS))]
4637pub struct PercentRank {
4638 #[serde(default, skip_serializing_if = "Option::is_none")]
4640 pub order_by: Option<Vec<Ordered>>,
4641 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4643 pub args: Vec<Expression>,
4644}
4645
4646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4648#[cfg_attr(feature = "bindings", derive(TS))]
4649pub struct CumeDist {
4650 #[serde(default, skip_serializing_if = "Option::is_none")]
4652 pub order_by: Option<Vec<Ordered>>,
4653 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4655 pub args: Vec<Expression>,
4656}
4657
4658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4664#[cfg_attr(feature = "bindings", derive(TS))]
4665pub struct PositionFunc {
4666 pub substring: Expression,
4667 pub string: Expression,
4668 pub start: Option<Expression>,
4669}
4670
4671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4677#[cfg_attr(feature = "bindings", derive(TS))]
4678pub struct Random;
4679
4680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4682#[cfg_attr(feature = "bindings", derive(TS))]
4683pub struct Rand {
4684 pub seed: Option<Box<Expression>>,
4685 #[serde(default)]
4687 pub lower: Option<Box<Expression>>,
4688 #[serde(default)]
4690 pub upper: Option<Box<Expression>>,
4691}
4692
4693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4695#[cfg_attr(feature = "bindings", derive(TS))]
4696pub struct TruncateFunc {
4697 pub this: Expression,
4698 pub decimals: Option<Expression>,
4699}
4700
4701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4703#[cfg_attr(feature = "bindings", derive(TS))]
4704pub struct Pi;
4705
4706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4712#[cfg_attr(feature = "bindings", derive(TS))]
4713pub struct DecodeFunc {
4714 pub this: Expression,
4715 pub search_results: Vec<(Expression, Expression)>,
4716 pub default: Option<Expression>,
4717}
4718
4719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4725#[cfg_attr(feature = "bindings", derive(TS))]
4726pub struct DateFormatFunc {
4727 pub this: Expression,
4728 pub format: Expression,
4729}
4730
4731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4733#[cfg_attr(feature = "bindings", derive(TS))]
4734pub struct FromUnixtimeFunc {
4735 pub this: Expression,
4736 pub format: Option<Expression>,
4737}
4738
4739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4741#[cfg_attr(feature = "bindings", derive(TS))]
4742pub struct UnixTimestampFunc {
4743 pub this: Option<Expression>,
4744 pub format: Option<Expression>,
4745}
4746
4747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4749#[cfg_attr(feature = "bindings", derive(TS))]
4750pub struct MakeDateFunc {
4751 pub year: Expression,
4752 pub month: Expression,
4753 pub day: Expression,
4754}
4755
4756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4758#[cfg_attr(feature = "bindings", derive(TS))]
4759pub struct MakeTimestampFunc {
4760 pub year: Expression,
4761 pub month: Expression,
4762 pub day: Expression,
4763 pub hour: Expression,
4764 pub minute: Expression,
4765 pub second: Expression,
4766 pub timezone: Option<Expression>,
4767}
4768
4769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4771#[cfg_attr(feature = "bindings", derive(TS))]
4772pub struct LastDayFunc {
4773 pub this: Expression,
4774 #[serde(skip_serializing_if = "Option::is_none", default)]
4776 pub unit: Option<DateTimeField>,
4777}
4778
4779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4785#[cfg_attr(feature = "bindings", derive(TS))]
4786pub struct ArrayConstructor {
4787 pub expressions: Vec<Expression>,
4788 pub bracket_notation: bool,
4789 pub use_list_keyword: bool,
4791}
4792
4793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4795#[cfg_attr(feature = "bindings", derive(TS))]
4796pub struct ArraySortFunc {
4797 pub this: Expression,
4798 pub comparator: Option<Expression>,
4799 pub desc: bool,
4800 pub nulls_first: Option<bool>,
4801}
4802
4803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4805#[cfg_attr(feature = "bindings", derive(TS))]
4806pub struct ArrayJoinFunc {
4807 pub this: Expression,
4808 pub separator: Expression,
4809 pub null_replacement: Option<Expression>,
4810}
4811
4812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4814#[cfg_attr(feature = "bindings", derive(TS))]
4815pub struct UnnestFunc {
4816 pub this: Expression,
4817 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4819 pub expressions: Vec<Expression>,
4820 pub with_ordinality: bool,
4821 pub alias: Option<Identifier>,
4822 #[serde(default, skip_serializing_if = "Option::is_none")]
4824 pub offset_alias: Option<Identifier>,
4825}
4826
4827#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4829#[cfg_attr(feature = "bindings", derive(TS))]
4830pub struct ArrayFilterFunc {
4831 pub this: Expression,
4832 pub filter: Expression,
4833}
4834
4835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4837#[cfg_attr(feature = "bindings", derive(TS))]
4838pub struct ArrayTransformFunc {
4839 pub this: Expression,
4840 pub transform: Expression,
4841}
4842
4843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4845#[cfg_attr(feature = "bindings", derive(TS))]
4846pub struct SequenceFunc {
4847 pub start: Expression,
4848 pub stop: Expression,
4849 pub step: Option<Expression>,
4850}
4851
4852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4858#[cfg_attr(feature = "bindings", derive(TS))]
4859pub struct StructConstructor {
4860 pub fields: Vec<(Option<Identifier>, Expression)>,
4861}
4862
4863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4865#[cfg_attr(feature = "bindings", derive(TS))]
4866pub struct StructExtractFunc {
4867 pub this: Expression,
4868 pub field: Identifier,
4869}
4870
4871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4873#[cfg_attr(feature = "bindings", derive(TS))]
4874pub struct NamedStructFunc {
4875 pub pairs: Vec<(Expression, Expression)>,
4876}
4877
4878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4884#[cfg_attr(feature = "bindings", derive(TS))]
4885pub struct MapConstructor {
4886 pub keys: Vec<Expression>,
4887 pub values: Vec<Expression>,
4888 #[serde(default)]
4890 pub curly_brace_syntax: bool,
4891 #[serde(default)]
4893 pub with_map_keyword: bool,
4894}
4895
4896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4898#[cfg_attr(feature = "bindings", derive(TS))]
4899pub struct TransformFunc {
4900 pub this: Expression,
4901 pub transform: Expression,
4902}
4903
4904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4910#[cfg_attr(feature = "bindings", derive(TS))]
4911pub struct JsonExtractFunc {
4912 pub this: Expression,
4913 pub path: Expression,
4914 pub returning: Option<DataType>,
4915 #[serde(default)]
4917 pub arrow_syntax: bool,
4918 #[serde(default)]
4920 pub hash_arrow_syntax: bool,
4921 #[serde(default)]
4923 pub wrapper_option: Option<String>,
4924 #[serde(default)]
4926 pub quotes_option: Option<String>,
4927 #[serde(default)]
4929 pub on_scalar_string: bool,
4930 #[serde(default)]
4932 pub on_error: Option<String>,
4933}
4934
4935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4937#[cfg_attr(feature = "bindings", derive(TS))]
4938pub struct JsonPathFunc {
4939 pub this: Expression,
4940 pub paths: Vec<Expression>,
4941}
4942
4943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4945#[cfg_attr(feature = "bindings", derive(TS))]
4946pub struct JsonObjectFunc {
4947 pub pairs: Vec<(Expression, Expression)>,
4948 pub null_handling: Option<JsonNullHandling>,
4949 #[serde(default)]
4950 pub with_unique_keys: bool,
4951 #[serde(default)]
4952 pub returning_type: Option<DataType>,
4953 #[serde(default)]
4954 pub format_json: bool,
4955 #[serde(default)]
4956 pub encoding: Option<String>,
4957 #[serde(default)]
4959 pub star: bool,
4960}
4961
4962#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4964#[cfg_attr(feature = "bindings", derive(TS))]
4965pub enum JsonNullHandling {
4966 NullOnNull,
4967 AbsentOnNull,
4968}
4969
4970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4972#[cfg_attr(feature = "bindings", derive(TS))]
4973pub struct JsonModifyFunc {
4974 pub this: Expression,
4975 pub path_values: Vec<(Expression, Expression)>,
4976}
4977
4978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4980#[cfg_attr(feature = "bindings", derive(TS))]
4981pub struct JsonArrayAggFunc {
4982 pub this: Expression,
4983 pub order_by: Option<Vec<Ordered>>,
4984 pub null_handling: Option<JsonNullHandling>,
4985 pub filter: Option<Expression>,
4986}
4987
4988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4990#[cfg_attr(feature = "bindings", derive(TS))]
4991pub struct JsonObjectAggFunc {
4992 pub key: Expression,
4993 pub value: Expression,
4994 pub null_handling: Option<JsonNullHandling>,
4995 pub filter: Option<Expression>,
4996}
4997
4998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5004#[cfg_attr(feature = "bindings", derive(TS))]
5005pub struct ConvertFunc {
5006 pub this: Expression,
5007 pub to: DataType,
5008 pub style: Option<Expression>,
5009}
5010
5011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5017#[cfg_attr(feature = "bindings", derive(TS))]
5018pub struct LambdaExpr {
5019 pub parameters: Vec<Identifier>,
5020 pub body: Expression,
5021 #[serde(default)]
5023 pub colon: bool,
5024 #[serde(default)]
5027 pub parameter_types: Vec<Option<DataType>>,
5028}
5029
5030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5032#[cfg_attr(feature = "bindings", derive(TS))]
5033pub struct Parameter {
5034 pub name: Option<String>,
5035 pub index: Option<u32>,
5036 pub style: ParameterStyle,
5037 #[serde(default)]
5039 pub quoted: bool,
5040 #[serde(default)]
5042 pub string_quoted: bool,
5043 #[serde(default)]
5045 pub expression: Option<String>,
5046}
5047
5048#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5050#[cfg_attr(feature = "bindings", derive(TS))]
5051pub enum ParameterStyle {
5052 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
5062
5063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5065#[cfg_attr(feature = "bindings", derive(TS))]
5066pub struct Placeholder {
5067 pub index: Option<u32>,
5068}
5069
5070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5072#[cfg_attr(feature = "bindings", derive(TS))]
5073pub struct NamedArgument {
5074 pub name: Identifier,
5075 pub value: Expression,
5076 pub separator: NamedArgSeparator,
5078}
5079
5080#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5082#[cfg_attr(feature = "bindings", derive(TS))]
5083pub enum NamedArgSeparator {
5084 DArrow,
5086 ColonEq,
5088 Eq,
5090}
5091
5092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5095#[cfg_attr(feature = "bindings", derive(TS))]
5096pub struct TableArgument {
5097 pub prefix: String,
5099 pub this: Expression,
5101}
5102
5103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5105#[cfg_attr(feature = "bindings", derive(TS))]
5106pub struct SqlComment {
5107 pub text: String,
5108 pub is_block: bool,
5109}
5110
5111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5117#[cfg_attr(feature = "bindings", derive(TS))]
5118pub struct SimilarToExpr {
5119 pub this: Expression,
5120 pub pattern: Expression,
5121 pub escape: Option<Expression>,
5122 pub not: bool,
5123}
5124
5125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5127#[cfg_attr(feature = "bindings", derive(TS))]
5128pub struct QuantifiedExpr {
5129 pub this: Expression,
5130 pub subquery: Expression,
5131 pub op: Option<QuantifiedOp>,
5132}
5133
5134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5136#[cfg_attr(feature = "bindings", derive(TS))]
5137pub enum QuantifiedOp {
5138 Eq,
5139 Neq,
5140 Lt,
5141 Lte,
5142 Gt,
5143 Gte,
5144}
5145
5146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5151#[cfg_attr(feature = "bindings", derive(TS))]
5152pub struct OverlapsExpr {
5153 #[serde(skip_serializing_if = "Option::is_none")]
5155 pub this: Option<Expression>,
5156 #[serde(skip_serializing_if = "Option::is_none")]
5158 pub expression: Option<Expression>,
5159 #[serde(skip_serializing_if = "Option::is_none")]
5161 pub left_start: Option<Expression>,
5162 #[serde(skip_serializing_if = "Option::is_none")]
5164 pub left_end: Option<Expression>,
5165 #[serde(skip_serializing_if = "Option::is_none")]
5167 pub right_start: Option<Expression>,
5168 #[serde(skip_serializing_if = "Option::is_none")]
5170 pub right_end: Option<Expression>,
5171}
5172
5173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5179#[cfg_attr(feature = "bindings", derive(TS))]
5180pub struct Subscript {
5181 pub this: Expression,
5182 pub index: Expression,
5183}
5184
5185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5187#[cfg_attr(feature = "bindings", derive(TS))]
5188pub struct DotAccess {
5189 pub this: Expression,
5190 pub field: Identifier,
5191}
5192
5193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5195#[cfg_attr(feature = "bindings", derive(TS))]
5196pub struct MethodCall {
5197 pub this: Expression,
5198 pub method: Identifier,
5199 pub args: Vec<Expression>,
5200}
5201
5202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5204#[cfg_attr(feature = "bindings", derive(TS))]
5205pub struct ArraySlice {
5206 pub this: Expression,
5207 pub start: Option<Expression>,
5208 pub end: Option<Expression>,
5209}
5210
5211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5217#[cfg_attr(feature = "bindings", derive(TS))]
5218pub enum OnCommit {
5219 PreserveRows,
5221 DeleteRows,
5223}
5224
5225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5227#[cfg_attr(feature = "bindings", derive(TS))]
5228pub struct CreateTable {
5229 pub name: TableRef,
5230 #[serde(default, skip_serializing_if = "Option::is_none")]
5232 pub on_cluster: Option<OnCluster>,
5233 pub columns: Vec<ColumnDef>,
5234 pub constraints: Vec<TableConstraint>,
5235 pub if_not_exists: bool,
5236 pub temporary: bool,
5237 pub or_replace: bool,
5238 #[serde(default, skip_serializing_if = "Option::is_none")]
5240 pub table_modifier: Option<String>,
5241 pub as_select: Option<Expression>,
5242 #[serde(default)]
5244 pub as_select_parenthesized: bool,
5245 #[serde(default)]
5247 pub on_commit: Option<OnCommit>,
5248 #[serde(default)]
5250 pub clone_source: Option<TableRef>,
5251 #[serde(default, skip_serializing_if = "Option::is_none")]
5253 pub clone_at_clause: Option<Expression>,
5254 #[serde(default)]
5256 pub is_copy: bool,
5257 #[serde(default)]
5259 pub shallow_clone: bool,
5260 #[serde(default)]
5262 pub leading_comments: Vec<String>,
5263 #[serde(default)]
5265 pub with_properties: Vec<(String, String)>,
5266 #[serde(default)]
5268 pub teradata_post_name_options: Vec<String>,
5269 #[serde(default)]
5271 pub with_data: Option<bool>,
5272 #[serde(default)]
5274 pub with_statistics: Option<bool>,
5275 #[serde(default)]
5277 pub teradata_indexes: Vec<TeradataIndex>,
5278 #[serde(default)]
5280 pub with_cte: Option<With>,
5281 #[serde(default)]
5283 pub properties: Vec<Expression>,
5284 #[serde(default, skip_serializing_if = "Option::is_none")]
5286 pub partition_of: Option<Expression>,
5287 #[serde(default)]
5289 pub post_table_properties: Vec<Expression>,
5290 #[serde(default)]
5292 pub mysql_table_options: Vec<(String, String)>,
5293 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5295 pub inherits: Vec<TableRef>,
5296 #[serde(default, skip_serializing_if = "Option::is_none")]
5298 pub on_property: Option<OnProperty>,
5299 #[serde(default)]
5301 pub copy_grants: bool,
5302 #[serde(default, skip_serializing_if = "Option::is_none")]
5304 pub using_template: Option<Box<Expression>>,
5305 #[serde(default, skip_serializing_if = "Option::is_none")]
5307 pub rollup: Option<RollupProperty>,
5308}
5309
5310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5312#[cfg_attr(feature = "bindings", derive(TS))]
5313pub struct TeradataIndex {
5314 pub kind: TeradataIndexKind,
5316 pub name: Option<String>,
5318 pub columns: Vec<String>,
5320}
5321
5322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5324#[cfg_attr(feature = "bindings", derive(TS))]
5325pub enum TeradataIndexKind {
5326 NoPrimary,
5328 Primary,
5330 PrimaryAmp,
5332 Unique,
5334 UniquePrimary,
5336 Secondary,
5338}
5339
5340impl CreateTable {
5341 pub fn new(name: impl Into<String>) -> Self {
5342 Self {
5343 name: TableRef::new(name),
5344 on_cluster: None,
5345 columns: Vec::new(),
5346 constraints: Vec::new(),
5347 if_not_exists: false,
5348 temporary: false,
5349 or_replace: false,
5350 table_modifier: None,
5351 as_select: None,
5352 as_select_parenthesized: false,
5353 on_commit: None,
5354 clone_source: None,
5355 clone_at_clause: None,
5356 shallow_clone: false,
5357 is_copy: false,
5358 leading_comments: Vec::new(),
5359 with_properties: Vec::new(),
5360 teradata_post_name_options: Vec::new(),
5361 with_data: None,
5362 with_statistics: None,
5363 teradata_indexes: Vec::new(),
5364 with_cte: None,
5365 properties: Vec::new(),
5366 partition_of: None,
5367 post_table_properties: Vec::new(),
5368 mysql_table_options: Vec::new(),
5369 inherits: Vec::new(),
5370 on_property: None,
5371 copy_grants: false,
5372 using_template: None,
5373 rollup: None,
5374 }
5375 }
5376}
5377
5378#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
5380#[cfg_attr(feature = "bindings", derive(TS))]
5381pub enum SortOrder {
5382 Asc,
5383 Desc,
5384}
5385
5386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5388#[cfg_attr(feature = "bindings", derive(TS))]
5389pub enum ConstraintType {
5390 NotNull,
5391 Null,
5392 PrimaryKey,
5393 Unique,
5394 Default,
5395 AutoIncrement,
5396 Collate,
5397 Comment,
5398 References,
5399 Check,
5400 GeneratedAsIdentity,
5401 Tags,
5403 ComputedColumn,
5405 GeneratedAsRow,
5407 OnUpdate,
5409 Path,
5411 Encode,
5413}
5414
5415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5417#[cfg_attr(feature = "bindings", derive(TS))]
5418pub struct ColumnDef {
5419 pub name: Identifier,
5420 pub data_type: DataType,
5421 pub nullable: Option<bool>,
5422 pub default: Option<Expression>,
5423 pub primary_key: bool,
5424 #[serde(default)]
5426 pub primary_key_order: Option<SortOrder>,
5427 pub unique: bool,
5428 #[serde(default)]
5430 pub unique_nulls_not_distinct: bool,
5431 pub auto_increment: bool,
5432 pub comment: Option<String>,
5433 pub constraints: Vec<ColumnConstraint>,
5434 #[serde(default)]
5436 pub constraint_order: Vec<ConstraintType>,
5437 #[serde(default)]
5439 pub format: Option<String>,
5440 #[serde(default)]
5442 pub title: Option<String>,
5443 #[serde(default)]
5445 pub inline_length: Option<u64>,
5446 #[serde(default)]
5448 pub compress: Option<Vec<Expression>>,
5449 #[serde(default)]
5451 pub character_set: Option<String>,
5452 #[serde(default)]
5454 pub uppercase: bool,
5455 #[serde(default)]
5457 pub casespecific: Option<bool>,
5458 #[serde(default)]
5460 pub auto_increment_start: Option<Box<Expression>>,
5461 #[serde(default)]
5463 pub auto_increment_increment: Option<Box<Expression>>,
5464 #[serde(default)]
5466 pub auto_increment_order: Option<bool>,
5467 #[serde(default)]
5469 pub unsigned: bool,
5470 #[serde(default)]
5472 pub zerofill: bool,
5473 #[serde(default, skip_serializing_if = "Option::is_none")]
5475 pub on_update: Option<Expression>,
5476 #[serde(default, skip_serializing_if = "Option::is_none")]
5478 pub unique_constraint_name: Option<String>,
5479 #[serde(default, skip_serializing_if = "Option::is_none")]
5481 pub not_null_constraint_name: Option<String>,
5482 #[serde(default, skip_serializing_if = "Option::is_none")]
5484 pub primary_key_constraint_name: Option<String>,
5485 #[serde(default, skip_serializing_if = "Option::is_none")]
5487 pub check_constraint_name: Option<String>,
5488 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5490 pub options: Vec<Expression>,
5491 #[serde(default)]
5493 pub no_type: bool,
5494 #[serde(default, skip_serializing_if = "Option::is_none")]
5496 pub encoding: Option<String>,
5497 #[serde(default, skip_serializing_if = "Option::is_none")]
5499 pub codec: Option<String>,
5500 #[serde(default, skip_serializing_if = "Option::is_none")]
5502 pub ephemeral: Option<Option<Box<Expression>>>,
5503 #[serde(default, skip_serializing_if = "Option::is_none")]
5505 pub materialized_expr: Option<Box<Expression>>,
5506 #[serde(default, skip_serializing_if = "Option::is_none")]
5508 pub alias_expr: Option<Box<Expression>>,
5509 #[serde(default, skip_serializing_if = "Option::is_none")]
5511 pub ttl_expr: Option<Box<Expression>>,
5512 #[serde(default)]
5514 pub not_for_replication: bool,
5515}
5516
5517impl ColumnDef {
5518 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
5519 Self {
5520 name: Identifier::new(name),
5521 data_type,
5522 nullable: None,
5523 default: None,
5524 primary_key: false,
5525 primary_key_order: None,
5526 unique: false,
5527 unique_nulls_not_distinct: false,
5528 auto_increment: false,
5529 comment: None,
5530 constraints: Vec::new(),
5531 constraint_order: Vec::new(),
5532 format: None,
5533 title: None,
5534 inline_length: None,
5535 compress: None,
5536 character_set: None,
5537 uppercase: false,
5538 casespecific: None,
5539 auto_increment_start: None,
5540 auto_increment_increment: None,
5541 auto_increment_order: None,
5542 unsigned: false,
5543 zerofill: false,
5544 on_update: None,
5545 unique_constraint_name: None,
5546 not_null_constraint_name: None,
5547 primary_key_constraint_name: None,
5548 check_constraint_name: None,
5549 options: Vec::new(),
5550 no_type: false,
5551 encoding: None,
5552 codec: None,
5553 ephemeral: None,
5554 materialized_expr: None,
5555 alias_expr: None,
5556 ttl_expr: None,
5557 not_for_replication: false,
5558 }
5559 }
5560}
5561
5562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5564#[cfg_attr(feature = "bindings", derive(TS))]
5565pub enum ColumnConstraint {
5566 NotNull,
5567 Null,
5568 Unique,
5569 PrimaryKey,
5570 Default(Expression),
5571 Check(Expression),
5572 References(ForeignKeyRef),
5573 GeneratedAsIdentity(GeneratedAsIdentity),
5574 Collate(Identifier),
5575 Comment(String),
5576 Tags(Tags),
5578 ComputedColumn(ComputedColumn),
5581 GeneratedAsRow(GeneratedAsRow),
5583 Path(Expression),
5585}
5586
5587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5589#[cfg_attr(feature = "bindings", derive(TS))]
5590pub struct ComputedColumn {
5591 pub expression: Box<Expression>,
5593 #[serde(default)]
5595 pub persisted: bool,
5596 #[serde(default)]
5598 pub not_null: bool,
5599 #[serde(default)]
5602 pub persistence_kind: Option<String>,
5603 #[serde(default, skip_serializing_if = "Option::is_none")]
5605 pub data_type: Option<DataType>,
5606}
5607
5608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5610#[cfg_attr(feature = "bindings", derive(TS))]
5611pub struct GeneratedAsRow {
5612 pub start: bool,
5614 #[serde(default)]
5616 pub hidden: bool,
5617}
5618
5619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5621#[cfg_attr(feature = "bindings", derive(TS))]
5622pub struct GeneratedAsIdentity {
5623 pub always: bool,
5625 pub on_null: bool,
5627 pub start: Option<Box<Expression>>,
5629 pub increment: Option<Box<Expression>>,
5631 pub minvalue: Option<Box<Expression>>,
5633 pub maxvalue: Option<Box<Expression>>,
5635 pub cycle: Option<bool>,
5637}
5638
5639#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5641#[cfg_attr(feature = "bindings", derive(TS))]
5642pub struct ConstraintModifiers {
5643 pub enforced: Option<bool>,
5645 pub deferrable: Option<bool>,
5647 pub initially_deferred: Option<bool>,
5649 pub norely: bool,
5651 pub rely: bool,
5653 #[serde(default)]
5655 pub using: Option<String>,
5656 #[serde(default)]
5658 pub using_before_columns: bool,
5659 #[serde(default, skip_serializing_if = "Option::is_none")]
5661 pub comment: Option<String>,
5662 #[serde(default, skip_serializing_if = "Option::is_none")]
5664 pub visible: Option<bool>,
5665 #[serde(default, skip_serializing_if = "Option::is_none")]
5667 pub engine_attribute: Option<String>,
5668 #[serde(default, skip_serializing_if = "Option::is_none")]
5670 pub with_parser: Option<String>,
5671 #[serde(default)]
5673 pub not_valid: bool,
5674 #[serde(default, skip_serializing_if = "Option::is_none")]
5676 pub clustered: Option<String>,
5677 #[serde(default, skip_serializing_if = "Option::is_none")]
5679 pub on_conflict: Option<String>,
5680 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5682 pub with_options: Vec<(String, String)>,
5683 #[serde(default, skip_serializing_if = "Option::is_none")]
5685 pub on_filegroup: Option<Identifier>,
5686}
5687
5688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5690#[cfg_attr(feature = "bindings", derive(TS))]
5691pub enum TableConstraint {
5692 PrimaryKey {
5693 name: Option<Identifier>,
5694 columns: Vec<Identifier>,
5695 #[serde(default)]
5697 include_columns: Vec<Identifier>,
5698 #[serde(default)]
5699 modifiers: ConstraintModifiers,
5700 #[serde(default)]
5702 has_constraint_keyword: bool,
5703 },
5704 Unique {
5705 name: Option<Identifier>,
5706 columns: Vec<Identifier>,
5707 #[serde(default)]
5709 columns_parenthesized: bool,
5710 #[serde(default)]
5711 modifiers: ConstraintModifiers,
5712 #[serde(default)]
5714 has_constraint_keyword: bool,
5715 #[serde(default)]
5717 nulls_not_distinct: bool,
5718 },
5719 ForeignKey {
5720 name: Option<Identifier>,
5721 columns: Vec<Identifier>,
5722 #[serde(default)]
5723 references: Option<ForeignKeyRef>,
5724 #[serde(default)]
5726 on_delete: Option<ReferentialAction>,
5727 #[serde(default)]
5729 on_update: Option<ReferentialAction>,
5730 #[serde(default)]
5731 modifiers: ConstraintModifiers,
5732 },
5733 Check {
5734 name: Option<Identifier>,
5735 expression: Expression,
5736 #[serde(default)]
5737 modifiers: ConstraintModifiers,
5738 },
5739 Index {
5741 name: Option<Identifier>,
5742 columns: Vec<Identifier>,
5743 #[serde(default)]
5745 kind: Option<String>,
5746 #[serde(default)]
5747 modifiers: ConstraintModifiers,
5748 #[serde(default)]
5750 use_key_keyword: bool,
5751 #[serde(default, skip_serializing_if = "Option::is_none")]
5753 expression: Option<Box<Expression>>,
5754 #[serde(default, skip_serializing_if = "Option::is_none")]
5756 index_type: Option<Box<Expression>>,
5757 #[serde(default, skip_serializing_if = "Option::is_none")]
5759 granularity: Option<Box<Expression>>,
5760 },
5761 Projection {
5763 name: Identifier,
5764 expression: Expression,
5765 },
5766 Like {
5768 source: TableRef,
5769 options: Vec<(LikeOptionAction, String)>,
5771 },
5772 PeriodForSystemTime {
5774 start_col: Identifier,
5775 end_col: Identifier,
5776 },
5777 Exclude {
5780 name: Option<Identifier>,
5781 #[serde(default)]
5783 using: Option<String>,
5784 elements: Vec<ExcludeElement>,
5786 #[serde(default)]
5788 include_columns: Vec<Identifier>,
5789 #[serde(default)]
5791 where_clause: Option<Box<Expression>>,
5792 #[serde(default)]
5794 with_params: Vec<(String, String)>,
5795 #[serde(default)]
5797 using_index_tablespace: Option<String>,
5798 #[serde(default)]
5799 modifiers: ConstraintModifiers,
5800 },
5801 Tags(Tags),
5803 InitiallyDeferred {
5807 deferred: bool,
5809 },
5810}
5811
5812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5814#[cfg_attr(feature = "bindings", derive(TS))]
5815pub struct ExcludeElement {
5816 pub expression: String,
5818 pub operator: String,
5820}
5821
5822#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5824#[cfg_attr(feature = "bindings", derive(TS))]
5825pub enum LikeOptionAction {
5826 Including,
5827 Excluding,
5828}
5829
5830#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5832#[cfg_attr(feature = "bindings", derive(TS))]
5833pub enum MatchType {
5834 Full,
5835 Partial,
5836 Simple,
5837}
5838
5839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5841#[cfg_attr(feature = "bindings", derive(TS))]
5842pub struct ForeignKeyRef {
5843 pub table: TableRef,
5844 pub columns: Vec<Identifier>,
5845 pub on_delete: Option<ReferentialAction>,
5846 pub on_update: Option<ReferentialAction>,
5847 #[serde(default)]
5849 pub on_update_first: bool,
5850 #[serde(default)]
5852 pub match_type: Option<MatchType>,
5853 #[serde(default)]
5855 pub match_after_actions: bool,
5856 #[serde(default)]
5858 pub constraint_name: Option<String>,
5859 #[serde(default)]
5861 pub deferrable: Option<bool>,
5862 #[serde(default)]
5864 pub has_foreign_key_keywords: bool,
5865}
5866
5867#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5869#[cfg_attr(feature = "bindings", derive(TS))]
5870pub enum ReferentialAction {
5871 Cascade,
5872 SetNull,
5873 SetDefault,
5874 Restrict,
5875 NoAction,
5876}
5877
5878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5880#[cfg_attr(feature = "bindings", derive(TS))]
5881pub struct DropTable {
5882 pub names: Vec<TableRef>,
5883 pub if_exists: bool,
5884 pub cascade: bool,
5885 #[serde(default)]
5887 pub cascade_constraints: bool,
5888 #[serde(default)]
5890 pub purge: bool,
5891 #[serde(default)]
5893 pub leading_comments: Vec<String>,
5894}
5895
5896impl DropTable {
5897 pub fn new(name: impl Into<String>) -> Self {
5898 Self {
5899 names: vec![TableRef::new(name)],
5900 if_exists: false,
5901 cascade: false,
5902 cascade_constraints: false,
5903 purge: false,
5904 leading_comments: Vec::new(),
5905 }
5906 }
5907}
5908
5909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5911#[cfg_attr(feature = "bindings", derive(TS))]
5912pub struct AlterTable {
5913 pub name: TableRef,
5914 pub actions: Vec<AlterTableAction>,
5915 #[serde(default)]
5917 pub if_exists: bool,
5918 #[serde(default, skip_serializing_if = "Option::is_none")]
5920 pub algorithm: Option<String>,
5921 #[serde(default, skip_serializing_if = "Option::is_none")]
5923 pub lock: Option<String>,
5924 #[serde(default, skip_serializing_if = "Option::is_none")]
5926 pub with_check: Option<String>,
5927 #[serde(default, skip_serializing_if = "Option::is_none")]
5929 pub partition: Option<Vec<(Identifier, Expression)>>,
5930 #[serde(default, skip_serializing_if = "Option::is_none")]
5932 pub on_cluster: Option<OnCluster>,
5933}
5934
5935impl AlterTable {
5936 pub fn new(name: impl Into<String>) -> Self {
5937 Self {
5938 name: TableRef::new(name),
5939 actions: Vec::new(),
5940 if_exists: false,
5941 algorithm: None,
5942 lock: None,
5943 with_check: None,
5944 partition: None,
5945 on_cluster: None,
5946 }
5947 }
5948}
5949
5950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5952#[cfg_attr(feature = "bindings", derive(TS))]
5953pub enum ColumnPosition {
5954 First,
5955 After(Identifier),
5956}
5957
5958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5960#[cfg_attr(feature = "bindings", derive(TS))]
5961pub enum AlterTableAction {
5962 AddColumn {
5963 column: ColumnDef,
5964 if_not_exists: bool,
5965 position: Option<ColumnPosition>,
5966 },
5967 DropColumn {
5968 name: Identifier,
5969 if_exists: bool,
5970 cascade: bool,
5971 },
5972 RenameColumn {
5973 old_name: Identifier,
5974 new_name: Identifier,
5975 if_exists: bool,
5976 },
5977 AlterColumn {
5978 name: Identifier,
5979 action: AlterColumnAction,
5980 #[serde(default)]
5982 use_modify_keyword: bool,
5983 },
5984 RenameTable(TableRef),
5985 AddConstraint(TableConstraint),
5986 DropConstraint {
5987 name: Identifier,
5988 if_exists: bool,
5989 },
5990 DropForeignKey {
5992 name: Identifier,
5993 },
5994 DropPartition {
5996 partitions: Vec<Vec<(Identifier, Expression)>>,
5998 if_exists: bool,
5999 },
6000 AddPartition {
6002 partition: Expression,
6004 if_not_exists: bool,
6005 location: Option<Expression>,
6006 },
6007 Delete {
6009 where_clause: Expression,
6010 },
6011 SwapWith(TableRef),
6013 SetProperty {
6015 properties: Vec<(String, Expression)>,
6016 },
6017 UnsetProperty {
6019 properties: Vec<String>,
6020 },
6021 ClusterBy {
6023 expressions: Vec<Expression>,
6024 },
6025 SetTag {
6027 expressions: Vec<(String, Expression)>,
6028 },
6029 UnsetTag {
6031 names: Vec<String>,
6032 },
6033 SetOptions {
6035 expressions: Vec<Expression>,
6036 },
6037 AlterIndex {
6039 name: Identifier,
6040 visible: bool,
6041 },
6042 SetAttribute {
6044 attribute: String,
6045 },
6046 SetStageFileFormat {
6048 options: Option<Expression>,
6049 },
6050 SetStageCopyOptions {
6052 options: Option<Expression>,
6053 },
6054 AddColumns {
6056 columns: Vec<ColumnDef>,
6057 cascade: bool,
6058 },
6059 DropColumns {
6061 names: Vec<Identifier>,
6062 },
6063 ChangeColumn {
6066 old_name: Identifier,
6067 new_name: Identifier,
6068 #[serde(default, skip_serializing_if = "Option::is_none")]
6069 data_type: Option<DataType>,
6070 comment: Option<String>,
6071 #[serde(default)]
6072 cascade: bool,
6073 },
6074 AlterSortKey {
6077 this: Option<String>,
6079 expressions: Vec<Expression>,
6081 compound: bool,
6083 },
6084 AlterDistStyle {
6088 style: String,
6090 distkey: Option<Identifier>,
6092 },
6093 SetTableProperties {
6095 properties: Vec<(Expression, Expression)>,
6096 },
6097 SetLocation {
6099 location: String,
6100 },
6101 SetFileFormat {
6103 format: String,
6104 },
6105 ReplacePartition {
6107 partition: Expression,
6108 source: Option<Box<Expression>>,
6109 },
6110 Raw {
6112 sql: String,
6113 },
6114}
6115
6116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6118#[cfg_attr(feature = "bindings", derive(TS))]
6119pub enum AlterColumnAction {
6120 SetDataType {
6121 data_type: DataType,
6122 using: Option<Expression>,
6124 #[serde(default, skip_serializing_if = "Option::is_none")]
6126 collate: Option<String>,
6127 },
6128 SetDefault(Expression),
6129 DropDefault,
6130 SetNotNull,
6131 DropNotNull,
6132 Comment(String),
6134 SetVisible,
6136 SetInvisible,
6138}
6139
6140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6142#[cfg_attr(feature = "bindings", derive(TS))]
6143pub struct CreateIndex {
6144 pub name: Identifier,
6145 pub table: TableRef,
6146 pub columns: Vec<IndexColumn>,
6147 pub unique: bool,
6148 pub if_not_exists: bool,
6149 pub using: Option<String>,
6150 #[serde(default)]
6152 pub clustered: Option<String>,
6153 #[serde(default)]
6155 pub concurrently: bool,
6156 #[serde(default)]
6158 pub where_clause: Option<Box<Expression>>,
6159 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6161 pub include_columns: Vec<Identifier>,
6162 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6164 pub with_options: Vec<(String, String)>,
6165 #[serde(default)]
6167 pub on_filegroup: Option<String>,
6168}
6169
6170impl CreateIndex {
6171 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
6172 Self {
6173 name: Identifier::new(name),
6174 table: TableRef::new(table),
6175 columns: Vec::new(),
6176 unique: false,
6177 if_not_exists: false,
6178 using: None,
6179 clustered: None,
6180 concurrently: false,
6181 where_clause: None,
6182 include_columns: Vec::new(),
6183 with_options: Vec::new(),
6184 on_filegroup: None,
6185 }
6186 }
6187}
6188
6189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6191#[cfg_attr(feature = "bindings", derive(TS))]
6192pub struct IndexColumn {
6193 pub column: Identifier,
6194 pub desc: bool,
6195 #[serde(default)]
6197 pub asc: bool,
6198 pub nulls_first: Option<bool>,
6199 #[serde(default, skip_serializing_if = "Option::is_none")]
6201 pub opclass: Option<String>,
6202}
6203
6204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6206#[cfg_attr(feature = "bindings", derive(TS))]
6207pub struct DropIndex {
6208 pub name: Identifier,
6209 pub table: Option<TableRef>,
6210 pub if_exists: bool,
6211 #[serde(default)]
6213 pub concurrently: bool,
6214}
6215
6216impl DropIndex {
6217 pub fn new(name: impl Into<String>) -> Self {
6218 Self {
6219 name: Identifier::new(name),
6220 table: None,
6221 if_exists: false,
6222 concurrently: false,
6223 }
6224 }
6225}
6226
6227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6229#[cfg_attr(feature = "bindings", derive(TS))]
6230pub struct ViewColumn {
6231 pub name: Identifier,
6232 pub comment: Option<String>,
6233 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6235 pub options: Vec<Expression>,
6236}
6237
6238impl ViewColumn {
6239 pub fn new(name: impl Into<String>) -> Self {
6240 Self {
6241 name: Identifier::new(name),
6242 comment: None,
6243 options: Vec::new(),
6244 }
6245 }
6246
6247 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
6248 Self {
6249 name: Identifier::new(name),
6250 comment: Some(comment.into()),
6251 options: Vec::new(),
6252 }
6253 }
6254}
6255
6256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6258#[cfg_attr(feature = "bindings", derive(TS))]
6259pub struct CreateView {
6260 pub name: TableRef,
6261 pub columns: Vec<ViewColumn>,
6262 pub query: Expression,
6263 pub or_replace: bool,
6264 pub if_not_exists: bool,
6265 pub materialized: bool,
6266 pub temporary: bool,
6267 #[serde(default)]
6269 pub secure: bool,
6270 #[serde(skip_serializing_if = "Option::is_none")]
6272 pub algorithm: Option<String>,
6273 #[serde(skip_serializing_if = "Option::is_none")]
6275 pub definer: Option<String>,
6276 #[serde(skip_serializing_if = "Option::is_none")]
6278 pub security: Option<FunctionSecurity>,
6279 #[serde(default = "default_true")]
6281 pub security_sql_style: bool,
6282 #[serde(default)]
6284 pub query_parenthesized: bool,
6285 #[serde(skip_serializing_if = "Option::is_none")]
6287 pub locking_mode: Option<String>,
6288 #[serde(skip_serializing_if = "Option::is_none")]
6290 pub locking_access: Option<String>,
6291 #[serde(default)]
6293 pub copy_grants: bool,
6294 #[serde(skip_serializing_if = "Option::is_none", default)]
6296 pub comment: Option<String>,
6297 #[serde(default)]
6299 pub tags: Vec<(String, String)>,
6300 #[serde(default)]
6302 pub options: Vec<Expression>,
6303 #[serde(skip_serializing_if = "Option::is_none", default)]
6305 pub build: Option<String>,
6306 #[serde(skip_serializing_if = "Option::is_none", default)]
6308 pub refresh: Option<Box<RefreshTriggerProperty>>,
6309 #[serde(skip_serializing_if = "Option::is_none", default)]
6312 pub schema: Option<Box<Schema>>,
6313 #[serde(skip_serializing_if = "Option::is_none", default)]
6315 pub unique_key: Option<Box<UniqueKeyProperty>>,
6316 #[serde(default)]
6318 pub no_schema_binding: bool,
6319 #[serde(skip_serializing_if = "Option::is_none", default)]
6321 pub auto_refresh: Option<bool>,
6322 #[serde(default, skip_serializing_if = "Option::is_none")]
6324 pub on_cluster: Option<OnCluster>,
6325 #[serde(default, skip_serializing_if = "Option::is_none")]
6327 pub to_table: Option<TableRef>,
6328 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6330 pub table_properties: Vec<Expression>,
6331}
6332
6333impl CreateView {
6334 pub fn new(name: impl Into<String>, query: Expression) -> Self {
6335 Self {
6336 name: TableRef::new(name),
6337 columns: Vec::new(),
6338 query,
6339 or_replace: false,
6340 if_not_exists: false,
6341 materialized: false,
6342 temporary: false,
6343 secure: false,
6344 algorithm: None,
6345 definer: None,
6346 security: None,
6347 security_sql_style: true,
6348 query_parenthesized: false,
6349 locking_mode: None,
6350 locking_access: None,
6351 copy_grants: false,
6352 comment: None,
6353 tags: Vec::new(),
6354 options: Vec::new(),
6355 build: None,
6356 refresh: None,
6357 schema: None,
6358 unique_key: None,
6359 no_schema_binding: false,
6360 auto_refresh: None,
6361 on_cluster: None,
6362 to_table: None,
6363 table_properties: Vec::new(),
6364 }
6365 }
6366}
6367
6368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6370#[cfg_attr(feature = "bindings", derive(TS))]
6371pub struct DropView {
6372 pub name: TableRef,
6373 pub if_exists: bool,
6374 pub materialized: bool,
6375}
6376
6377impl DropView {
6378 pub fn new(name: impl Into<String>) -> Self {
6379 Self {
6380 name: TableRef::new(name),
6381 if_exists: false,
6382 materialized: false,
6383 }
6384 }
6385}
6386
6387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6389#[cfg_attr(feature = "bindings", derive(TS))]
6390pub struct Truncate {
6391 #[serde(default)]
6393 pub target: TruncateTarget,
6394 #[serde(default)]
6396 pub if_exists: bool,
6397 pub table: TableRef,
6398 #[serde(default, skip_serializing_if = "Option::is_none")]
6400 pub on_cluster: Option<OnCluster>,
6401 pub cascade: bool,
6402 #[serde(default)]
6404 pub extra_tables: Vec<TruncateTableEntry>,
6405 #[serde(default)]
6407 pub identity: Option<TruncateIdentity>,
6408 #[serde(default)]
6410 pub restrict: bool,
6411 #[serde(default, skip_serializing_if = "Option::is_none")]
6413 pub partition: Option<Box<Expression>>,
6414}
6415
6416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6418#[cfg_attr(feature = "bindings", derive(TS))]
6419pub struct TruncateTableEntry {
6420 pub table: TableRef,
6421 #[serde(default)]
6423 pub star: bool,
6424}
6425
6426#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6428#[cfg_attr(feature = "bindings", derive(TS))]
6429pub enum TruncateTarget {
6430 Table,
6431 Database,
6432}
6433
6434impl Default for TruncateTarget {
6435 fn default() -> Self {
6436 TruncateTarget::Table
6437 }
6438}
6439
6440#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6442#[cfg_attr(feature = "bindings", derive(TS))]
6443pub enum TruncateIdentity {
6444 Restart,
6445 Continue,
6446}
6447
6448impl Truncate {
6449 pub fn new(table: impl Into<String>) -> Self {
6450 Self {
6451 target: TruncateTarget::Table,
6452 if_exists: false,
6453 table: TableRef::new(table),
6454 on_cluster: None,
6455 cascade: false,
6456 extra_tables: Vec::new(),
6457 identity: None,
6458 restrict: false,
6459 partition: None,
6460 }
6461 }
6462}
6463
6464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6466#[cfg_attr(feature = "bindings", derive(TS))]
6467pub struct Use {
6468 pub kind: Option<UseKind>,
6470 pub this: Identifier,
6472}
6473
6474#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6476#[cfg_attr(feature = "bindings", derive(TS))]
6477pub enum UseKind {
6478 Database,
6479 Schema,
6480 Role,
6481 Warehouse,
6482 Catalog,
6483 SecondaryRoles,
6485}
6486
6487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6489#[cfg_attr(feature = "bindings", derive(TS))]
6490pub struct SetStatement {
6491 pub items: Vec<SetItem>,
6493}
6494
6495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6497#[cfg_attr(feature = "bindings", derive(TS))]
6498pub struct SetItem {
6499 pub name: Expression,
6501 pub value: Expression,
6503 pub kind: Option<String>,
6505 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6507 pub no_equals: bool,
6508}
6509
6510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6512#[cfg_attr(feature = "bindings", derive(TS))]
6513pub struct Cache {
6514 pub table: Identifier,
6516 pub lazy: bool,
6518 pub options: Vec<(Expression, Expression)>,
6520 pub query: Option<Expression>,
6522}
6523
6524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6526#[cfg_attr(feature = "bindings", derive(TS))]
6527pub struct Uncache {
6528 pub table: Identifier,
6530 pub if_exists: bool,
6532}
6533
6534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6536#[cfg_attr(feature = "bindings", derive(TS))]
6537pub struct LoadData {
6538 pub local: bool,
6540 pub inpath: String,
6542 pub overwrite: bool,
6544 pub table: Expression,
6546 pub partition: Vec<(Identifier, Expression)>,
6548 pub input_format: Option<String>,
6550 pub serde: Option<String>,
6552}
6553
6554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6556#[cfg_attr(feature = "bindings", derive(TS))]
6557pub struct Pragma {
6558 pub schema: Option<Identifier>,
6560 pub name: Identifier,
6562 pub value: Option<Expression>,
6564 pub args: Vec<Expression>,
6566}
6567
6568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6571#[cfg_attr(feature = "bindings", derive(TS))]
6572pub struct Privilege {
6573 pub name: String,
6575 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6577 pub columns: Vec<String>,
6578}
6579
6580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6582#[cfg_attr(feature = "bindings", derive(TS))]
6583pub struct GrantPrincipal {
6584 pub name: Identifier,
6586 pub is_role: bool,
6588 #[serde(default)]
6590 pub is_group: bool,
6591}
6592
6593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6595#[cfg_attr(feature = "bindings", derive(TS))]
6596pub struct Grant {
6597 pub privileges: Vec<Privilege>,
6599 pub kind: Option<String>,
6601 pub securable: Identifier,
6603 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6605 pub function_params: Vec<String>,
6606 pub principals: Vec<GrantPrincipal>,
6608 pub grant_option: bool,
6610 #[serde(default, skip_serializing_if = "Option::is_none")]
6612 pub as_principal: Option<Identifier>,
6613}
6614
6615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6617#[cfg_attr(feature = "bindings", derive(TS))]
6618pub struct Revoke {
6619 pub privileges: Vec<Privilege>,
6621 pub kind: Option<String>,
6623 pub securable: Identifier,
6625 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6627 pub function_params: Vec<String>,
6628 pub principals: Vec<GrantPrincipal>,
6630 pub grant_option: bool,
6632 pub cascade: bool,
6634 #[serde(default)]
6636 pub restrict: bool,
6637}
6638
6639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6641#[cfg_attr(feature = "bindings", derive(TS))]
6642pub struct Comment {
6643 pub this: Expression,
6645 pub kind: String,
6647 pub expression: Expression,
6649 pub exists: bool,
6651 pub materialized: bool,
6653}
6654
6655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6661#[cfg_attr(feature = "bindings", derive(TS))]
6662pub struct AlterView {
6663 pub name: TableRef,
6664 pub actions: Vec<AlterViewAction>,
6665 #[serde(default, skip_serializing_if = "Option::is_none")]
6667 pub algorithm: Option<String>,
6668 #[serde(default, skip_serializing_if = "Option::is_none")]
6670 pub definer: Option<String>,
6671 #[serde(default, skip_serializing_if = "Option::is_none")]
6673 pub sql_security: Option<String>,
6674 #[serde(default, skip_serializing_if = "Option::is_none")]
6676 pub with_option: Option<String>,
6677 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6679 pub columns: Vec<ViewColumn>,
6680}
6681
6682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6684#[cfg_attr(feature = "bindings", derive(TS))]
6685pub enum AlterViewAction {
6686 Rename(TableRef),
6688 OwnerTo(Identifier),
6690 SetSchema(Identifier),
6692 SetAuthorization(String),
6694 AlterColumn {
6696 name: Identifier,
6697 action: AlterColumnAction,
6698 },
6699 AsSelect(Box<Expression>),
6701 SetTblproperties(Vec<(String, String)>),
6703 UnsetTblproperties(Vec<String>),
6705}
6706
6707impl AlterView {
6708 pub fn new(name: impl Into<String>) -> Self {
6709 Self {
6710 name: TableRef::new(name),
6711 actions: Vec::new(),
6712 algorithm: None,
6713 definer: None,
6714 sql_security: None,
6715 with_option: None,
6716 columns: Vec::new(),
6717 }
6718 }
6719}
6720
6721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6723#[cfg_attr(feature = "bindings", derive(TS))]
6724pub struct AlterIndex {
6725 pub name: Identifier,
6726 pub table: Option<TableRef>,
6727 pub actions: Vec<AlterIndexAction>,
6728}
6729
6730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6732#[cfg_attr(feature = "bindings", derive(TS))]
6733pub enum AlterIndexAction {
6734 Rename(Identifier),
6736 SetTablespace(Identifier),
6738 Visible(bool),
6740}
6741
6742impl AlterIndex {
6743 pub fn new(name: impl Into<String>) -> Self {
6744 Self {
6745 name: Identifier::new(name),
6746 table: None,
6747 actions: Vec::new(),
6748 }
6749 }
6750}
6751
6752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6754#[cfg_attr(feature = "bindings", derive(TS))]
6755pub struct CreateSchema {
6756 pub name: Identifier,
6757 pub if_not_exists: bool,
6758 pub authorization: Option<Identifier>,
6759 #[serde(default)]
6760 pub clone_from: Option<Identifier>,
6761 #[serde(default)]
6763 pub at_clause: Option<Expression>,
6764 #[serde(default)]
6766 pub properties: Vec<Expression>,
6767 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6769 pub leading_comments: Vec<String>,
6770}
6771
6772impl CreateSchema {
6773 pub fn new(name: impl Into<String>) -> Self {
6774 Self {
6775 name: Identifier::new(name),
6776 if_not_exists: false,
6777 authorization: None,
6778 clone_from: None,
6779 at_clause: None,
6780 properties: Vec::new(),
6781 leading_comments: Vec::new(),
6782 }
6783 }
6784}
6785
6786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6788#[cfg_attr(feature = "bindings", derive(TS))]
6789pub struct DropSchema {
6790 pub name: Identifier,
6791 pub if_exists: bool,
6792 pub cascade: bool,
6793}
6794
6795impl DropSchema {
6796 pub fn new(name: impl Into<String>) -> Self {
6797 Self {
6798 name: Identifier::new(name),
6799 if_exists: false,
6800 cascade: false,
6801 }
6802 }
6803}
6804
6805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6807#[cfg_attr(feature = "bindings", derive(TS))]
6808pub struct DropNamespace {
6809 pub name: Identifier,
6810 pub if_exists: bool,
6811 pub cascade: bool,
6812}
6813
6814impl DropNamespace {
6815 pub fn new(name: impl Into<String>) -> Self {
6816 Self {
6817 name: Identifier::new(name),
6818 if_exists: false,
6819 cascade: false,
6820 }
6821 }
6822}
6823
6824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6826#[cfg_attr(feature = "bindings", derive(TS))]
6827pub struct CreateDatabase {
6828 pub name: Identifier,
6829 pub if_not_exists: bool,
6830 pub options: Vec<DatabaseOption>,
6831 #[serde(default)]
6833 pub clone_from: Option<Identifier>,
6834 #[serde(default)]
6836 pub at_clause: Option<Expression>,
6837}
6838
6839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6841#[cfg_attr(feature = "bindings", derive(TS))]
6842pub enum DatabaseOption {
6843 CharacterSet(String),
6844 Collate(String),
6845 Owner(Identifier),
6846 Template(Identifier),
6847 Encoding(String),
6848 Location(String),
6849}
6850
6851impl CreateDatabase {
6852 pub fn new(name: impl Into<String>) -> Self {
6853 Self {
6854 name: Identifier::new(name),
6855 if_not_exists: false,
6856 options: Vec::new(),
6857 clone_from: None,
6858 at_clause: None,
6859 }
6860 }
6861}
6862
6863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6865#[cfg_attr(feature = "bindings", derive(TS))]
6866pub struct DropDatabase {
6867 pub name: Identifier,
6868 pub if_exists: bool,
6869}
6870
6871impl DropDatabase {
6872 pub fn new(name: impl Into<String>) -> Self {
6873 Self {
6874 name: Identifier::new(name),
6875 if_exists: false,
6876 }
6877 }
6878}
6879
6880#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6882#[cfg_attr(feature = "bindings", derive(TS))]
6883pub struct CreateFunction {
6884 pub name: TableRef,
6885 pub parameters: Vec<FunctionParameter>,
6886 pub return_type: Option<DataType>,
6887 pub body: Option<FunctionBody>,
6888 pub or_replace: bool,
6889 pub if_not_exists: bool,
6890 pub temporary: bool,
6891 pub language: Option<String>,
6892 pub deterministic: Option<bool>,
6893 pub returns_null_on_null_input: Option<bool>,
6894 pub security: Option<FunctionSecurity>,
6895 #[serde(default = "default_true")]
6897 pub has_parens: bool,
6898 #[serde(default)]
6900 pub sql_data_access: Option<SqlDataAccess>,
6901 #[serde(default, skip_serializing_if = "Option::is_none")]
6903 pub returns_table_body: Option<String>,
6904 #[serde(default)]
6906 pub language_first: bool,
6907 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6909 pub set_options: Vec<FunctionSetOption>,
6910 #[serde(default)]
6912 pub strict: bool,
6913 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6915 pub options: Vec<Expression>,
6916 #[serde(default)]
6918 pub is_table_function: bool,
6919 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6921 pub property_order: Vec<FunctionPropertyKind>,
6922 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6924 pub environment: Vec<Expression>,
6925}
6926
6927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6929#[cfg_attr(feature = "bindings", derive(TS))]
6930pub struct FunctionSetOption {
6931 pub name: String,
6932 pub value: FunctionSetValue,
6933}
6934
6935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6937#[cfg_attr(feature = "bindings", derive(TS))]
6938pub enum FunctionSetValue {
6939 Value { value: String, use_to: bool },
6941 FromCurrent,
6943}
6944
6945#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6947#[cfg_attr(feature = "bindings", derive(TS))]
6948pub enum SqlDataAccess {
6949 NoSql,
6951 ContainsSql,
6953 ReadsSqlData,
6955 ModifiesSqlData,
6957}
6958
6959#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6961#[cfg_attr(feature = "bindings", derive(TS))]
6962pub enum FunctionPropertyKind {
6963 Set,
6965 As,
6967 Language,
6969 Determinism,
6971 NullInput,
6973 Security,
6975 SqlDataAccess,
6977 Options,
6979 Environment,
6981}
6982
6983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6985#[cfg_attr(feature = "bindings", derive(TS))]
6986pub struct FunctionParameter {
6987 pub name: Option<Identifier>,
6988 pub data_type: DataType,
6989 pub mode: Option<ParameterMode>,
6990 pub default: Option<Expression>,
6991 #[serde(default, skip_serializing_if = "Option::is_none")]
6993 pub mode_text: Option<String>,
6994}
6995
6996#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6998#[cfg_attr(feature = "bindings", derive(TS))]
6999pub enum ParameterMode {
7000 In,
7001 Out,
7002 InOut,
7003 Variadic,
7004}
7005
7006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7008#[cfg_attr(feature = "bindings", derive(TS))]
7009pub enum FunctionBody {
7010 Block(String),
7012 StringLiteral(String),
7014 Expression(Expression),
7016 External(String),
7018 Return(Expression),
7020 Statements(Vec<Expression>),
7022 DollarQuoted {
7025 content: String,
7026 tag: Option<String>,
7027 },
7028}
7029
7030#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7032#[cfg_attr(feature = "bindings", derive(TS))]
7033pub enum FunctionSecurity {
7034 Definer,
7035 Invoker,
7036 None,
7038}
7039
7040impl CreateFunction {
7041 pub fn new(name: impl Into<String>) -> Self {
7042 Self {
7043 name: TableRef::new(name),
7044 parameters: Vec::new(),
7045 return_type: None,
7046 body: None,
7047 or_replace: false,
7048 if_not_exists: false,
7049 temporary: false,
7050 language: None,
7051 deterministic: None,
7052 returns_null_on_null_input: None,
7053 security: None,
7054 has_parens: true,
7055 sql_data_access: None,
7056 returns_table_body: None,
7057 language_first: false,
7058 set_options: Vec::new(),
7059 strict: false,
7060 options: Vec::new(),
7061 is_table_function: false,
7062 property_order: Vec::new(),
7063 environment: Vec::new(),
7064 }
7065 }
7066}
7067
7068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7070#[cfg_attr(feature = "bindings", derive(TS))]
7071pub struct DropFunction {
7072 pub name: TableRef,
7073 pub parameters: Option<Vec<DataType>>,
7074 pub if_exists: bool,
7075 pub cascade: bool,
7076}
7077
7078impl DropFunction {
7079 pub fn new(name: impl Into<String>) -> Self {
7080 Self {
7081 name: TableRef::new(name),
7082 parameters: None,
7083 if_exists: false,
7084 cascade: false,
7085 }
7086 }
7087}
7088
7089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7091#[cfg_attr(feature = "bindings", derive(TS))]
7092pub struct CreateProcedure {
7093 pub name: TableRef,
7094 pub parameters: Vec<FunctionParameter>,
7095 pub body: Option<FunctionBody>,
7096 pub or_replace: bool,
7097 pub if_not_exists: bool,
7098 pub language: Option<String>,
7099 pub security: Option<FunctionSecurity>,
7100 #[serde(default)]
7102 pub return_type: Option<DataType>,
7103 #[serde(default)]
7105 pub execute_as: Option<String>,
7106 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7108 pub with_options: Vec<String>,
7109 #[serde(default = "default_true", skip_serializing_if = "is_true")]
7111 pub has_parens: bool,
7112 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
7114 pub use_proc_keyword: bool,
7115}
7116
7117impl CreateProcedure {
7118 pub fn new(name: impl Into<String>) -> Self {
7119 Self {
7120 name: TableRef::new(name),
7121 parameters: Vec::new(),
7122 body: None,
7123 or_replace: false,
7124 if_not_exists: false,
7125 language: None,
7126 security: None,
7127 return_type: None,
7128 execute_as: None,
7129 with_options: Vec::new(),
7130 has_parens: true,
7131 use_proc_keyword: false,
7132 }
7133 }
7134}
7135
7136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7138#[cfg_attr(feature = "bindings", derive(TS))]
7139pub struct DropProcedure {
7140 pub name: TableRef,
7141 pub parameters: Option<Vec<DataType>>,
7142 pub if_exists: bool,
7143 pub cascade: bool,
7144}
7145
7146impl DropProcedure {
7147 pub fn new(name: impl Into<String>) -> Self {
7148 Self {
7149 name: TableRef::new(name),
7150 parameters: None,
7151 if_exists: false,
7152 cascade: false,
7153 }
7154 }
7155}
7156
7157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7159#[cfg_attr(feature = "bindings", derive(TS))]
7160pub enum SeqPropKind {
7161 Start,
7162 Increment,
7163 Minvalue,
7164 Maxvalue,
7165 Cache,
7166 NoCache,
7167 Cycle,
7168 NoCycle,
7169 OwnedBy,
7170 Order,
7171 NoOrder,
7172 Comment,
7173 Sharing,
7175 Keep,
7177 NoKeep,
7179 Scale,
7181 NoScale,
7183 Shard,
7185 NoShard,
7187 Session,
7189 Global,
7191 NoCacheWord,
7193 NoCycleWord,
7195 NoMinvalueWord,
7197 NoMaxvalueWord,
7199}
7200
7201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7203#[cfg_attr(feature = "bindings", derive(TS))]
7204pub struct CreateSequence {
7205 pub name: TableRef,
7206 pub if_not_exists: bool,
7207 pub temporary: bool,
7208 #[serde(default)]
7209 pub or_replace: bool,
7210 #[serde(default, skip_serializing_if = "Option::is_none")]
7212 pub as_type: Option<DataType>,
7213 pub increment: Option<i64>,
7214 pub minvalue: Option<SequenceBound>,
7215 pub maxvalue: Option<SequenceBound>,
7216 pub start: Option<i64>,
7217 pub cache: Option<i64>,
7218 pub cycle: bool,
7219 pub owned_by: Option<TableRef>,
7220 #[serde(default)]
7222 pub owned_by_none: bool,
7223 #[serde(default)]
7225 pub order: Option<bool>,
7226 #[serde(default)]
7228 pub comment: Option<String>,
7229 #[serde(default, skip_serializing_if = "Option::is_none")]
7231 pub sharing: Option<String>,
7232 #[serde(default, skip_serializing_if = "Option::is_none")]
7234 pub scale_modifier: Option<String>,
7235 #[serde(default, skip_serializing_if = "Option::is_none")]
7237 pub shard_modifier: Option<String>,
7238 #[serde(default)]
7240 pub property_order: Vec<SeqPropKind>,
7241}
7242
7243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7245#[cfg_attr(feature = "bindings", derive(TS))]
7246pub enum SequenceBound {
7247 Value(i64),
7248 None,
7249}
7250
7251impl CreateSequence {
7252 pub fn new(name: impl Into<String>) -> Self {
7253 Self {
7254 name: TableRef::new(name),
7255 if_not_exists: false,
7256 temporary: false,
7257 or_replace: false,
7258 as_type: None,
7259 increment: None,
7260 minvalue: None,
7261 maxvalue: None,
7262 start: None,
7263 cache: None,
7264 cycle: false,
7265 owned_by: None,
7266 owned_by_none: false,
7267 order: None,
7268 comment: None,
7269 sharing: None,
7270 scale_modifier: None,
7271 shard_modifier: None,
7272 property_order: Vec::new(),
7273 }
7274 }
7275}
7276
7277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7279#[cfg_attr(feature = "bindings", derive(TS))]
7280pub struct DropSequence {
7281 pub name: TableRef,
7282 pub if_exists: bool,
7283 pub cascade: bool,
7284}
7285
7286impl DropSequence {
7287 pub fn new(name: impl Into<String>) -> Self {
7288 Self {
7289 name: TableRef::new(name),
7290 if_exists: false,
7291 cascade: false,
7292 }
7293 }
7294}
7295
7296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7298#[cfg_attr(feature = "bindings", derive(TS))]
7299pub struct AlterSequence {
7300 pub name: TableRef,
7301 pub if_exists: bool,
7302 pub increment: Option<i64>,
7303 pub minvalue: Option<SequenceBound>,
7304 pub maxvalue: Option<SequenceBound>,
7305 pub start: Option<i64>,
7306 pub restart: Option<Option<i64>>,
7307 pub cache: Option<i64>,
7308 pub cycle: Option<bool>,
7309 pub owned_by: Option<Option<TableRef>>,
7310}
7311
7312impl AlterSequence {
7313 pub fn new(name: impl Into<String>) -> Self {
7314 Self {
7315 name: TableRef::new(name),
7316 if_exists: false,
7317 increment: None,
7318 minvalue: None,
7319 maxvalue: None,
7320 start: None,
7321 restart: None,
7322 cache: None,
7323 cycle: None,
7324 owned_by: None,
7325 }
7326 }
7327}
7328
7329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7331#[cfg_attr(feature = "bindings", derive(TS))]
7332pub struct CreateTrigger {
7333 pub name: Identifier,
7334 pub table: TableRef,
7335 pub timing: TriggerTiming,
7336 pub events: Vec<TriggerEvent>,
7337 pub for_each: TriggerForEach,
7338 pub when: Option<Expression>,
7339 pub body: TriggerBody,
7340 pub or_replace: bool,
7341 pub constraint: bool,
7342 pub deferrable: Option<bool>,
7343 pub initially_deferred: Option<bool>,
7344 pub referencing: Option<TriggerReferencing>,
7345}
7346
7347#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7349#[cfg_attr(feature = "bindings", derive(TS))]
7350pub enum TriggerTiming {
7351 Before,
7352 After,
7353 InsteadOf,
7354}
7355
7356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7358#[cfg_attr(feature = "bindings", derive(TS))]
7359pub enum TriggerEvent {
7360 Insert,
7361 Update(Option<Vec<Identifier>>),
7362 Delete,
7363 Truncate,
7364}
7365
7366#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7368#[cfg_attr(feature = "bindings", derive(TS))]
7369pub enum TriggerForEach {
7370 Row,
7371 Statement,
7372}
7373
7374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7376#[cfg_attr(feature = "bindings", derive(TS))]
7377pub enum TriggerBody {
7378 Execute {
7380 function: TableRef,
7381 args: Vec<Expression>,
7382 },
7383 Block(String),
7385}
7386
7387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7389#[cfg_attr(feature = "bindings", derive(TS))]
7390pub struct TriggerReferencing {
7391 pub old_table: Option<Identifier>,
7392 pub new_table: Option<Identifier>,
7393 pub old_row: Option<Identifier>,
7394 pub new_row: Option<Identifier>,
7395}
7396
7397impl CreateTrigger {
7398 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
7399 Self {
7400 name: Identifier::new(name),
7401 table: TableRef::new(table),
7402 timing: TriggerTiming::Before,
7403 events: Vec::new(),
7404 for_each: TriggerForEach::Row,
7405 when: None,
7406 body: TriggerBody::Execute {
7407 function: TableRef::new(""),
7408 args: Vec::new(),
7409 },
7410 or_replace: false,
7411 constraint: false,
7412 deferrable: None,
7413 initially_deferred: None,
7414 referencing: None,
7415 }
7416 }
7417}
7418
7419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7421#[cfg_attr(feature = "bindings", derive(TS))]
7422pub struct DropTrigger {
7423 pub name: Identifier,
7424 pub table: Option<TableRef>,
7425 pub if_exists: bool,
7426 pub cascade: bool,
7427}
7428
7429impl DropTrigger {
7430 pub fn new(name: impl Into<String>) -> Self {
7431 Self {
7432 name: Identifier::new(name),
7433 table: None,
7434 if_exists: false,
7435 cascade: false,
7436 }
7437 }
7438}
7439
7440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7442#[cfg_attr(feature = "bindings", derive(TS))]
7443pub struct CreateType {
7444 pub name: TableRef,
7445 pub definition: TypeDefinition,
7446 pub if_not_exists: bool,
7447}
7448
7449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7451#[cfg_attr(feature = "bindings", derive(TS))]
7452pub enum TypeDefinition {
7453 Enum(Vec<String>),
7455 Composite(Vec<TypeAttribute>),
7457 Range {
7459 subtype: DataType,
7460 subtype_diff: Option<String>,
7461 canonical: Option<String>,
7462 },
7463 Base {
7465 input: String,
7466 output: String,
7467 internallength: Option<i32>,
7468 },
7469 Domain {
7471 base_type: DataType,
7472 default: Option<Expression>,
7473 constraints: Vec<DomainConstraint>,
7474 },
7475}
7476
7477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7479#[cfg_attr(feature = "bindings", derive(TS))]
7480pub struct TypeAttribute {
7481 pub name: Identifier,
7482 pub data_type: DataType,
7483 pub collate: Option<Identifier>,
7484}
7485
7486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7488#[cfg_attr(feature = "bindings", derive(TS))]
7489pub struct DomainConstraint {
7490 pub name: Option<Identifier>,
7491 pub check: Expression,
7492}
7493
7494impl CreateType {
7495 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
7496 Self {
7497 name: TableRef::new(name),
7498 definition: TypeDefinition::Enum(values),
7499 if_not_exists: false,
7500 }
7501 }
7502
7503 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
7504 Self {
7505 name: TableRef::new(name),
7506 definition: TypeDefinition::Composite(attributes),
7507 if_not_exists: false,
7508 }
7509 }
7510}
7511
7512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7514#[cfg_attr(feature = "bindings", derive(TS))]
7515pub struct DropType {
7516 pub name: TableRef,
7517 pub if_exists: bool,
7518 pub cascade: bool,
7519}
7520
7521impl DropType {
7522 pub fn new(name: impl Into<String>) -> Self {
7523 Self {
7524 name: TableRef::new(name),
7525 if_exists: false,
7526 cascade: false,
7527 }
7528 }
7529}
7530
7531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7533#[cfg_attr(feature = "bindings", derive(TS))]
7534pub struct Describe {
7535 pub target: Expression,
7537 pub extended: bool,
7539 pub formatted: bool,
7541 #[serde(default)]
7543 pub kind: Option<String>,
7544 #[serde(default)]
7546 pub properties: Vec<(String, String)>,
7547 #[serde(default, skip_serializing_if = "Option::is_none")]
7549 pub style: Option<String>,
7550 #[serde(default)]
7552 pub partition: Option<Box<Expression>>,
7553 #[serde(default)]
7555 pub leading_comments: Vec<String>,
7556 #[serde(default)]
7558 pub as_json: bool,
7559}
7560
7561impl Describe {
7562 pub fn new(target: Expression) -> Self {
7563 Self {
7564 target,
7565 extended: false,
7566 formatted: false,
7567 kind: None,
7568 properties: Vec::new(),
7569 style: None,
7570 partition: None,
7571 leading_comments: Vec::new(),
7572 as_json: false,
7573 }
7574 }
7575}
7576
7577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7579#[cfg_attr(feature = "bindings", derive(TS))]
7580pub struct Show {
7581 pub this: String,
7583 #[serde(default)]
7585 pub terse: bool,
7586 #[serde(default)]
7588 pub history: bool,
7589 pub like: Option<Expression>,
7591 pub scope_kind: Option<String>,
7593 pub scope: Option<Expression>,
7595 pub starts_with: Option<Expression>,
7597 pub limit: Option<Box<Limit>>,
7599 pub from: Option<Expression>,
7601 #[serde(default, skip_serializing_if = "Option::is_none")]
7603 pub where_clause: Option<Expression>,
7604 #[serde(default, skip_serializing_if = "Option::is_none")]
7606 pub for_target: Option<Expression>,
7607 #[serde(default, skip_serializing_if = "Option::is_none")]
7609 pub db: Option<Expression>,
7610 #[serde(default, skip_serializing_if = "Option::is_none")]
7612 pub target: Option<Expression>,
7613 #[serde(default, skip_serializing_if = "Option::is_none")]
7615 pub mutex: Option<bool>,
7616 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7618 pub privileges: Vec<String>,
7619}
7620
7621impl Show {
7622 pub fn new(this: impl Into<String>) -> Self {
7623 Self {
7624 this: this.into(),
7625 terse: false,
7626 history: false,
7627 like: None,
7628 scope_kind: None,
7629 scope: None,
7630 starts_with: None,
7631 limit: None,
7632 from: None,
7633 where_clause: None,
7634 for_target: None,
7635 db: None,
7636 target: None,
7637 mutex: None,
7638 privileges: Vec::new(),
7639 }
7640 }
7641}
7642
7643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7648#[cfg_attr(feature = "bindings", derive(TS))]
7649pub struct Paren {
7650 pub this: Expression,
7652 #[serde(default)]
7653 pub trailing_comments: Vec<String>,
7654}
7655
7656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7658#[cfg_attr(feature = "bindings", derive(TS))]
7659pub struct Annotated {
7660 pub this: Expression,
7661 pub trailing_comments: Vec<String>,
7662}
7663
7664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7669#[cfg_attr(feature = "bindings", derive(TS))]
7670pub struct Refresh {
7671 pub this: Box<Expression>,
7672 pub kind: String,
7673}
7674
7675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7677#[cfg_attr(feature = "bindings", derive(TS))]
7678pub struct LockingStatement {
7679 pub this: Box<Expression>,
7680 pub expression: Box<Expression>,
7681}
7682
7683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7685#[cfg_attr(feature = "bindings", derive(TS))]
7686pub struct SequenceProperties {
7687 #[serde(default)]
7688 pub increment: Option<Box<Expression>>,
7689 #[serde(default)]
7690 pub minvalue: Option<Box<Expression>>,
7691 #[serde(default)]
7692 pub maxvalue: Option<Box<Expression>>,
7693 #[serde(default)]
7694 pub cache: Option<Box<Expression>>,
7695 #[serde(default)]
7696 pub start: Option<Box<Expression>>,
7697 #[serde(default)]
7698 pub owned: Option<Box<Expression>>,
7699 #[serde(default)]
7700 pub options: Vec<Expression>,
7701}
7702
7703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7705#[cfg_attr(feature = "bindings", derive(TS))]
7706pub struct TruncateTable {
7707 #[serde(default)]
7708 pub expressions: Vec<Expression>,
7709 #[serde(default)]
7710 pub is_database: Option<Box<Expression>>,
7711 #[serde(default)]
7712 pub exists: bool,
7713 #[serde(default)]
7714 pub only: Option<Box<Expression>>,
7715 #[serde(default)]
7716 pub cluster: Option<Box<Expression>>,
7717 #[serde(default)]
7718 pub identity: Option<Box<Expression>>,
7719 #[serde(default)]
7720 pub option: Option<Box<Expression>>,
7721 #[serde(default)]
7722 pub partition: Option<Box<Expression>>,
7723}
7724
7725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7727#[cfg_attr(feature = "bindings", derive(TS))]
7728pub struct Clone {
7729 pub this: Box<Expression>,
7730 #[serde(default)]
7731 pub shallow: Option<Box<Expression>>,
7732 #[serde(default)]
7733 pub copy: Option<Box<Expression>>,
7734}
7735
7736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7738#[cfg_attr(feature = "bindings", derive(TS))]
7739pub struct Attach {
7740 pub this: Box<Expression>,
7741 #[serde(default)]
7742 pub exists: bool,
7743 #[serde(default)]
7744 pub expressions: Vec<Expression>,
7745}
7746
7747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7749#[cfg_attr(feature = "bindings", derive(TS))]
7750pub struct Detach {
7751 pub this: Box<Expression>,
7752 #[serde(default)]
7753 pub exists: bool,
7754}
7755
7756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7758#[cfg_attr(feature = "bindings", derive(TS))]
7759pub struct Install {
7760 pub this: Box<Expression>,
7761 #[serde(default)]
7762 pub from_: Option<Box<Expression>>,
7763 #[serde(default)]
7764 pub force: Option<Box<Expression>>,
7765}
7766
7767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7769#[cfg_attr(feature = "bindings", derive(TS))]
7770pub struct Summarize {
7771 pub this: Box<Expression>,
7772 #[serde(default)]
7773 pub table: Option<Box<Expression>>,
7774}
7775
7776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7778#[cfg_attr(feature = "bindings", derive(TS))]
7779pub struct Declare {
7780 #[serde(default)]
7781 pub expressions: Vec<Expression>,
7782}
7783
7784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7786#[cfg_attr(feature = "bindings", derive(TS))]
7787pub struct DeclareItem {
7788 pub this: Box<Expression>,
7789 #[serde(default)]
7790 pub kind: Option<String>,
7791 #[serde(default)]
7792 pub default: Option<Box<Expression>>,
7793 #[serde(default)]
7794 pub has_as: bool,
7795 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7797 pub additional_names: Vec<Expression>,
7798}
7799
7800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7802#[cfg_attr(feature = "bindings", derive(TS))]
7803pub struct Set {
7804 #[serde(default)]
7805 pub expressions: Vec<Expression>,
7806 #[serde(default)]
7807 pub unset: Option<Box<Expression>>,
7808 #[serde(default)]
7809 pub tag: Option<Box<Expression>>,
7810}
7811
7812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7814#[cfg_attr(feature = "bindings", derive(TS))]
7815pub struct Heredoc {
7816 pub this: Box<Expression>,
7817 #[serde(default)]
7818 pub tag: Option<Box<Expression>>,
7819}
7820
7821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7823#[cfg_attr(feature = "bindings", derive(TS))]
7824pub struct QueryBand {
7825 pub this: Box<Expression>,
7826 #[serde(default)]
7827 pub scope: Option<Box<Expression>>,
7828 #[serde(default)]
7829 pub update: Option<Box<Expression>>,
7830}
7831
7832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7834#[cfg_attr(feature = "bindings", derive(TS))]
7835pub struct UserDefinedFunction {
7836 pub this: Box<Expression>,
7837 #[serde(default)]
7838 pub expressions: Vec<Expression>,
7839 #[serde(default)]
7840 pub wrapped: Option<Box<Expression>>,
7841}
7842
7843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7845#[cfg_attr(feature = "bindings", derive(TS))]
7846pub struct RecursiveWithSearch {
7847 pub kind: String,
7848 pub this: Box<Expression>,
7849 pub expression: Box<Expression>,
7850 #[serde(default)]
7851 pub using: Option<Box<Expression>>,
7852}
7853
7854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7856#[cfg_attr(feature = "bindings", derive(TS))]
7857pub struct ProjectionDef {
7858 pub this: Box<Expression>,
7859 pub expression: Box<Expression>,
7860}
7861
7862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7864#[cfg_attr(feature = "bindings", derive(TS))]
7865pub struct TableAlias {
7866 #[serde(default)]
7867 pub this: Option<Box<Expression>>,
7868 #[serde(default)]
7869 pub columns: Vec<Expression>,
7870}
7871
7872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7874#[cfg_attr(feature = "bindings", derive(TS))]
7875pub struct ByteString {
7876 pub this: Box<Expression>,
7877 #[serde(default)]
7878 pub is_bytes: Option<Box<Expression>>,
7879}
7880
7881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7884#[cfg_attr(feature = "bindings", derive(TS))]
7885pub struct HexStringExpr {
7886 pub this: Box<Expression>,
7887 #[serde(default)]
7888 pub is_integer: Option<bool>,
7889}
7890
7891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7893#[cfg_attr(feature = "bindings", derive(TS))]
7894pub struct UnicodeString {
7895 pub this: Box<Expression>,
7896 #[serde(default)]
7897 pub escape: Option<Box<Expression>>,
7898}
7899
7900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7902#[cfg_attr(feature = "bindings", derive(TS))]
7903pub struct AlterColumn {
7904 pub this: Box<Expression>,
7905 #[serde(default)]
7906 pub dtype: Option<Box<Expression>>,
7907 #[serde(default)]
7908 pub collate: Option<Box<Expression>>,
7909 #[serde(default)]
7910 pub using: Option<Box<Expression>>,
7911 #[serde(default)]
7912 pub default: Option<Box<Expression>>,
7913 #[serde(default)]
7914 pub drop: Option<Box<Expression>>,
7915 #[serde(default)]
7916 pub comment: Option<Box<Expression>>,
7917 #[serde(default)]
7918 pub allow_null: Option<Box<Expression>>,
7919 #[serde(default)]
7920 pub visible: Option<Box<Expression>>,
7921 #[serde(default)]
7922 pub rename_to: Option<Box<Expression>>,
7923}
7924
7925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7927#[cfg_attr(feature = "bindings", derive(TS))]
7928pub struct AlterSortKey {
7929 #[serde(default)]
7930 pub this: Option<Box<Expression>>,
7931 #[serde(default)]
7932 pub expressions: Vec<Expression>,
7933 #[serde(default)]
7934 pub compound: Option<Box<Expression>>,
7935}
7936
7937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7939#[cfg_attr(feature = "bindings", derive(TS))]
7940pub struct AlterSet {
7941 #[serde(default)]
7942 pub expressions: Vec<Expression>,
7943 #[serde(default)]
7944 pub option: Option<Box<Expression>>,
7945 #[serde(default)]
7946 pub tablespace: Option<Box<Expression>>,
7947 #[serde(default)]
7948 pub access_method: Option<Box<Expression>>,
7949 #[serde(default)]
7950 pub file_format: Option<Box<Expression>>,
7951 #[serde(default)]
7952 pub copy_options: Option<Box<Expression>>,
7953 #[serde(default)]
7954 pub tag: Option<Box<Expression>>,
7955 #[serde(default)]
7956 pub location: Option<Box<Expression>>,
7957 #[serde(default)]
7958 pub serde: Option<Box<Expression>>,
7959}
7960
7961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7963#[cfg_attr(feature = "bindings", derive(TS))]
7964pub struct RenameColumn {
7965 pub this: Box<Expression>,
7966 #[serde(default)]
7967 pub to: Option<Box<Expression>>,
7968 #[serde(default)]
7969 pub exists: bool,
7970}
7971
7972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7974#[cfg_attr(feature = "bindings", derive(TS))]
7975pub struct Comprehension {
7976 pub this: Box<Expression>,
7977 pub expression: Box<Expression>,
7978 #[serde(default)]
7979 pub position: Option<Box<Expression>>,
7980 #[serde(default)]
7981 pub iterator: Option<Box<Expression>>,
7982 #[serde(default)]
7983 pub condition: Option<Box<Expression>>,
7984}
7985
7986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7988#[cfg_attr(feature = "bindings", derive(TS))]
7989pub struct MergeTreeTTLAction {
7990 pub this: Box<Expression>,
7991 #[serde(default)]
7992 pub delete: Option<Box<Expression>>,
7993 #[serde(default)]
7994 pub recompress: Option<Box<Expression>>,
7995 #[serde(default)]
7996 pub to_disk: Option<Box<Expression>>,
7997 #[serde(default)]
7998 pub to_volume: Option<Box<Expression>>,
7999}
8000
8001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8003#[cfg_attr(feature = "bindings", derive(TS))]
8004pub struct MergeTreeTTL {
8005 #[serde(default)]
8006 pub expressions: Vec<Expression>,
8007 #[serde(default)]
8008 pub where_: Option<Box<Expression>>,
8009 #[serde(default)]
8010 pub group: Option<Box<Expression>>,
8011 #[serde(default)]
8012 pub aggregates: Option<Box<Expression>>,
8013}
8014
8015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8017#[cfg_attr(feature = "bindings", derive(TS))]
8018pub struct IndexConstraintOption {
8019 #[serde(default)]
8020 pub key_block_size: Option<Box<Expression>>,
8021 #[serde(default)]
8022 pub using: Option<Box<Expression>>,
8023 #[serde(default)]
8024 pub parser: Option<Box<Expression>>,
8025 #[serde(default)]
8026 pub comment: Option<Box<Expression>>,
8027 #[serde(default)]
8028 pub visible: Option<Box<Expression>>,
8029 #[serde(default)]
8030 pub engine_attr: Option<Box<Expression>>,
8031 #[serde(default)]
8032 pub secondary_engine_attr: Option<Box<Expression>>,
8033}
8034
8035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8037#[cfg_attr(feature = "bindings", derive(TS))]
8038pub struct PeriodForSystemTimeConstraint {
8039 pub this: Box<Expression>,
8040 pub expression: Box<Expression>,
8041}
8042
8043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8045#[cfg_attr(feature = "bindings", derive(TS))]
8046pub struct CaseSpecificColumnConstraint {
8047 #[serde(default)]
8048 pub not_: Option<Box<Expression>>,
8049}
8050
8051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8053#[cfg_attr(feature = "bindings", derive(TS))]
8054pub struct CharacterSetColumnConstraint {
8055 pub this: Box<Expression>,
8056}
8057
8058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8060#[cfg_attr(feature = "bindings", derive(TS))]
8061pub struct CheckColumnConstraint {
8062 pub this: Box<Expression>,
8063 #[serde(default)]
8064 pub enforced: Option<Box<Expression>>,
8065}
8066
8067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8069#[cfg_attr(feature = "bindings", derive(TS))]
8070pub struct CompressColumnConstraint {
8071 #[serde(default)]
8072 pub this: Option<Box<Expression>>,
8073}
8074
8075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8077#[cfg_attr(feature = "bindings", derive(TS))]
8078pub struct DateFormatColumnConstraint {
8079 pub this: Box<Expression>,
8080}
8081
8082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8084#[cfg_attr(feature = "bindings", derive(TS))]
8085pub struct EphemeralColumnConstraint {
8086 #[serde(default)]
8087 pub this: Option<Box<Expression>>,
8088}
8089
8090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8092#[cfg_attr(feature = "bindings", derive(TS))]
8093pub struct WithOperator {
8094 pub this: Box<Expression>,
8095 pub op: String,
8096}
8097
8098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8100#[cfg_attr(feature = "bindings", derive(TS))]
8101pub struct GeneratedAsIdentityColumnConstraint {
8102 #[serde(default)]
8103 pub this: Option<Box<Expression>>,
8104 #[serde(default)]
8105 pub expression: Option<Box<Expression>>,
8106 #[serde(default)]
8107 pub on_null: Option<Box<Expression>>,
8108 #[serde(default)]
8109 pub start: Option<Box<Expression>>,
8110 #[serde(default)]
8111 pub increment: Option<Box<Expression>>,
8112 #[serde(default)]
8113 pub minvalue: Option<Box<Expression>>,
8114 #[serde(default)]
8115 pub maxvalue: Option<Box<Expression>>,
8116 #[serde(default)]
8117 pub cycle: Option<Box<Expression>>,
8118 #[serde(default)]
8119 pub order: Option<Box<Expression>>,
8120}
8121
8122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8125#[cfg_attr(feature = "bindings", derive(TS))]
8126pub struct AutoIncrementColumnConstraint;
8127
8128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8130#[cfg_attr(feature = "bindings", derive(TS))]
8131pub struct CommentColumnConstraint;
8132
8133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8135#[cfg_attr(feature = "bindings", derive(TS))]
8136pub struct GeneratedAsRowColumnConstraint {
8137 #[serde(default)]
8138 pub start: Option<Box<Expression>>,
8139 #[serde(default)]
8140 pub hidden: Option<Box<Expression>>,
8141}
8142
8143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8145#[cfg_attr(feature = "bindings", derive(TS))]
8146pub struct IndexColumnConstraint {
8147 #[serde(default)]
8148 pub this: Option<Box<Expression>>,
8149 #[serde(default)]
8150 pub expressions: Vec<Expression>,
8151 #[serde(default)]
8152 pub kind: Option<String>,
8153 #[serde(default)]
8154 pub index_type: Option<Box<Expression>>,
8155 #[serde(default)]
8156 pub options: Vec<Expression>,
8157 #[serde(default)]
8158 pub expression: Option<Box<Expression>>,
8159 #[serde(default)]
8160 pub granularity: Option<Box<Expression>>,
8161}
8162
8163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8165#[cfg_attr(feature = "bindings", derive(TS))]
8166pub struct MaskingPolicyColumnConstraint {
8167 pub this: Box<Expression>,
8168 #[serde(default)]
8169 pub expressions: Vec<Expression>,
8170}
8171
8172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8174#[cfg_attr(feature = "bindings", derive(TS))]
8175pub struct NotNullColumnConstraint {
8176 #[serde(default)]
8177 pub allow_null: Option<Box<Expression>>,
8178}
8179
8180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8182#[cfg_attr(feature = "bindings", derive(TS))]
8183pub struct DefaultColumnConstraint {
8184 pub this: Box<Expression>,
8185}
8186
8187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8189#[cfg_attr(feature = "bindings", derive(TS))]
8190pub struct PrimaryKeyColumnConstraint {
8191 #[serde(default)]
8192 pub desc: Option<Box<Expression>>,
8193 #[serde(default)]
8194 pub options: Vec<Expression>,
8195}
8196
8197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8199#[cfg_attr(feature = "bindings", derive(TS))]
8200pub struct UniqueColumnConstraint {
8201 #[serde(default)]
8202 pub this: Option<Box<Expression>>,
8203 #[serde(default)]
8204 pub index_type: Option<Box<Expression>>,
8205 #[serde(default)]
8206 pub on_conflict: Option<Box<Expression>>,
8207 #[serde(default)]
8208 pub nulls: Option<Box<Expression>>,
8209 #[serde(default)]
8210 pub options: Vec<Expression>,
8211}
8212
8213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8215#[cfg_attr(feature = "bindings", derive(TS))]
8216pub struct WatermarkColumnConstraint {
8217 pub this: Box<Expression>,
8218 pub expression: Box<Expression>,
8219}
8220
8221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8223#[cfg_attr(feature = "bindings", derive(TS))]
8224pub struct ComputedColumnConstraint {
8225 pub this: Box<Expression>,
8226 #[serde(default)]
8227 pub persisted: Option<Box<Expression>>,
8228 #[serde(default)]
8229 pub not_null: Option<Box<Expression>>,
8230 #[serde(default)]
8231 pub data_type: Option<Box<Expression>>,
8232}
8233
8234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8236#[cfg_attr(feature = "bindings", derive(TS))]
8237pub struct InOutColumnConstraint {
8238 #[serde(default)]
8239 pub input_: Option<Box<Expression>>,
8240 #[serde(default)]
8241 pub output: Option<Box<Expression>>,
8242}
8243
8244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8246#[cfg_attr(feature = "bindings", derive(TS))]
8247pub struct PathColumnConstraint {
8248 pub this: Box<Expression>,
8249}
8250
8251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8253#[cfg_attr(feature = "bindings", derive(TS))]
8254pub struct Constraint {
8255 pub this: Box<Expression>,
8256 #[serde(default)]
8257 pub expressions: Vec<Expression>,
8258}
8259
8260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8262#[cfg_attr(feature = "bindings", derive(TS))]
8263pub struct Export {
8264 pub this: Box<Expression>,
8265 #[serde(default)]
8266 pub connection: Option<Box<Expression>>,
8267 #[serde(default)]
8268 pub options: Vec<Expression>,
8269}
8270
8271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8273#[cfg_attr(feature = "bindings", derive(TS))]
8274pub struct Filter {
8275 pub this: Box<Expression>,
8276 pub expression: Box<Expression>,
8277}
8278
8279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8281#[cfg_attr(feature = "bindings", derive(TS))]
8282pub struct Changes {
8283 #[serde(default)]
8284 pub information: Option<Box<Expression>>,
8285 #[serde(default)]
8286 pub at_before: Option<Box<Expression>>,
8287 #[serde(default)]
8288 pub end: Option<Box<Expression>>,
8289}
8290
8291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8293#[cfg_attr(feature = "bindings", derive(TS))]
8294pub struct Directory {
8295 pub this: Box<Expression>,
8296 #[serde(default)]
8297 pub local: Option<Box<Expression>>,
8298 #[serde(default)]
8299 pub row_format: Option<Box<Expression>>,
8300}
8301
8302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8304#[cfg_attr(feature = "bindings", derive(TS))]
8305pub struct ForeignKey {
8306 #[serde(default)]
8307 pub expressions: Vec<Expression>,
8308 #[serde(default)]
8309 pub reference: Option<Box<Expression>>,
8310 #[serde(default)]
8311 pub delete: Option<Box<Expression>>,
8312 #[serde(default)]
8313 pub update: Option<Box<Expression>>,
8314 #[serde(default)]
8315 pub options: Vec<Expression>,
8316}
8317
8318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8320#[cfg_attr(feature = "bindings", derive(TS))]
8321pub struct ColumnPrefix {
8322 pub this: Box<Expression>,
8323 pub expression: Box<Expression>,
8324}
8325
8326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8328#[cfg_attr(feature = "bindings", derive(TS))]
8329pub struct PrimaryKey {
8330 #[serde(default)]
8331 pub this: Option<Box<Expression>>,
8332 #[serde(default)]
8333 pub expressions: Vec<Expression>,
8334 #[serde(default)]
8335 pub options: Vec<Expression>,
8336 #[serde(default)]
8337 pub include: Option<Box<Expression>>,
8338}
8339
8340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8342#[cfg_attr(feature = "bindings", derive(TS))]
8343pub struct IntoClause {
8344 #[serde(default)]
8345 pub this: Option<Box<Expression>>,
8346 #[serde(default)]
8347 pub temporary: bool,
8348 #[serde(default)]
8349 pub unlogged: Option<Box<Expression>>,
8350 #[serde(default)]
8351 pub bulk_collect: Option<Box<Expression>>,
8352 #[serde(default)]
8353 pub expressions: Vec<Expression>,
8354}
8355
8356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8358#[cfg_attr(feature = "bindings", derive(TS))]
8359pub struct JoinHint {
8360 pub this: Box<Expression>,
8361 #[serde(default)]
8362 pub expressions: Vec<Expression>,
8363}
8364
8365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8367#[cfg_attr(feature = "bindings", derive(TS))]
8368pub struct Opclass {
8369 pub this: Box<Expression>,
8370 pub expression: Box<Expression>,
8371}
8372
8373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8375#[cfg_attr(feature = "bindings", derive(TS))]
8376pub struct Index {
8377 #[serde(default)]
8378 pub this: Option<Box<Expression>>,
8379 #[serde(default)]
8380 pub table: Option<Box<Expression>>,
8381 #[serde(default)]
8382 pub unique: bool,
8383 #[serde(default)]
8384 pub primary: Option<Box<Expression>>,
8385 #[serde(default)]
8386 pub amp: Option<Box<Expression>>,
8387 #[serde(default)]
8388 pub params: Vec<Expression>,
8389}
8390
8391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8393#[cfg_attr(feature = "bindings", derive(TS))]
8394pub struct IndexParameters {
8395 #[serde(default)]
8396 pub using: Option<Box<Expression>>,
8397 #[serde(default)]
8398 pub include: Option<Box<Expression>>,
8399 #[serde(default)]
8400 pub columns: Vec<Expression>,
8401 #[serde(default)]
8402 pub with_storage: Option<Box<Expression>>,
8403 #[serde(default)]
8404 pub partition_by: Option<Box<Expression>>,
8405 #[serde(default)]
8406 pub tablespace: Option<Box<Expression>>,
8407 #[serde(default)]
8408 pub where_: Option<Box<Expression>>,
8409 #[serde(default)]
8410 pub on: Option<Box<Expression>>,
8411}
8412
8413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8415#[cfg_attr(feature = "bindings", derive(TS))]
8416pub struct ConditionalInsert {
8417 pub this: Box<Expression>,
8418 #[serde(default)]
8419 pub expression: Option<Box<Expression>>,
8420 #[serde(default)]
8421 pub else_: Option<Box<Expression>>,
8422}
8423
8424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8426#[cfg_attr(feature = "bindings", derive(TS))]
8427pub struct MultitableInserts {
8428 #[serde(default)]
8429 pub expressions: Vec<Expression>,
8430 pub kind: String,
8431 #[serde(default)]
8432 pub source: Option<Box<Expression>>,
8433 #[serde(default)]
8435 pub leading_comments: Vec<String>,
8436}
8437
8438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8440#[cfg_attr(feature = "bindings", derive(TS))]
8441pub struct OnConflict {
8442 #[serde(default)]
8443 pub duplicate: Option<Box<Expression>>,
8444 #[serde(default)]
8445 pub expressions: Vec<Expression>,
8446 #[serde(default)]
8447 pub action: Option<Box<Expression>>,
8448 #[serde(default)]
8449 pub conflict_keys: Option<Box<Expression>>,
8450 #[serde(default)]
8451 pub index_predicate: Option<Box<Expression>>,
8452 #[serde(default)]
8453 pub constraint: Option<Box<Expression>>,
8454 #[serde(default)]
8455 pub where_: Option<Box<Expression>>,
8456}
8457
8458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8460#[cfg_attr(feature = "bindings", derive(TS))]
8461pub struct OnCondition {
8462 #[serde(default)]
8463 pub error: Option<Box<Expression>>,
8464 #[serde(default)]
8465 pub empty: Option<Box<Expression>>,
8466 #[serde(default)]
8467 pub null: Option<Box<Expression>>,
8468}
8469
8470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8472#[cfg_attr(feature = "bindings", derive(TS))]
8473pub struct Returning {
8474 #[serde(default)]
8475 pub expressions: Vec<Expression>,
8476 #[serde(default)]
8477 pub into: Option<Box<Expression>>,
8478}
8479
8480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8482#[cfg_attr(feature = "bindings", derive(TS))]
8483pub struct Introducer {
8484 pub this: Box<Expression>,
8485 pub expression: Box<Expression>,
8486}
8487
8488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8490#[cfg_attr(feature = "bindings", derive(TS))]
8491pub struct PartitionRange {
8492 pub this: Box<Expression>,
8493 #[serde(default)]
8494 pub expression: Option<Box<Expression>>,
8495 #[serde(default)]
8496 pub expressions: Vec<Expression>,
8497}
8498
8499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8501#[cfg_attr(feature = "bindings", derive(TS))]
8502pub struct Group {
8503 #[serde(default)]
8504 pub expressions: Vec<Expression>,
8505 #[serde(default)]
8506 pub grouping_sets: Option<Box<Expression>>,
8507 #[serde(default)]
8508 pub cube: Option<Box<Expression>>,
8509 #[serde(default)]
8510 pub rollup: Option<Box<Expression>>,
8511 #[serde(default)]
8512 pub totals: Option<Box<Expression>>,
8513 #[serde(default)]
8515 pub all: Option<bool>,
8516}
8517
8518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8520#[cfg_attr(feature = "bindings", derive(TS))]
8521pub struct Cube {
8522 #[serde(default)]
8523 pub expressions: Vec<Expression>,
8524}
8525
8526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8528#[cfg_attr(feature = "bindings", derive(TS))]
8529pub struct Rollup {
8530 #[serde(default)]
8531 pub expressions: Vec<Expression>,
8532}
8533
8534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8536#[cfg_attr(feature = "bindings", derive(TS))]
8537pub struct GroupingSets {
8538 #[serde(default)]
8539 pub expressions: Vec<Expression>,
8540}
8541
8542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8544#[cfg_attr(feature = "bindings", derive(TS))]
8545pub struct LimitOptions {
8546 #[serde(default)]
8547 pub percent: Option<Box<Expression>>,
8548 #[serde(default)]
8549 pub rows: Option<Box<Expression>>,
8550 #[serde(default)]
8551 pub with_ties: Option<Box<Expression>>,
8552}
8553
8554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8556#[cfg_attr(feature = "bindings", derive(TS))]
8557pub struct Lateral {
8558 pub this: Box<Expression>,
8559 #[serde(default)]
8560 pub view: Option<Box<Expression>>,
8561 #[serde(default)]
8562 pub outer: Option<Box<Expression>>,
8563 #[serde(default)]
8564 pub alias: Option<String>,
8565 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8567 pub alias_quoted: bool,
8568 #[serde(default)]
8569 pub cross_apply: Option<Box<Expression>>,
8570 #[serde(default)]
8571 pub ordinality: Option<Box<Expression>>,
8572 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8574 pub column_aliases: Vec<String>,
8575}
8576
8577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8579#[cfg_attr(feature = "bindings", derive(TS))]
8580pub struct TableFromRows {
8581 pub this: Box<Expression>,
8582 #[serde(default)]
8583 pub alias: Option<String>,
8584 #[serde(default)]
8585 pub joins: Vec<Expression>,
8586 #[serde(default)]
8587 pub pivots: Option<Box<Expression>>,
8588 #[serde(default)]
8589 pub sample: Option<Box<Expression>>,
8590}
8591
8592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8595#[cfg_attr(feature = "bindings", derive(TS))]
8596pub struct RowsFrom {
8597 pub expressions: Vec<Expression>,
8599 #[serde(default)]
8601 pub ordinality: bool,
8602 #[serde(default)]
8604 pub alias: Option<Box<Expression>>,
8605}
8606
8607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8609#[cfg_attr(feature = "bindings", derive(TS))]
8610pub struct WithFill {
8611 #[serde(default)]
8612 pub from_: Option<Box<Expression>>,
8613 #[serde(default)]
8614 pub to: Option<Box<Expression>>,
8615 #[serde(default)]
8616 pub step: Option<Box<Expression>>,
8617 #[serde(default)]
8618 pub staleness: Option<Box<Expression>>,
8619 #[serde(default)]
8620 pub interpolate: Option<Box<Expression>>,
8621}
8622
8623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8625#[cfg_attr(feature = "bindings", derive(TS))]
8626pub struct Property {
8627 pub this: Box<Expression>,
8628 #[serde(default)]
8629 pub value: Option<Box<Expression>>,
8630}
8631
8632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8634#[cfg_attr(feature = "bindings", derive(TS))]
8635pub struct GrantPrivilege {
8636 pub this: Box<Expression>,
8637 #[serde(default)]
8638 pub expressions: Vec<Expression>,
8639}
8640
8641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8643#[cfg_attr(feature = "bindings", derive(TS))]
8644pub struct AllowedValuesProperty {
8645 #[serde(default)]
8646 pub expressions: Vec<Expression>,
8647}
8648
8649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8651#[cfg_attr(feature = "bindings", derive(TS))]
8652pub struct AlgorithmProperty {
8653 pub this: Box<Expression>,
8654}
8655
8656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8658#[cfg_attr(feature = "bindings", derive(TS))]
8659pub struct AutoIncrementProperty {
8660 pub this: Box<Expression>,
8661}
8662
8663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8665#[cfg_attr(feature = "bindings", derive(TS))]
8666pub struct AutoRefreshProperty {
8667 pub this: Box<Expression>,
8668}
8669
8670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8672#[cfg_attr(feature = "bindings", derive(TS))]
8673pub struct BackupProperty {
8674 pub this: Box<Expression>,
8675}
8676
8677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8679#[cfg_attr(feature = "bindings", derive(TS))]
8680pub struct BuildProperty {
8681 pub this: Box<Expression>,
8682}
8683
8684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8686#[cfg_attr(feature = "bindings", derive(TS))]
8687pub struct BlockCompressionProperty {
8688 #[serde(default)]
8689 pub autotemp: Option<Box<Expression>>,
8690 #[serde(default)]
8691 pub always: Option<Box<Expression>>,
8692 #[serde(default)]
8693 pub default: Option<Box<Expression>>,
8694 #[serde(default)]
8695 pub manual: Option<Box<Expression>>,
8696 #[serde(default)]
8697 pub never: Option<Box<Expression>>,
8698}
8699
8700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8702#[cfg_attr(feature = "bindings", derive(TS))]
8703pub struct CharacterSetProperty {
8704 pub this: Box<Expression>,
8705 #[serde(default)]
8706 pub default: Option<Box<Expression>>,
8707}
8708
8709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8711#[cfg_attr(feature = "bindings", derive(TS))]
8712pub struct ChecksumProperty {
8713 #[serde(default)]
8714 pub on: Option<Box<Expression>>,
8715 #[serde(default)]
8716 pub default: Option<Box<Expression>>,
8717}
8718
8719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8721#[cfg_attr(feature = "bindings", derive(TS))]
8722pub struct CollateProperty {
8723 pub this: Box<Expression>,
8724 #[serde(default)]
8725 pub default: Option<Box<Expression>>,
8726}
8727
8728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8730#[cfg_attr(feature = "bindings", derive(TS))]
8731pub struct DataBlocksizeProperty {
8732 #[serde(default)]
8733 pub size: Option<i64>,
8734 #[serde(default)]
8735 pub units: Option<Box<Expression>>,
8736 #[serde(default)]
8737 pub minimum: Option<Box<Expression>>,
8738 #[serde(default)]
8739 pub maximum: Option<Box<Expression>>,
8740 #[serde(default)]
8741 pub default: Option<Box<Expression>>,
8742}
8743
8744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8746#[cfg_attr(feature = "bindings", derive(TS))]
8747pub struct DataDeletionProperty {
8748 pub on: Box<Expression>,
8749 #[serde(default)]
8750 pub filter_column: Option<Box<Expression>>,
8751 #[serde(default)]
8752 pub retention_period: Option<Box<Expression>>,
8753}
8754
8755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8757#[cfg_attr(feature = "bindings", derive(TS))]
8758pub struct DefinerProperty {
8759 pub this: Box<Expression>,
8760}
8761
8762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8764#[cfg_attr(feature = "bindings", derive(TS))]
8765pub struct DistKeyProperty {
8766 pub this: Box<Expression>,
8767}
8768
8769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8771#[cfg_attr(feature = "bindings", derive(TS))]
8772pub struct DistributedByProperty {
8773 #[serde(default)]
8774 pub expressions: Vec<Expression>,
8775 pub kind: String,
8776 #[serde(default)]
8777 pub buckets: Option<Box<Expression>>,
8778 #[serde(default)]
8779 pub order: Option<Box<Expression>>,
8780}
8781
8782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8784#[cfg_attr(feature = "bindings", derive(TS))]
8785pub struct DistStyleProperty {
8786 pub this: Box<Expression>,
8787}
8788
8789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8791#[cfg_attr(feature = "bindings", derive(TS))]
8792pub struct DuplicateKeyProperty {
8793 #[serde(default)]
8794 pub expressions: Vec<Expression>,
8795}
8796
8797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8799#[cfg_attr(feature = "bindings", derive(TS))]
8800pub struct EngineProperty {
8801 pub this: Box<Expression>,
8802}
8803
8804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8806#[cfg_attr(feature = "bindings", derive(TS))]
8807pub struct ToTableProperty {
8808 pub this: Box<Expression>,
8809}
8810
8811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8813#[cfg_attr(feature = "bindings", derive(TS))]
8814pub struct ExecuteAsProperty {
8815 pub this: Box<Expression>,
8816}
8817
8818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8820#[cfg_attr(feature = "bindings", derive(TS))]
8821pub struct ExternalProperty {
8822 #[serde(default)]
8823 pub this: Option<Box<Expression>>,
8824}
8825
8826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8828#[cfg_attr(feature = "bindings", derive(TS))]
8829pub struct FallbackProperty {
8830 #[serde(default)]
8831 pub no: Option<Box<Expression>>,
8832 #[serde(default)]
8833 pub protection: Option<Box<Expression>>,
8834}
8835
8836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8838#[cfg_attr(feature = "bindings", derive(TS))]
8839pub struct FileFormatProperty {
8840 #[serde(default)]
8841 pub this: Option<Box<Expression>>,
8842 #[serde(default)]
8843 pub expressions: Vec<Expression>,
8844 #[serde(default)]
8845 pub hive_format: Option<Box<Expression>>,
8846}
8847
8848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8850#[cfg_attr(feature = "bindings", derive(TS))]
8851pub struct CredentialsProperty {
8852 #[serde(default)]
8853 pub expressions: Vec<Expression>,
8854}
8855
8856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8858#[cfg_attr(feature = "bindings", derive(TS))]
8859pub struct FreespaceProperty {
8860 pub this: Box<Expression>,
8861 #[serde(default)]
8862 pub percent: Option<Box<Expression>>,
8863}
8864
8865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8867#[cfg_attr(feature = "bindings", derive(TS))]
8868pub struct InheritsProperty {
8869 #[serde(default)]
8870 pub expressions: Vec<Expression>,
8871}
8872
8873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8875#[cfg_attr(feature = "bindings", derive(TS))]
8876pub struct InputModelProperty {
8877 pub this: Box<Expression>,
8878}
8879
8880#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8882#[cfg_attr(feature = "bindings", derive(TS))]
8883pub struct OutputModelProperty {
8884 pub this: Box<Expression>,
8885}
8886
8887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8889#[cfg_attr(feature = "bindings", derive(TS))]
8890pub struct IsolatedLoadingProperty {
8891 #[serde(default)]
8892 pub no: Option<Box<Expression>>,
8893 #[serde(default)]
8894 pub concurrent: Option<Box<Expression>>,
8895 #[serde(default)]
8896 pub target: Option<Box<Expression>>,
8897}
8898
8899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8901#[cfg_attr(feature = "bindings", derive(TS))]
8902pub struct JournalProperty {
8903 #[serde(default)]
8904 pub no: Option<Box<Expression>>,
8905 #[serde(default)]
8906 pub dual: Option<Box<Expression>>,
8907 #[serde(default)]
8908 pub before: Option<Box<Expression>>,
8909 #[serde(default)]
8910 pub local: Option<Box<Expression>>,
8911 #[serde(default)]
8912 pub after: Option<Box<Expression>>,
8913}
8914
8915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8917#[cfg_attr(feature = "bindings", derive(TS))]
8918pub struct LanguageProperty {
8919 pub this: Box<Expression>,
8920}
8921
8922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8924#[cfg_attr(feature = "bindings", derive(TS))]
8925pub struct EnviromentProperty {
8926 #[serde(default)]
8927 pub expressions: Vec<Expression>,
8928}
8929
8930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8932#[cfg_attr(feature = "bindings", derive(TS))]
8933pub struct ClusteredByProperty {
8934 #[serde(default)]
8935 pub expressions: Vec<Expression>,
8936 #[serde(default)]
8937 pub sorted_by: Option<Box<Expression>>,
8938 #[serde(default)]
8939 pub buckets: Option<Box<Expression>>,
8940}
8941
8942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8944#[cfg_attr(feature = "bindings", derive(TS))]
8945pub struct DictProperty {
8946 pub this: Box<Expression>,
8947 pub kind: String,
8948 #[serde(default)]
8949 pub settings: Option<Box<Expression>>,
8950}
8951
8952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8954#[cfg_attr(feature = "bindings", derive(TS))]
8955pub struct DictRange {
8956 pub this: Box<Expression>,
8957 #[serde(default)]
8958 pub min: Option<Box<Expression>>,
8959 #[serde(default)]
8960 pub max: Option<Box<Expression>>,
8961}
8962
8963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8965#[cfg_attr(feature = "bindings", derive(TS))]
8966pub struct OnCluster {
8967 pub this: Box<Expression>,
8968}
8969
8970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8972#[cfg_attr(feature = "bindings", derive(TS))]
8973pub struct LikeProperty {
8974 pub this: Box<Expression>,
8975 #[serde(default)]
8976 pub expressions: Vec<Expression>,
8977}
8978
8979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8981#[cfg_attr(feature = "bindings", derive(TS))]
8982pub struct LocationProperty {
8983 pub this: Box<Expression>,
8984}
8985
8986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8988#[cfg_attr(feature = "bindings", derive(TS))]
8989pub struct LockProperty {
8990 pub this: Box<Expression>,
8991}
8992
8993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8995#[cfg_attr(feature = "bindings", derive(TS))]
8996pub struct LockingProperty {
8997 #[serde(default)]
8998 pub this: Option<Box<Expression>>,
8999 pub kind: String,
9000 #[serde(default)]
9001 pub for_or_in: Option<Box<Expression>>,
9002 #[serde(default)]
9003 pub lock_type: Option<Box<Expression>>,
9004 #[serde(default)]
9005 pub override_: Option<Box<Expression>>,
9006}
9007
9008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9010#[cfg_attr(feature = "bindings", derive(TS))]
9011pub struct LogProperty {
9012 #[serde(default)]
9013 pub no: Option<Box<Expression>>,
9014}
9015
9016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9018#[cfg_attr(feature = "bindings", derive(TS))]
9019pub struct MaterializedProperty {
9020 #[serde(default)]
9021 pub this: Option<Box<Expression>>,
9022}
9023
9024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9026#[cfg_attr(feature = "bindings", derive(TS))]
9027pub struct MergeBlockRatioProperty {
9028 #[serde(default)]
9029 pub this: Option<Box<Expression>>,
9030 #[serde(default)]
9031 pub no: Option<Box<Expression>>,
9032 #[serde(default)]
9033 pub default: Option<Box<Expression>>,
9034 #[serde(default)]
9035 pub percent: Option<Box<Expression>>,
9036}
9037
9038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9040#[cfg_attr(feature = "bindings", derive(TS))]
9041pub struct OnProperty {
9042 pub this: Box<Expression>,
9043}
9044
9045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9047#[cfg_attr(feature = "bindings", derive(TS))]
9048pub struct OnCommitProperty {
9049 #[serde(default)]
9050 pub delete: Option<Box<Expression>>,
9051}
9052
9053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9055#[cfg_attr(feature = "bindings", derive(TS))]
9056pub struct PartitionedByProperty {
9057 pub this: Box<Expression>,
9058}
9059
9060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9062#[cfg_attr(feature = "bindings", derive(TS))]
9063pub struct PartitionByProperty {
9064 #[serde(default)]
9065 pub expressions: Vec<Expression>,
9066}
9067
9068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9070#[cfg_attr(feature = "bindings", derive(TS))]
9071pub struct PartitionedByBucket {
9072 pub this: Box<Expression>,
9073 pub expression: Box<Expression>,
9074}
9075
9076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9078#[cfg_attr(feature = "bindings", derive(TS))]
9079pub struct ClusterByColumnsProperty {
9080 #[serde(default)]
9081 pub columns: Vec<Identifier>,
9082}
9083
9084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9086#[cfg_attr(feature = "bindings", derive(TS))]
9087pub struct PartitionByTruncate {
9088 pub this: Box<Expression>,
9089 pub expression: Box<Expression>,
9090}
9091
9092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9094#[cfg_attr(feature = "bindings", derive(TS))]
9095pub struct PartitionByRangeProperty {
9096 #[serde(default)]
9097 pub partition_expressions: Option<Box<Expression>>,
9098 #[serde(default)]
9099 pub create_expressions: Option<Box<Expression>>,
9100}
9101
9102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9104#[cfg_attr(feature = "bindings", derive(TS))]
9105pub struct PartitionByRangePropertyDynamic {
9106 #[serde(default)]
9107 pub this: Option<Box<Expression>>,
9108 #[serde(default)]
9109 pub start: Option<Box<Expression>>,
9110 #[serde(default)]
9112 pub use_start_end: bool,
9113 #[serde(default)]
9114 pub end: Option<Box<Expression>>,
9115 #[serde(default)]
9116 pub every: Option<Box<Expression>>,
9117}
9118
9119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9121#[cfg_attr(feature = "bindings", derive(TS))]
9122pub struct PartitionByListProperty {
9123 #[serde(default)]
9124 pub partition_expressions: Option<Box<Expression>>,
9125 #[serde(default)]
9126 pub create_expressions: Option<Box<Expression>>,
9127}
9128
9129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9131#[cfg_attr(feature = "bindings", derive(TS))]
9132pub struct PartitionList {
9133 pub this: Box<Expression>,
9134 #[serde(default)]
9135 pub expressions: Vec<Expression>,
9136}
9137
9138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9140#[cfg_attr(feature = "bindings", derive(TS))]
9141pub struct Partition {
9142 pub expressions: Vec<Expression>,
9143 #[serde(default)]
9144 pub subpartition: bool,
9145}
9146
9147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9150#[cfg_attr(feature = "bindings", derive(TS))]
9151pub struct RefreshTriggerProperty {
9152 pub method: String,
9154 #[serde(default)]
9156 pub kind: Option<String>,
9157 #[serde(default)]
9159 pub every: Option<Box<Expression>>,
9160 #[serde(default)]
9162 pub unit: Option<String>,
9163 #[serde(default)]
9165 pub starts: Option<Box<Expression>>,
9166}
9167
9168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9170#[cfg_attr(feature = "bindings", derive(TS))]
9171pub struct UniqueKeyProperty {
9172 #[serde(default)]
9173 pub expressions: Vec<Expression>,
9174}
9175
9176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9178#[cfg_attr(feature = "bindings", derive(TS))]
9179pub struct RollupProperty {
9180 pub expressions: Vec<RollupIndex>,
9181}
9182
9183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9185#[cfg_attr(feature = "bindings", derive(TS))]
9186pub struct RollupIndex {
9187 pub name: Identifier,
9188 pub expressions: Vec<Identifier>,
9189}
9190
9191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9193#[cfg_attr(feature = "bindings", derive(TS))]
9194pub struct PartitionBoundSpec {
9195 #[serde(default)]
9196 pub this: Option<Box<Expression>>,
9197 #[serde(default)]
9198 pub expression: Option<Box<Expression>>,
9199 #[serde(default)]
9200 pub from_expressions: Option<Box<Expression>>,
9201 #[serde(default)]
9202 pub to_expressions: Option<Box<Expression>>,
9203}
9204
9205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9207#[cfg_attr(feature = "bindings", derive(TS))]
9208pub struct PartitionedOfProperty {
9209 pub this: Box<Expression>,
9210 pub expression: Box<Expression>,
9211}
9212
9213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9215#[cfg_attr(feature = "bindings", derive(TS))]
9216pub struct RemoteWithConnectionModelProperty {
9217 pub this: Box<Expression>,
9218}
9219
9220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9222#[cfg_attr(feature = "bindings", derive(TS))]
9223pub struct ReturnsProperty {
9224 #[serde(default)]
9225 pub this: Option<Box<Expression>>,
9226 #[serde(default)]
9227 pub is_table: Option<Box<Expression>>,
9228 #[serde(default)]
9229 pub table: Option<Box<Expression>>,
9230 #[serde(default)]
9231 pub null: Option<Box<Expression>>,
9232}
9233
9234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9236#[cfg_attr(feature = "bindings", derive(TS))]
9237pub struct RowFormatProperty {
9238 pub this: Box<Expression>,
9239}
9240
9241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9243#[cfg_attr(feature = "bindings", derive(TS))]
9244pub struct RowFormatDelimitedProperty {
9245 #[serde(default)]
9246 pub fields: Option<Box<Expression>>,
9247 #[serde(default)]
9248 pub escaped: Option<Box<Expression>>,
9249 #[serde(default)]
9250 pub collection_items: Option<Box<Expression>>,
9251 #[serde(default)]
9252 pub map_keys: Option<Box<Expression>>,
9253 #[serde(default)]
9254 pub lines: Option<Box<Expression>>,
9255 #[serde(default)]
9256 pub null: Option<Box<Expression>>,
9257 #[serde(default)]
9258 pub serde: Option<Box<Expression>>,
9259}
9260
9261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9263#[cfg_attr(feature = "bindings", derive(TS))]
9264pub struct RowFormatSerdeProperty {
9265 pub this: Box<Expression>,
9266 #[serde(default)]
9267 pub serde_properties: Option<Box<Expression>>,
9268}
9269
9270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9272#[cfg_attr(feature = "bindings", derive(TS))]
9273pub struct QueryTransform {
9274 #[serde(default)]
9275 pub expressions: Vec<Expression>,
9276 #[serde(default)]
9277 pub command_script: Option<Box<Expression>>,
9278 #[serde(default)]
9279 pub schema: Option<Box<Expression>>,
9280 #[serde(default)]
9281 pub row_format_before: Option<Box<Expression>>,
9282 #[serde(default)]
9283 pub record_writer: Option<Box<Expression>>,
9284 #[serde(default)]
9285 pub row_format_after: Option<Box<Expression>>,
9286 #[serde(default)]
9287 pub record_reader: Option<Box<Expression>>,
9288}
9289
9290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9292#[cfg_attr(feature = "bindings", derive(TS))]
9293pub struct SampleProperty {
9294 pub this: Box<Expression>,
9295}
9296
9297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9299#[cfg_attr(feature = "bindings", derive(TS))]
9300pub struct SecurityProperty {
9301 pub this: Box<Expression>,
9302}
9303
9304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9306#[cfg_attr(feature = "bindings", derive(TS))]
9307pub struct SchemaCommentProperty {
9308 pub this: Box<Expression>,
9309}
9310
9311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9313#[cfg_attr(feature = "bindings", derive(TS))]
9314pub struct SemanticView {
9315 pub this: Box<Expression>,
9316 #[serde(default)]
9317 pub metrics: Option<Box<Expression>>,
9318 #[serde(default)]
9319 pub dimensions: Option<Box<Expression>>,
9320 #[serde(default)]
9321 pub facts: Option<Box<Expression>>,
9322 #[serde(default)]
9323 pub where_: Option<Box<Expression>>,
9324}
9325
9326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9328#[cfg_attr(feature = "bindings", derive(TS))]
9329pub struct SerdeProperties {
9330 #[serde(default)]
9331 pub expressions: Vec<Expression>,
9332 #[serde(default)]
9333 pub with_: Option<Box<Expression>>,
9334}
9335
9336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9338#[cfg_attr(feature = "bindings", derive(TS))]
9339pub struct SetProperty {
9340 #[serde(default)]
9341 pub multi: Option<Box<Expression>>,
9342}
9343
9344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9346#[cfg_attr(feature = "bindings", derive(TS))]
9347pub struct SharingProperty {
9348 #[serde(default)]
9349 pub this: Option<Box<Expression>>,
9350}
9351
9352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9354#[cfg_attr(feature = "bindings", derive(TS))]
9355pub struct SetConfigProperty {
9356 pub this: Box<Expression>,
9357}
9358
9359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9361#[cfg_attr(feature = "bindings", derive(TS))]
9362pub struct SettingsProperty {
9363 #[serde(default)]
9364 pub expressions: Vec<Expression>,
9365}
9366
9367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9369#[cfg_attr(feature = "bindings", derive(TS))]
9370pub struct SortKeyProperty {
9371 pub this: Box<Expression>,
9372 #[serde(default)]
9373 pub compound: Option<Box<Expression>>,
9374}
9375
9376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9378#[cfg_attr(feature = "bindings", derive(TS))]
9379pub struct SqlReadWriteProperty {
9380 pub this: Box<Expression>,
9381}
9382
9383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9385#[cfg_attr(feature = "bindings", derive(TS))]
9386pub struct SqlSecurityProperty {
9387 pub this: Box<Expression>,
9388}
9389
9390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9392#[cfg_attr(feature = "bindings", derive(TS))]
9393pub struct StabilityProperty {
9394 pub this: Box<Expression>,
9395}
9396
9397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9399#[cfg_attr(feature = "bindings", derive(TS))]
9400pub struct StorageHandlerProperty {
9401 pub this: Box<Expression>,
9402}
9403
9404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9406#[cfg_attr(feature = "bindings", derive(TS))]
9407pub struct TemporaryProperty {
9408 #[serde(default)]
9409 pub this: Option<Box<Expression>>,
9410}
9411
9412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9414#[cfg_attr(feature = "bindings", derive(TS))]
9415pub struct Tags {
9416 #[serde(default)]
9417 pub expressions: Vec<Expression>,
9418}
9419
9420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9422#[cfg_attr(feature = "bindings", derive(TS))]
9423pub struct TransformModelProperty {
9424 #[serde(default)]
9425 pub expressions: Vec<Expression>,
9426}
9427
9428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9430#[cfg_attr(feature = "bindings", derive(TS))]
9431pub struct TransientProperty {
9432 #[serde(default)]
9433 pub this: Option<Box<Expression>>,
9434}
9435
9436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9438#[cfg_attr(feature = "bindings", derive(TS))]
9439pub struct UsingTemplateProperty {
9440 pub this: Box<Expression>,
9441}
9442
9443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9445#[cfg_attr(feature = "bindings", derive(TS))]
9446pub struct ViewAttributeProperty {
9447 pub this: Box<Expression>,
9448}
9449
9450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9452#[cfg_attr(feature = "bindings", derive(TS))]
9453pub struct VolatileProperty {
9454 #[serde(default)]
9455 pub this: Option<Box<Expression>>,
9456}
9457
9458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9460#[cfg_attr(feature = "bindings", derive(TS))]
9461pub struct WithDataProperty {
9462 #[serde(default)]
9463 pub no: Option<Box<Expression>>,
9464 #[serde(default)]
9465 pub statistics: Option<Box<Expression>>,
9466}
9467
9468#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9470#[cfg_attr(feature = "bindings", derive(TS))]
9471pub struct WithJournalTableProperty {
9472 pub this: Box<Expression>,
9473}
9474
9475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9477#[cfg_attr(feature = "bindings", derive(TS))]
9478pub struct WithSchemaBindingProperty {
9479 pub this: Box<Expression>,
9480}
9481
9482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9484#[cfg_attr(feature = "bindings", derive(TS))]
9485pub struct WithSystemVersioningProperty {
9486 #[serde(default)]
9487 pub on: Option<Box<Expression>>,
9488 #[serde(default)]
9489 pub this: Option<Box<Expression>>,
9490 #[serde(default)]
9491 pub data_consistency: Option<Box<Expression>>,
9492 #[serde(default)]
9493 pub retention_period: Option<Box<Expression>>,
9494 #[serde(default)]
9495 pub with_: Option<Box<Expression>>,
9496}
9497
9498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9500#[cfg_attr(feature = "bindings", derive(TS))]
9501pub struct WithProcedureOptions {
9502 #[serde(default)]
9503 pub expressions: Vec<Expression>,
9504}
9505
9506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9508#[cfg_attr(feature = "bindings", derive(TS))]
9509pub struct EncodeProperty {
9510 pub this: Box<Expression>,
9511 #[serde(default)]
9512 pub properties: Vec<Expression>,
9513 #[serde(default)]
9514 pub key: Option<Box<Expression>>,
9515}
9516
9517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9519#[cfg_attr(feature = "bindings", derive(TS))]
9520pub struct IncludeProperty {
9521 pub this: Box<Expression>,
9522 #[serde(default)]
9523 pub alias: Option<String>,
9524 #[serde(default)]
9525 pub column_def: Option<Box<Expression>>,
9526}
9527
9528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9530#[cfg_attr(feature = "bindings", derive(TS))]
9531pub struct Properties {
9532 #[serde(default)]
9533 pub expressions: Vec<Expression>,
9534}
9535
9536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9538#[cfg_attr(feature = "bindings", derive(TS))]
9539pub struct OptionEntry {
9540 pub key: Identifier,
9541 pub value: Expression,
9542}
9543
9544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9546#[cfg_attr(feature = "bindings", derive(TS))]
9547pub struct OptionsProperty {
9548 #[serde(default)]
9549 pub entries: Vec<OptionEntry>,
9550}
9551
9552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9554#[cfg_attr(feature = "bindings", derive(TS))]
9555pub struct InputOutputFormat {
9556 #[serde(default)]
9557 pub input_format: Option<Box<Expression>>,
9558 #[serde(default)]
9559 pub output_format: Option<Box<Expression>>,
9560}
9561
9562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9564#[cfg_attr(feature = "bindings", derive(TS))]
9565pub struct Reference {
9566 pub this: Box<Expression>,
9567 #[serde(default)]
9568 pub expressions: Vec<Expression>,
9569 #[serde(default)]
9570 pub options: Vec<Expression>,
9571}
9572
9573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9575#[cfg_attr(feature = "bindings", derive(TS))]
9576pub struct QueryOption {
9577 pub this: Box<Expression>,
9578 #[serde(default)]
9579 pub expression: Option<Box<Expression>>,
9580}
9581
9582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9584#[cfg_attr(feature = "bindings", derive(TS))]
9585pub struct WithTableHint {
9586 #[serde(default)]
9587 pub expressions: Vec<Expression>,
9588}
9589
9590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9592#[cfg_attr(feature = "bindings", derive(TS))]
9593pub struct IndexTableHint {
9594 pub this: Box<Expression>,
9595 #[serde(default)]
9596 pub expressions: Vec<Expression>,
9597 #[serde(default)]
9598 pub target: Option<Box<Expression>>,
9599}
9600
9601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9603#[cfg_attr(feature = "bindings", derive(TS))]
9604pub struct Get {
9605 pub this: Box<Expression>,
9606 #[serde(default)]
9607 pub target: Option<Box<Expression>>,
9608 #[serde(default)]
9609 pub properties: Vec<Expression>,
9610}
9611
9612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9614#[cfg_attr(feature = "bindings", derive(TS))]
9615pub struct SetOperation {
9616 #[serde(default)]
9617 pub with_: Option<Box<Expression>>,
9618 pub this: Box<Expression>,
9619 pub expression: Box<Expression>,
9620 #[serde(default)]
9621 pub distinct: bool,
9622 #[serde(default)]
9623 pub by_name: Option<Box<Expression>>,
9624 #[serde(default)]
9625 pub side: Option<Box<Expression>>,
9626 #[serde(default)]
9627 pub kind: Option<String>,
9628 #[serde(default)]
9629 pub on: Option<Box<Expression>>,
9630}
9631
9632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9634#[cfg_attr(feature = "bindings", derive(TS))]
9635pub struct Var {
9636 pub this: String,
9637}
9638
9639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9641#[cfg_attr(feature = "bindings", derive(TS))]
9642pub struct Variadic {
9643 pub this: Box<Expression>,
9644}
9645
9646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9648#[cfg_attr(feature = "bindings", derive(TS))]
9649pub struct Version {
9650 pub this: Box<Expression>,
9651 pub kind: String,
9652 #[serde(default)]
9653 pub expression: Option<Box<Expression>>,
9654}
9655
9656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9658#[cfg_attr(feature = "bindings", derive(TS))]
9659pub struct Schema {
9660 #[serde(default)]
9661 pub this: Option<Box<Expression>>,
9662 #[serde(default)]
9663 pub expressions: Vec<Expression>,
9664}
9665
9666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9668#[cfg_attr(feature = "bindings", derive(TS))]
9669pub struct Lock {
9670 #[serde(default)]
9671 pub update: Option<Box<Expression>>,
9672 #[serde(default)]
9673 pub expressions: Vec<Expression>,
9674 #[serde(default)]
9675 pub wait: Option<Box<Expression>>,
9676 #[serde(default)]
9677 pub key: Option<Box<Expression>>,
9678}
9679
9680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9683#[cfg_attr(feature = "bindings", derive(TS))]
9684pub struct TableSample {
9685 #[serde(default, skip_serializing_if = "Option::is_none")]
9687 pub this: Option<Box<Expression>>,
9688 #[serde(default, skip_serializing_if = "Option::is_none")]
9690 pub sample: Option<Box<Sample>>,
9691 #[serde(default)]
9692 pub expressions: Vec<Expression>,
9693 #[serde(default)]
9694 pub method: Option<String>,
9695 #[serde(default)]
9696 pub bucket_numerator: Option<Box<Expression>>,
9697 #[serde(default)]
9698 pub bucket_denominator: Option<Box<Expression>>,
9699 #[serde(default)]
9700 pub bucket_field: Option<Box<Expression>>,
9701 #[serde(default)]
9702 pub percent: Option<Box<Expression>>,
9703 #[serde(default)]
9704 pub rows: Option<Box<Expression>>,
9705 #[serde(default)]
9706 pub size: Option<i64>,
9707 #[serde(default)]
9708 pub seed: Option<Box<Expression>>,
9709}
9710
9711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9713#[cfg_attr(feature = "bindings", derive(TS))]
9714pub struct Tag {
9715 #[serde(default)]
9716 pub this: Option<Box<Expression>>,
9717 #[serde(default)]
9718 pub prefix: Option<Box<Expression>>,
9719 #[serde(default)]
9720 pub postfix: Option<Box<Expression>>,
9721}
9722
9723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9725#[cfg_attr(feature = "bindings", derive(TS))]
9726pub struct UnpivotColumns {
9727 pub this: Box<Expression>,
9728 #[serde(default)]
9729 pub expressions: Vec<Expression>,
9730}
9731
9732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9734#[cfg_attr(feature = "bindings", derive(TS))]
9735pub struct SessionParameter {
9736 pub this: Box<Expression>,
9737 #[serde(default)]
9738 pub kind: Option<String>,
9739}
9740
9741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9743#[cfg_attr(feature = "bindings", derive(TS))]
9744pub struct PseudoType {
9745 pub this: Box<Expression>,
9746}
9747
9748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9750#[cfg_attr(feature = "bindings", derive(TS))]
9751pub struct ObjectIdentifier {
9752 pub this: Box<Expression>,
9753}
9754
9755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9757#[cfg_attr(feature = "bindings", derive(TS))]
9758pub struct Transaction {
9759 #[serde(default)]
9760 pub this: Option<Box<Expression>>,
9761 #[serde(default)]
9762 pub modes: Option<Box<Expression>>,
9763 #[serde(default)]
9764 pub mark: Option<Box<Expression>>,
9765}
9766
9767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9769#[cfg_attr(feature = "bindings", derive(TS))]
9770pub struct Commit {
9771 #[serde(default)]
9772 pub chain: Option<Box<Expression>>,
9773 #[serde(default)]
9774 pub this: Option<Box<Expression>>,
9775 #[serde(default)]
9776 pub durability: Option<Box<Expression>>,
9777}
9778
9779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9781#[cfg_attr(feature = "bindings", derive(TS))]
9782pub struct Rollback {
9783 #[serde(default)]
9784 pub savepoint: Option<Box<Expression>>,
9785 #[serde(default)]
9786 pub this: Option<Box<Expression>>,
9787}
9788
9789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9791#[cfg_attr(feature = "bindings", derive(TS))]
9792pub struct AlterSession {
9793 #[serde(default)]
9794 pub expressions: Vec<Expression>,
9795 #[serde(default)]
9796 pub unset: Option<Box<Expression>>,
9797}
9798
9799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9801#[cfg_attr(feature = "bindings", derive(TS))]
9802pub struct Analyze {
9803 #[serde(default)]
9804 pub kind: Option<String>,
9805 #[serde(default)]
9806 pub this: Option<Box<Expression>>,
9807 #[serde(default)]
9808 pub options: Vec<Expression>,
9809 #[serde(default)]
9810 pub mode: Option<Box<Expression>>,
9811 #[serde(default)]
9812 pub partition: Option<Box<Expression>>,
9813 #[serde(default)]
9814 pub expression: Option<Box<Expression>>,
9815 #[serde(default)]
9816 pub properties: Vec<Expression>,
9817 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9819 pub columns: Vec<String>,
9820}
9821
9822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9824#[cfg_attr(feature = "bindings", derive(TS))]
9825pub struct AnalyzeStatistics {
9826 pub kind: String,
9827 #[serde(default)]
9828 pub option: Option<Box<Expression>>,
9829 #[serde(default)]
9830 pub this: Option<Box<Expression>>,
9831 #[serde(default)]
9832 pub expressions: Vec<Expression>,
9833}
9834
9835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9837#[cfg_attr(feature = "bindings", derive(TS))]
9838pub struct AnalyzeHistogram {
9839 pub this: Box<Expression>,
9840 #[serde(default)]
9841 pub expressions: Vec<Expression>,
9842 #[serde(default)]
9843 pub expression: Option<Box<Expression>>,
9844 #[serde(default)]
9845 pub update_options: Option<Box<Expression>>,
9846}
9847
9848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9850#[cfg_attr(feature = "bindings", derive(TS))]
9851pub struct AnalyzeSample {
9852 pub kind: String,
9853 #[serde(default)]
9854 pub sample: Option<Box<Expression>>,
9855}
9856
9857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9859#[cfg_attr(feature = "bindings", derive(TS))]
9860pub struct AnalyzeListChainedRows {
9861 #[serde(default)]
9862 pub expression: Option<Box<Expression>>,
9863}
9864
9865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9867#[cfg_attr(feature = "bindings", derive(TS))]
9868pub struct AnalyzeDelete {
9869 #[serde(default)]
9870 pub kind: Option<String>,
9871}
9872
9873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9875#[cfg_attr(feature = "bindings", derive(TS))]
9876pub struct AnalyzeWith {
9877 #[serde(default)]
9878 pub expressions: Vec<Expression>,
9879}
9880
9881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9883#[cfg_attr(feature = "bindings", derive(TS))]
9884pub struct AnalyzeValidate {
9885 pub kind: String,
9886 #[serde(default)]
9887 pub this: Option<Box<Expression>>,
9888 #[serde(default)]
9889 pub expression: Option<Box<Expression>>,
9890}
9891
9892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9894#[cfg_attr(feature = "bindings", derive(TS))]
9895pub struct AddPartition {
9896 pub this: Box<Expression>,
9897 #[serde(default)]
9898 pub exists: bool,
9899 #[serde(default)]
9900 pub location: Option<Box<Expression>>,
9901}
9902
9903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9905#[cfg_attr(feature = "bindings", derive(TS))]
9906pub struct AttachOption {
9907 pub this: Box<Expression>,
9908 #[serde(default)]
9909 pub expression: Option<Box<Expression>>,
9910}
9911
9912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9914#[cfg_attr(feature = "bindings", derive(TS))]
9915pub struct DropPartition {
9916 #[serde(default)]
9917 pub expressions: Vec<Expression>,
9918 #[serde(default)]
9919 pub exists: bool,
9920}
9921
9922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9924#[cfg_attr(feature = "bindings", derive(TS))]
9925pub struct ReplacePartition {
9926 pub expression: Box<Expression>,
9927 #[serde(default)]
9928 pub source: Option<Box<Expression>>,
9929}
9930
9931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9933#[cfg_attr(feature = "bindings", derive(TS))]
9934pub struct DPipe {
9935 pub this: Box<Expression>,
9936 pub expression: Box<Expression>,
9937 #[serde(default)]
9938 pub safe: Option<Box<Expression>>,
9939}
9940
9941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9943#[cfg_attr(feature = "bindings", derive(TS))]
9944pub struct Operator {
9945 pub this: Box<Expression>,
9946 #[serde(default)]
9947 pub operator: Option<Box<Expression>>,
9948 pub expression: Box<Expression>,
9949 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9951 pub comments: Vec<String>,
9952}
9953
9954#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9956#[cfg_attr(feature = "bindings", derive(TS))]
9957pub struct PivotAny {
9958 #[serde(default)]
9959 pub this: Option<Box<Expression>>,
9960}
9961
9962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9964#[cfg_attr(feature = "bindings", derive(TS))]
9965pub struct Aliases {
9966 pub this: Box<Expression>,
9967 #[serde(default)]
9968 pub expressions: Vec<Expression>,
9969}
9970
9971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9973#[cfg_attr(feature = "bindings", derive(TS))]
9974pub struct AtIndex {
9975 pub this: Box<Expression>,
9976 pub expression: Box<Expression>,
9977}
9978
9979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9981#[cfg_attr(feature = "bindings", derive(TS))]
9982pub struct FromTimeZone {
9983 pub this: Box<Expression>,
9984 #[serde(default)]
9985 pub zone: Option<Box<Expression>>,
9986}
9987
9988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9990#[cfg_attr(feature = "bindings", derive(TS))]
9991pub struct FormatPhrase {
9992 pub this: Box<Expression>,
9993 pub format: String,
9994}
9995
9996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9998#[cfg_attr(feature = "bindings", derive(TS))]
9999pub struct ForIn {
10000 pub this: Box<Expression>,
10001 pub expression: Box<Expression>,
10002}
10003
10004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10006#[cfg_attr(feature = "bindings", derive(TS))]
10007pub struct TimeUnit {
10008 #[serde(default)]
10009 pub unit: Option<String>,
10010}
10011
10012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10014#[cfg_attr(feature = "bindings", derive(TS))]
10015pub struct IntervalOp {
10016 #[serde(default)]
10017 pub unit: Option<String>,
10018 pub expression: Box<Expression>,
10019}
10020
10021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10023#[cfg_attr(feature = "bindings", derive(TS))]
10024pub struct HavingMax {
10025 pub this: Box<Expression>,
10026 pub expression: Box<Expression>,
10027 #[serde(default)]
10028 pub max: Option<Box<Expression>>,
10029}
10030
10031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10033#[cfg_attr(feature = "bindings", derive(TS))]
10034pub struct CosineDistance {
10035 pub this: Box<Expression>,
10036 pub expression: Box<Expression>,
10037}
10038
10039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10041#[cfg_attr(feature = "bindings", derive(TS))]
10042pub struct DotProduct {
10043 pub this: Box<Expression>,
10044 pub expression: Box<Expression>,
10045}
10046
10047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10049#[cfg_attr(feature = "bindings", derive(TS))]
10050pub struct EuclideanDistance {
10051 pub this: Box<Expression>,
10052 pub expression: Box<Expression>,
10053}
10054
10055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10057#[cfg_attr(feature = "bindings", derive(TS))]
10058pub struct ManhattanDistance {
10059 pub this: Box<Expression>,
10060 pub expression: Box<Expression>,
10061}
10062
10063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10065#[cfg_attr(feature = "bindings", derive(TS))]
10066pub struct JarowinklerSimilarity {
10067 pub this: Box<Expression>,
10068 pub expression: Box<Expression>,
10069}
10070
10071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10073#[cfg_attr(feature = "bindings", derive(TS))]
10074pub struct Booland {
10075 pub this: Box<Expression>,
10076 pub expression: Box<Expression>,
10077}
10078
10079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10081#[cfg_attr(feature = "bindings", derive(TS))]
10082pub struct Boolor {
10083 pub this: Box<Expression>,
10084 pub expression: Box<Expression>,
10085}
10086
10087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10089#[cfg_attr(feature = "bindings", derive(TS))]
10090pub struct ParameterizedAgg {
10091 pub this: Box<Expression>,
10092 #[serde(default)]
10093 pub expressions: Vec<Expression>,
10094 #[serde(default)]
10095 pub params: Vec<Expression>,
10096}
10097
10098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10100#[cfg_attr(feature = "bindings", derive(TS))]
10101pub struct ArgMax {
10102 pub this: Box<Expression>,
10103 pub expression: Box<Expression>,
10104 #[serde(default)]
10105 pub count: Option<Box<Expression>>,
10106}
10107
10108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10110#[cfg_attr(feature = "bindings", derive(TS))]
10111pub struct ArgMin {
10112 pub this: Box<Expression>,
10113 pub expression: Box<Expression>,
10114 #[serde(default)]
10115 pub count: Option<Box<Expression>>,
10116}
10117
10118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10120#[cfg_attr(feature = "bindings", derive(TS))]
10121pub struct ApproxTopK {
10122 pub this: Box<Expression>,
10123 #[serde(default)]
10124 pub expression: Option<Box<Expression>>,
10125 #[serde(default)]
10126 pub counters: Option<Box<Expression>>,
10127}
10128
10129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10131#[cfg_attr(feature = "bindings", derive(TS))]
10132pub struct ApproxTopKAccumulate {
10133 pub this: Box<Expression>,
10134 #[serde(default)]
10135 pub expression: Option<Box<Expression>>,
10136}
10137
10138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10140#[cfg_attr(feature = "bindings", derive(TS))]
10141pub struct ApproxTopKCombine {
10142 pub this: Box<Expression>,
10143 #[serde(default)]
10144 pub expression: Option<Box<Expression>>,
10145}
10146
10147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10149#[cfg_attr(feature = "bindings", derive(TS))]
10150pub struct ApproxTopKEstimate {
10151 pub this: Box<Expression>,
10152 #[serde(default)]
10153 pub expression: Option<Box<Expression>>,
10154}
10155
10156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10158#[cfg_attr(feature = "bindings", derive(TS))]
10159pub struct ApproxTopSum {
10160 pub this: Box<Expression>,
10161 pub expression: Box<Expression>,
10162 #[serde(default)]
10163 pub count: Option<Box<Expression>>,
10164}
10165
10166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10168#[cfg_attr(feature = "bindings", derive(TS))]
10169pub struct ApproxQuantiles {
10170 pub this: Box<Expression>,
10171 #[serde(default)]
10172 pub expression: Option<Box<Expression>>,
10173}
10174
10175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10177#[cfg_attr(feature = "bindings", derive(TS))]
10178pub struct Minhash {
10179 pub this: Box<Expression>,
10180 #[serde(default)]
10181 pub expressions: Vec<Expression>,
10182}
10183
10184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10186#[cfg_attr(feature = "bindings", derive(TS))]
10187pub struct FarmFingerprint {
10188 #[serde(default)]
10189 pub expressions: Vec<Expression>,
10190}
10191
10192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10194#[cfg_attr(feature = "bindings", derive(TS))]
10195pub struct Float64 {
10196 pub this: Box<Expression>,
10197 #[serde(default)]
10198 pub expression: Option<Box<Expression>>,
10199}
10200
10201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10203#[cfg_attr(feature = "bindings", derive(TS))]
10204pub struct Transform {
10205 pub this: Box<Expression>,
10206 pub expression: Box<Expression>,
10207}
10208
10209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10211#[cfg_attr(feature = "bindings", derive(TS))]
10212pub struct Translate {
10213 pub this: Box<Expression>,
10214 #[serde(default)]
10215 pub from_: Option<Box<Expression>>,
10216 #[serde(default)]
10217 pub to: Option<Box<Expression>>,
10218}
10219
10220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10222#[cfg_attr(feature = "bindings", derive(TS))]
10223pub struct Grouping {
10224 #[serde(default)]
10225 pub expressions: Vec<Expression>,
10226}
10227
10228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10230#[cfg_attr(feature = "bindings", derive(TS))]
10231pub struct GroupingId {
10232 #[serde(default)]
10233 pub expressions: Vec<Expression>,
10234}
10235
10236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10238#[cfg_attr(feature = "bindings", derive(TS))]
10239pub struct Anonymous {
10240 pub this: Box<Expression>,
10241 #[serde(default)]
10242 pub expressions: Vec<Expression>,
10243}
10244
10245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10247#[cfg_attr(feature = "bindings", derive(TS))]
10248pub struct AnonymousAggFunc {
10249 pub this: Box<Expression>,
10250 #[serde(default)]
10251 pub expressions: Vec<Expression>,
10252}
10253
10254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10256#[cfg_attr(feature = "bindings", derive(TS))]
10257pub struct CombinedAggFunc {
10258 pub this: Box<Expression>,
10259 #[serde(default)]
10260 pub expressions: Vec<Expression>,
10261}
10262
10263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10265#[cfg_attr(feature = "bindings", derive(TS))]
10266pub struct CombinedParameterizedAgg {
10267 pub this: Box<Expression>,
10268 #[serde(default)]
10269 pub expressions: Vec<Expression>,
10270 #[serde(default)]
10271 pub params: Vec<Expression>,
10272}
10273
10274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10276#[cfg_attr(feature = "bindings", derive(TS))]
10277pub struct HashAgg {
10278 pub this: Box<Expression>,
10279 #[serde(default)]
10280 pub expressions: Vec<Expression>,
10281}
10282
10283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10285#[cfg_attr(feature = "bindings", derive(TS))]
10286pub struct Hll {
10287 pub this: Box<Expression>,
10288 #[serde(default)]
10289 pub expressions: Vec<Expression>,
10290}
10291
10292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10294#[cfg_attr(feature = "bindings", derive(TS))]
10295pub struct Apply {
10296 pub this: Box<Expression>,
10297 pub expression: Box<Expression>,
10298}
10299
10300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10302#[cfg_attr(feature = "bindings", derive(TS))]
10303pub struct ToBoolean {
10304 pub this: Box<Expression>,
10305 #[serde(default)]
10306 pub safe: Option<Box<Expression>>,
10307}
10308
10309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10311#[cfg_attr(feature = "bindings", derive(TS))]
10312pub struct List {
10313 #[serde(default)]
10314 pub expressions: Vec<Expression>,
10315}
10316
10317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10322#[cfg_attr(feature = "bindings", derive(TS))]
10323pub struct ToMap {
10324 pub this: Box<Expression>,
10326}
10327
10328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10330#[cfg_attr(feature = "bindings", derive(TS))]
10331pub struct Pad {
10332 pub this: Box<Expression>,
10333 pub expression: Box<Expression>,
10334 #[serde(default)]
10335 pub fill_pattern: Option<Box<Expression>>,
10336 #[serde(default)]
10337 pub is_left: Option<Box<Expression>>,
10338}
10339
10340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10342#[cfg_attr(feature = "bindings", derive(TS))]
10343pub struct ToChar {
10344 pub this: Box<Expression>,
10345 #[serde(default)]
10346 pub format: Option<String>,
10347 #[serde(default)]
10348 pub nlsparam: Option<Box<Expression>>,
10349 #[serde(default)]
10350 pub is_numeric: Option<Box<Expression>>,
10351}
10352
10353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10355#[cfg_attr(feature = "bindings", derive(TS))]
10356pub struct StringFunc {
10357 pub this: Box<Expression>,
10358 #[serde(default)]
10359 pub zone: Option<Box<Expression>>,
10360}
10361
10362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10364#[cfg_attr(feature = "bindings", derive(TS))]
10365pub struct ToNumber {
10366 pub this: Box<Expression>,
10367 #[serde(default)]
10368 pub format: Option<Box<Expression>>,
10369 #[serde(default)]
10370 pub nlsparam: Option<Box<Expression>>,
10371 #[serde(default)]
10372 pub precision: Option<Box<Expression>>,
10373 #[serde(default)]
10374 pub scale: Option<Box<Expression>>,
10375 #[serde(default)]
10376 pub safe: Option<Box<Expression>>,
10377 #[serde(default)]
10378 pub safe_name: Option<Box<Expression>>,
10379}
10380
10381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10383#[cfg_attr(feature = "bindings", derive(TS))]
10384pub struct ToDouble {
10385 pub this: Box<Expression>,
10386 #[serde(default)]
10387 pub format: Option<String>,
10388 #[serde(default)]
10389 pub safe: Option<Box<Expression>>,
10390}
10391
10392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10394#[cfg_attr(feature = "bindings", derive(TS))]
10395pub struct ToDecfloat {
10396 pub this: Box<Expression>,
10397 #[serde(default)]
10398 pub format: Option<String>,
10399}
10400
10401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10403#[cfg_attr(feature = "bindings", derive(TS))]
10404pub struct TryToDecfloat {
10405 pub this: Box<Expression>,
10406 #[serde(default)]
10407 pub format: Option<String>,
10408}
10409
10410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10412#[cfg_attr(feature = "bindings", derive(TS))]
10413pub struct ToFile {
10414 pub this: Box<Expression>,
10415 #[serde(default)]
10416 pub path: Option<Box<Expression>>,
10417 #[serde(default)]
10418 pub safe: Option<Box<Expression>>,
10419}
10420
10421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10423#[cfg_attr(feature = "bindings", derive(TS))]
10424pub struct Columns {
10425 pub this: Box<Expression>,
10426 #[serde(default)]
10427 pub unpack: Option<Box<Expression>>,
10428}
10429
10430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10432#[cfg_attr(feature = "bindings", derive(TS))]
10433pub struct ConvertToCharset {
10434 pub this: Box<Expression>,
10435 #[serde(default)]
10436 pub dest: Option<Box<Expression>>,
10437 #[serde(default)]
10438 pub source: Option<Box<Expression>>,
10439}
10440
10441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10443#[cfg_attr(feature = "bindings", derive(TS))]
10444pub struct ConvertTimezone {
10445 #[serde(default)]
10446 pub source_tz: Option<Box<Expression>>,
10447 #[serde(default)]
10448 pub target_tz: Option<Box<Expression>>,
10449 #[serde(default)]
10450 pub timestamp: Option<Box<Expression>>,
10451 #[serde(default)]
10452 pub options: Vec<Expression>,
10453}
10454
10455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10457#[cfg_attr(feature = "bindings", derive(TS))]
10458pub struct GenerateSeries {
10459 #[serde(default)]
10460 pub start: Option<Box<Expression>>,
10461 #[serde(default)]
10462 pub end: Option<Box<Expression>>,
10463 #[serde(default)]
10464 pub step: Option<Box<Expression>>,
10465 #[serde(default)]
10466 pub is_end_exclusive: Option<Box<Expression>>,
10467}
10468
10469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10471#[cfg_attr(feature = "bindings", derive(TS))]
10472pub struct AIAgg {
10473 pub this: Box<Expression>,
10474 pub expression: Box<Expression>,
10475}
10476
10477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10479#[cfg_attr(feature = "bindings", derive(TS))]
10480pub struct AIClassify {
10481 pub this: Box<Expression>,
10482 #[serde(default)]
10483 pub categories: Option<Box<Expression>>,
10484 #[serde(default)]
10485 pub config: Option<Box<Expression>>,
10486}
10487
10488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10490#[cfg_attr(feature = "bindings", derive(TS))]
10491pub struct ArrayAll {
10492 pub this: Box<Expression>,
10493 pub expression: Box<Expression>,
10494}
10495
10496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10498#[cfg_attr(feature = "bindings", derive(TS))]
10499pub struct ArrayAny {
10500 pub this: Box<Expression>,
10501 pub expression: Box<Expression>,
10502}
10503
10504#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10506#[cfg_attr(feature = "bindings", derive(TS))]
10507pub struct ArrayConstructCompact {
10508 #[serde(default)]
10509 pub expressions: Vec<Expression>,
10510}
10511
10512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10514#[cfg_attr(feature = "bindings", derive(TS))]
10515pub struct StPoint {
10516 pub this: Box<Expression>,
10517 pub expression: Box<Expression>,
10518 #[serde(default)]
10519 pub null: Option<Box<Expression>>,
10520}
10521
10522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10524#[cfg_attr(feature = "bindings", derive(TS))]
10525pub struct StDistance {
10526 pub this: Box<Expression>,
10527 pub expression: Box<Expression>,
10528 #[serde(default)]
10529 pub use_spheroid: Option<Box<Expression>>,
10530}
10531
10532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10534#[cfg_attr(feature = "bindings", derive(TS))]
10535pub struct StringToArray {
10536 pub this: Box<Expression>,
10537 #[serde(default)]
10538 pub expression: Option<Box<Expression>>,
10539 #[serde(default)]
10540 pub null: Option<Box<Expression>>,
10541}
10542
10543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10545#[cfg_attr(feature = "bindings", derive(TS))]
10546pub struct ArraySum {
10547 pub this: Box<Expression>,
10548 #[serde(default)]
10549 pub expression: Option<Box<Expression>>,
10550}
10551
10552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10554#[cfg_attr(feature = "bindings", derive(TS))]
10555pub struct ObjectAgg {
10556 pub this: Box<Expression>,
10557 pub expression: Box<Expression>,
10558}
10559
10560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10562#[cfg_attr(feature = "bindings", derive(TS))]
10563pub struct CastToStrType {
10564 pub this: Box<Expression>,
10565 #[serde(default)]
10566 pub to: Option<Box<Expression>>,
10567}
10568
10569#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10571#[cfg_attr(feature = "bindings", derive(TS))]
10572pub struct CheckJson {
10573 pub this: Box<Expression>,
10574}
10575
10576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10578#[cfg_attr(feature = "bindings", derive(TS))]
10579pub struct CheckXml {
10580 pub this: Box<Expression>,
10581 #[serde(default)]
10582 pub disable_auto_convert: Option<Box<Expression>>,
10583}
10584
10585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10587#[cfg_attr(feature = "bindings", derive(TS))]
10588pub struct TranslateCharacters {
10589 pub this: Box<Expression>,
10590 pub expression: Box<Expression>,
10591 #[serde(default)]
10592 pub with_error: Option<Box<Expression>>,
10593}
10594
10595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10597#[cfg_attr(feature = "bindings", derive(TS))]
10598pub struct CurrentSchemas {
10599 #[serde(default)]
10600 pub this: Option<Box<Expression>>,
10601}
10602
10603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10605#[cfg_attr(feature = "bindings", derive(TS))]
10606pub struct CurrentDatetime {
10607 #[serde(default)]
10608 pub this: Option<Box<Expression>>,
10609}
10610
10611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10613#[cfg_attr(feature = "bindings", derive(TS))]
10614pub struct Localtime {
10615 #[serde(default)]
10616 pub this: Option<Box<Expression>>,
10617}
10618
10619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10621#[cfg_attr(feature = "bindings", derive(TS))]
10622pub struct Localtimestamp {
10623 #[serde(default)]
10624 pub this: Option<Box<Expression>>,
10625}
10626
10627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10629#[cfg_attr(feature = "bindings", derive(TS))]
10630pub struct Systimestamp {
10631 #[serde(default)]
10632 pub this: Option<Box<Expression>>,
10633}
10634
10635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10637#[cfg_attr(feature = "bindings", derive(TS))]
10638pub struct CurrentSchema {
10639 #[serde(default)]
10640 pub this: Option<Box<Expression>>,
10641}
10642
10643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10645#[cfg_attr(feature = "bindings", derive(TS))]
10646pub struct CurrentUser {
10647 #[serde(default)]
10648 pub this: Option<Box<Expression>>,
10649}
10650
10651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10653#[cfg_attr(feature = "bindings", derive(TS))]
10654pub struct SessionUser;
10655
10656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10658#[cfg_attr(feature = "bindings", derive(TS))]
10659pub struct JSONPathRoot;
10660
10661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10663#[cfg_attr(feature = "bindings", derive(TS))]
10664pub struct UtcTime {
10665 #[serde(default)]
10666 pub this: Option<Box<Expression>>,
10667}
10668
10669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10671#[cfg_attr(feature = "bindings", derive(TS))]
10672pub struct UtcTimestamp {
10673 #[serde(default)]
10674 pub this: Option<Box<Expression>>,
10675}
10676
10677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10679#[cfg_attr(feature = "bindings", derive(TS))]
10680pub struct TimestampFunc {
10681 #[serde(default)]
10682 pub this: Option<Box<Expression>>,
10683 #[serde(default)]
10684 pub zone: Option<Box<Expression>>,
10685 #[serde(default)]
10686 pub with_tz: Option<bool>,
10687 #[serde(default)]
10688 pub safe: Option<bool>,
10689}
10690
10691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10693#[cfg_attr(feature = "bindings", derive(TS))]
10694pub struct DateBin {
10695 pub this: Box<Expression>,
10696 pub expression: Box<Expression>,
10697 #[serde(default)]
10698 pub unit: Option<String>,
10699 #[serde(default)]
10700 pub zone: Option<Box<Expression>>,
10701 #[serde(default)]
10702 pub origin: Option<Box<Expression>>,
10703}
10704
10705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10707#[cfg_attr(feature = "bindings", derive(TS))]
10708pub struct Datetime {
10709 pub this: Box<Expression>,
10710 #[serde(default)]
10711 pub expression: Option<Box<Expression>>,
10712}
10713
10714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10716#[cfg_attr(feature = "bindings", derive(TS))]
10717pub struct DatetimeAdd {
10718 pub this: Box<Expression>,
10719 pub expression: Box<Expression>,
10720 #[serde(default)]
10721 pub unit: Option<String>,
10722}
10723
10724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10726#[cfg_attr(feature = "bindings", derive(TS))]
10727pub struct DatetimeSub {
10728 pub this: Box<Expression>,
10729 pub expression: Box<Expression>,
10730 #[serde(default)]
10731 pub unit: Option<String>,
10732}
10733
10734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10736#[cfg_attr(feature = "bindings", derive(TS))]
10737pub struct DatetimeDiff {
10738 pub this: Box<Expression>,
10739 pub expression: Box<Expression>,
10740 #[serde(default)]
10741 pub unit: Option<String>,
10742}
10743
10744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10746#[cfg_attr(feature = "bindings", derive(TS))]
10747pub struct DatetimeTrunc {
10748 pub this: Box<Expression>,
10749 pub unit: String,
10750 #[serde(default)]
10751 pub zone: Option<Box<Expression>>,
10752}
10753
10754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10756#[cfg_attr(feature = "bindings", derive(TS))]
10757pub struct Dayname {
10758 pub this: Box<Expression>,
10759 #[serde(default)]
10760 pub abbreviated: Option<Box<Expression>>,
10761}
10762
10763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10765#[cfg_attr(feature = "bindings", derive(TS))]
10766pub struct MakeInterval {
10767 #[serde(default)]
10768 pub year: Option<Box<Expression>>,
10769 #[serde(default)]
10770 pub month: Option<Box<Expression>>,
10771 #[serde(default)]
10772 pub week: Option<Box<Expression>>,
10773 #[serde(default)]
10774 pub day: Option<Box<Expression>>,
10775 #[serde(default)]
10776 pub hour: Option<Box<Expression>>,
10777 #[serde(default)]
10778 pub minute: Option<Box<Expression>>,
10779 #[serde(default)]
10780 pub second: Option<Box<Expression>>,
10781}
10782
10783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10785#[cfg_attr(feature = "bindings", derive(TS))]
10786pub struct PreviousDay {
10787 pub this: Box<Expression>,
10788 pub expression: Box<Expression>,
10789}
10790
10791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10793#[cfg_attr(feature = "bindings", derive(TS))]
10794pub struct Elt {
10795 pub this: Box<Expression>,
10796 #[serde(default)]
10797 pub expressions: Vec<Expression>,
10798}
10799
10800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10802#[cfg_attr(feature = "bindings", derive(TS))]
10803pub struct TimestampAdd {
10804 pub this: Box<Expression>,
10805 pub expression: Box<Expression>,
10806 #[serde(default)]
10807 pub unit: Option<String>,
10808}
10809
10810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10812#[cfg_attr(feature = "bindings", derive(TS))]
10813pub struct TimestampSub {
10814 pub this: Box<Expression>,
10815 pub expression: Box<Expression>,
10816 #[serde(default)]
10817 pub unit: Option<String>,
10818}
10819
10820#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10822#[cfg_attr(feature = "bindings", derive(TS))]
10823pub struct TimestampDiff {
10824 pub this: Box<Expression>,
10825 pub expression: Box<Expression>,
10826 #[serde(default)]
10827 pub unit: Option<String>,
10828}
10829
10830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10832#[cfg_attr(feature = "bindings", derive(TS))]
10833pub struct TimeSlice {
10834 pub this: Box<Expression>,
10835 pub expression: Box<Expression>,
10836 pub unit: String,
10837 #[serde(default)]
10838 pub kind: Option<String>,
10839}
10840
10841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10843#[cfg_attr(feature = "bindings", derive(TS))]
10844pub struct TimeAdd {
10845 pub this: Box<Expression>,
10846 pub expression: Box<Expression>,
10847 #[serde(default)]
10848 pub unit: Option<String>,
10849}
10850
10851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10853#[cfg_attr(feature = "bindings", derive(TS))]
10854pub struct TimeSub {
10855 pub this: Box<Expression>,
10856 pub expression: Box<Expression>,
10857 #[serde(default)]
10858 pub unit: Option<String>,
10859}
10860
10861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10863#[cfg_attr(feature = "bindings", derive(TS))]
10864pub struct TimeDiff {
10865 pub this: Box<Expression>,
10866 pub expression: Box<Expression>,
10867 #[serde(default)]
10868 pub unit: Option<String>,
10869}
10870
10871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10873#[cfg_attr(feature = "bindings", derive(TS))]
10874pub struct TimeTrunc {
10875 pub this: Box<Expression>,
10876 pub unit: String,
10877 #[serde(default)]
10878 pub zone: Option<Box<Expression>>,
10879}
10880
10881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10883#[cfg_attr(feature = "bindings", derive(TS))]
10884pub struct DateFromParts {
10885 #[serde(default)]
10886 pub year: Option<Box<Expression>>,
10887 #[serde(default)]
10888 pub month: Option<Box<Expression>>,
10889 #[serde(default)]
10890 pub day: Option<Box<Expression>>,
10891 #[serde(default)]
10892 pub allow_overflow: Option<Box<Expression>>,
10893}
10894
10895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10897#[cfg_attr(feature = "bindings", derive(TS))]
10898pub struct TimeFromParts {
10899 #[serde(default)]
10900 pub hour: Option<Box<Expression>>,
10901 #[serde(default)]
10902 pub min: Option<Box<Expression>>,
10903 #[serde(default)]
10904 pub sec: Option<Box<Expression>>,
10905 #[serde(default)]
10906 pub nano: Option<Box<Expression>>,
10907 #[serde(default)]
10908 pub fractions: Option<Box<Expression>>,
10909 #[serde(default)]
10910 pub precision: Option<i64>,
10911}
10912
10913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10915#[cfg_attr(feature = "bindings", derive(TS))]
10916pub struct DecodeCase {
10917 #[serde(default)]
10918 pub expressions: Vec<Expression>,
10919}
10920
10921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10923#[cfg_attr(feature = "bindings", derive(TS))]
10924pub struct Decrypt {
10925 pub this: Box<Expression>,
10926 #[serde(default)]
10927 pub passphrase: Option<Box<Expression>>,
10928 #[serde(default)]
10929 pub aad: Option<Box<Expression>>,
10930 #[serde(default)]
10931 pub encryption_method: Option<Box<Expression>>,
10932 #[serde(default)]
10933 pub safe: Option<Box<Expression>>,
10934}
10935
10936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10938#[cfg_attr(feature = "bindings", derive(TS))]
10939pub struct DecryptRaw {
10940 pub this: Box<Expression>,
10941 #[serde(default)]
10942 pub key: Option<Box<Expression>>,
10943 #[serde(default)]
10944 pub iv: Option<Box<Expression>>,
10945 #[serde(default)]
10946 pub aad: Option<Box<Expression>>,
10947 #[serde(default)]
10948 pub encryption_method: Option<Box<Expression>>,
10949 #[serde(default)]
10950 pub aead: Option<Box<Expression>>,
10951 #[serde(default)]
10952 pub safe: Option<Box<Expression>>,
10953}
10954
10955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10957#[cfg_attr(feature = "bindings", derive(TS))]
10958pub struct Encode {
10959 pub this: Box<Expression>,
10960 #[serde(default)]
10961 pub charset: Option<Box<Expression>>,
10962}
10963
10964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10966#[cfg_attr(feature = "bindings", derive(TS))]
10967pub struct Encrypt {
10968 pub this: Box<Expression>,
10969 #[serde(default)]
10970 pub passphrase: Option<Box<Expression>>,
10971 #[serde(default)]
10972 pub aad: Option<Box<Expression>>,
10973 #[serde(default)]
10974 pub encryption_method: Option<Box<Expression>>,
10975}
10976
10977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10979#[cfg_attr(feature = "bindings", derive(TS))]
10980pub struct EncryptRaw {
10981 pub this: Box<Expression>,
10982 #[serde(default)]
10983 pub key: Option<Box<Expression>>,
10984 #[serde(default)]
10985 pub iv: Option<Box<Expression>>,
10986 #[serde(default)]
10987 pub aad: Option<Box<Expression>>,
10988 #[serde(default)]
10989 pub encryption_method: Option<Box<Expression>>,
10990}
10991
10992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10994#[cfg_attr(feature = "bindings", derive(TS))]
10995pub struct EqualNull {
10996 pub this: Box<Expression>,
10997 pub expression: Box<Expression>,
10998}
10999
11000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11002#[cfg_attr(feature = "bindings", derive(TS))]
11003pub struct ToBinary {
11004 pub this: Box<Expression>,
11005 #[serde(default)]
11006 pub format: Option<String>,
11007 #[serde(default)]
11008 pub safe: Option<Box<Expression>>,
11009}
11010
11011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11013#[cfg_attr(feature = "bindings", derive(TS))]
11014pub struct Base64DecodeBinary {
11015 pub this: Box<Expression>,
11016 #[serde(default)]
11017 pub alphabet: Option<Box<Expression>>,
11018}
11019
11020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11022#[cfg_attr(feature = "bindings", derive(TS))]
11023pub struct Base64DecodeString {
11024 pub this: Box<Expression>,
11025 #[serde(default)]
11026 pub alphabet: Option<Box<Expression>>,
11027}
11028
11029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11031#[cfg_attr(feature = "bindings", derive(TS))]
11032pub struct Base64Encode {
11033 pub this: Box<Expression>,
11034 #[serde(default)]
11035 pub max_line_length: Option<Box<Expression>>,
11036 #[serde(default)]
11037 pub alphabet: Option<Box<Expression>>,
11038}
11039
11040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11042#[cfg_attr(feature = "bindings", derive(TS))]
11043pub struct TryBase64DecodeBinary {
11044 pub this: Box<Expression>,
11045 #[serde(default)]
11046 pub alphabet: Option<Box<Expression>>,
11047}
11048
11049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11051#[cfg_attr(feature = "bindings", derive(TS))]
11052pub struct TryBase64DecodeString {
11053 pub this: Box<Expression>,
11054 #[serde(default)]
11055 pub alphabet: Option<Box<Expression>>,
11056}
11057
11058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11060#[cfg_attr(feature = "bindings", derive(TS))]
11061pub struct GapFill {
11062 pub this: Box<Expression>,
11063 #[serde(default)]
11064 pub ts_column: Option<Box<Expression>>,
11065 #[serde(default)]
11066 pub bucket_width: Option<Box<Expression>>,
11067 #[serde(default)]
11068 pub partitioning_columns: Option<Box<Expression>>,
11069 #[serde(default)]
11070 pub value_columns: Option<Box<Expression>>,
11071 #[serde(default)]
11072 pub origin: Option<Box<Expression>>,
11073 #[serde(default)]
11074 pub ignore_nulls: Option<Box<Expression>>,
11075}
11076
11077#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11079#[cfg_attr(feature = "bindings", derive(TS))]
11080pub struct GenerateDateArray {
11081 #[serde(default)]
11082 pub start: Option<Box<Expression>>,
11083 #[serde(default)]
11084 pub end: Option<Box<Expression>>,
11085 #[serde(default)]
11086 pub step: Option<Box<Expression>>,
11087}
11088
11089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11091#[cfg_attr(feature = "bindings", derive(TS))]
11092pub struct GenerateTimestampArray {
11093 #[serde(default)]
11094 pub start: Option<Box<Expression>>,
11095 #[serde(default)]
11096 pub end: Option<Box<Expression>>,
11097 #[serde(default)]
11098 pub step: Option<Box<Expression>>,
11099}
11100
11101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11103#[cfg_attr(feature = "bindings", derive(TS))]
11104pub struct GetExtract {
11105 pub this: Box<Expression>,
11106 pub expression: Box<Expression>,
11107}
11108
11109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11111#[cfg_attr(feature = "bindings", derive(TS))]
11112pub struct Getbit {
11113 pub this: Box<Expression>,
11114 pub expression: Box<Expression>,
11115 #[serde(default)]
11116 pub zero_is_msb: Option<Box<Expression>>,
11117}
11118
11119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11121#[cfg_attr(feature = "bindings", derive(TS))]
11122pub struct OverflowTruncateBehavior {
11123 #[serde(default)]
11124 pub this: Option<Box<Expression>>,
11125 #[serde(default)]
11126 pub with_count: Option<Box<Expression>>,
11127}
11128
11129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11131#[cfg_attr(feature = "bindings", derive(TS))]
11132pub struct HexEncode {
11133 pub this: Box<Expression>,
11134 #[serde(default)]
11135 pub case: Option<Box<Expression>>,
11136}
11137
11138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11140#[cfg_attr(feature = "bindings", derive(TS))]
11141pub struct Compress {
11142 pub this: Box<Expression>,
11143 #[serde(default)]
11144 pub method: Option<String>,
11145}
11146
11147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11149#[cfg_attr(feature = "bindings", derive(TS))]
11150pub struct DecompressBinary {
11151 pub this: Box<Expression>,
11152 pub method: String,
11153}
11154
11155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11157#[cfg_attr(feature = "bindings", derive(TS))]
11158pub struct DecompressString {
11159 pub this: Box<Expression>,
11160 pub method: String,
11161}
11162
11163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11165#[cfg_attr(feature = "bindings", derive(TS))]
11166pub struct Xor {
11167 #[serde(default)]
11168 pub this: Option<Box<Expression>>,
11169 #[serde(default)]
11170 pub expression: Option<Box<Expression>>,
11171 #[serde(default)]
11172 pub expressions: Vec<Expression>,
11173}
11174
11175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11177#[cfg_attr(feature = "bindings", derive(TS))]
11178pub struct Nullif {
11179 pub this: Box<Expression>,
11180 pub expression: Box<Expression>,
11181}
11182
11183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11185#[cfg_attr(feature = "bindings", derive(TS))]
11186pub struct JSON {
11187 #[serde(default)]
11188 pub this: Option<Box<Expression>>,
11189 #[serde(default)]
11190 pub with_: Option<Box<Expression>>,
11191 #[serde(default)]
11192 pub unique: bool,
11193}
11194
11195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11197#[cfg_attr(feature = "bindings", derive(TS))]
11198pub struct JSONPath {
11199 #[serde(default)]
11200 pub expressions: Vec<Expression>,
11201 #[serde(default)]
11202 pub escape: Option<Box<Expression>>,
11203}
11204
11205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11207#[cfg_attr(feature = "bindings", derive(TS))]
11208pub struct JSONPathFilter {
11209 pub this: Box<Expression>,
11210}
11211
11212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11214#[cfg_attr(feature = "bindings", derive(TS))]
11215pub struct JSONPathKey {
11216 pub this: Box<Expression>,
11217}
11218
11219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11221#[cfg_attr(feature = "bindings", derive(TS))]
11222pub struct JSONPathRecursive {
11223 #[serde(default)]
11224 pub this: Option<Box<Expression>>,
11225}
11226
11227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11229#[cfg_attr(feature = "bindings", derive(TS))]
11230pub struct JSONPathScript {
11231 pub this: Box<Expression>,
11232}
11233
11234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11236#[cfg_attr(feature = "bindings", derive(TS))]
11237pub struct JSONPathSlice {
11238 #[serde(default)]
11239 pub start: Option<Box<Expression>>,
11240 #[serde(default)]
11241 pub end: Option<Box<Expression>>,
11242 #[serde(default)]
11243 pub step: Option<Box<Expression>>,
11244}
11245
11246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11248#[cfg_attr(feature = "bindings", derive(TS))]
11249pub struct JSONPathSelector {
11250 pub this: Box<Expression>,
11251}
11252
11253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11255#[cfg_attr(feature = "bindings", derive(TS))]
11256pub struct JSONPathSubscript {
11257 pub this: Box<Expression>,
11258}
11259
11260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11262#[cfg_attr(feature = "bindings", derive(TS))]
11263pub struct JSONPathUnion {
11264 #[serde(default)]
11265 pub expressions: Vec<Expression>,
11266}
11267
11268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11270#[cfg_attr(feature = "bindings", derive(TS))]
11271pub struct Format {
11272 pub this: Box<Expression>,
11273 #[serde(default)]
11274 pub expressions: Vec<Expression>,
11275}
11276
11277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11279#[cfg_attr(feature = "bindings", derive(TS))]
11280pub struct JSONKeys {
11281 pub this: Box<Expression>,
11282 #[serde(default)]
11283 pub expression: Option<Box<Expression>>,
11284 #[serde(default)]
11285 pub expressions: Vec<Expression>,
11286}
11287
11288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11290#[cfg_attr(feature = "bindings", derive(TS))]
11291pub struct JSONKeyValue {
11292 pub this: Box<Expression>,
11293 pub expression: Box<Expression>,
11294}
11295
11296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11298#[cfg_attr(feature = "bindings", derive(TS))]
11299pub struct JSONKeysAtDepth {
11300 pub this: Box<Expression>,
11301 #[serde(default)]
11302 pub expression: Option<Box<Expression>>,
11303 #[serde(default)]
11304 pub mode: Option<Box<Expression>>,
11305}
11306
11307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11309#[cfg_attr(feature = "bindings", derive(TS))]
11310pub struct JSONObject {
11311 #[serde(default)]
11312 pub expressions: Vec<Expression>,
11313 #[serde(default)]
11314 pub null_handling: Option<Box<Expression>>,
11315 #[serde(default)]
11316 pub unique_keys: Option<Box<Expression>>,
11317 #[serde(default)]
11318 pub return_type: Option<Box<Expression>>,
11319 #[serde(default)]
11320 pub encoding: Option<Box<Expression>>,
11321}
11322
11323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11325#[cfg_attr(feature = "bindings", derive(TS))]
11326pub struct JSONObjectAgg {
11327 #[serde(default)]
11328 pub expressions: Vec<Expression>,
11329 #[serde(default)]
11330 pub null_handling: Option<Box<Expression>>,
11331 #[serde(default)]
11332 pub unique_keys: Option<Box<Expression>>,
11333 #[serde(default)]
11334 pub return_type: Option<Box<Expression>>,
11335 #[serde(default)]
11336 pub encoding: Option<Box<Expression>>,
11337}
11338
11339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11341#[cfg_attr(feature = "bindings", derive(TS))]
11342pub struct JSONBObjectAgg {
11343 pub this: Box<Expression>,
11344 pub expression: Box<Expression>,
11345}
11346
11347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11349#[cfg_attr(feature = "bindings", derive(TS))]
11350pub struct JSONArray {
11351 #[serde(default)]
11352 pub expressions: Vec<Expression>,
11353 #[serde(default)]
11354 pub null_handling: Option<Box<Expression>>,
11355 #[serde(default)]
11356 pub return_type: Option<Box<Expression>>,
11357 #[serde(default)]
11358 pub strict: Option<Box<Expression>>,
11359}
11360
11361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11363#[cfg_attr(feature = "bindings", derive(TS))]
11364pub struct JSONArrayAgg {
11365 pub this: Box<Expression>,
11366 #[serde(default)]
11367 pub order: Option<Box<Expression>>,
11368 #[serde(default)]
11369 pub null_handling: Option<Box<Expression>>,
11370 #[serde(default)]
11371 pub return_type: Option<Box<Expression>>,
11372 #[serde(default)]
11373 pub strict: Option<Box<Expression>>,
11374}
11375
11376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11378#[cfg_attr(feature = "bindings", derive(TS))]
11379pub struct JSONExists {
11380 pub this: Box<Expression>,
11381 #[serde(default)]
11382 pub path: Option<Box<Expression>>,
11383 #[serde(default)]
11384 pub passing: Option<Box<Expression>>,
11385 #[serde(default)]
11386 pub on_condition: Option<Box<Expression>>,
11387 #[serde(default)]
11388 pub from_dcolonqmark: Option<Box<Expression>>,
11389}
11390
11391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11393#[cfg_attr(feature = "bindings", derive(TS))]
11394pub struct JSONColumnDef {
11395 #[serde(default)]
11396 pub this: Option<Box<Expression>>,
11397 #[serde(default)]
11398 pub kind: Option<String>,
11399 #[serde(default)]
11400 pub path: Option<Box<Expression>>,
11401 #[serde(default)]
11402 pub nested_schema: Option<Box<Expression>>,
11403 #[serde(default)]
11404 pub ordinality: Option<Box<Expression>>,
11405}
11406
11407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11409#[cfg_attr(feature = "bindings", derive(TS))]
11410pub struct JSONSchema {
11411 #[serde(default)]
11412 pub expressions: Vec<Expression>,
11413}
11414
11415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11417#[cfg_attr(feature = "bindings", derive(TS))]
11418pub struct JSONSet {
11419 pub this: Box<Expression>,
11420 #[serde(default)]
11421 pub expressions: Vec<Expression>,
11422}
11423
11424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11426#[cfg_attr(feature = "bindings", derive(TS))]
11427pub struct JSONStripNulls {
11428 pub this: Box<Expression>,
11429 #[serde(default)]
11430 pub expression: Option<Box<Expression>>,
11431 #[serde(default)]
11432 pub include_arrays: Option<Box<Expression>>,
11433 #[serde(default)]
11434 pub remove_empty: Option<Box<Expression>>,
11435}
11436
11437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11439#[cfg_attr(feature = "bindings", derive(TS))]
11440pub struct JSONValue {
11441 pub this: Box<Expression>,
11442 #[serde(default)]
11443 pub path: Option<Box<Expression>>,
11444 #[serde(default)]
11445 pub returning: Option<Box<Expression>>,
11446 #[serde(default)]
11447 pub on_condition: Option<Box<Expression>>,
11448}
11449
11450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11452#[cfg_attr(feature = "bindings", derive(TS))]
11453pub struct JSONValueArray {
11454 pub this: Box<Expression>,
11455 #[serde(default)]
11456 pub expression: Option<Box<Expression>>,
11457}
11458
11459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11461#[cfg_attr(feature = "bindings", derive(TS))]
11462pub struct JSONRemove {
11463 pub this: Box<Expression>,
11464 #[serde(default)]
11465 pub expressions: Vec<Expression>,
11466}
11467
11468#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11470#[cfg_attr(feature = "bindings", derive(TS))]
11471pub struct JSONTable {
11472 pub this: Box<Expression>,
11473 #[serde(default)]
11474 pub schema: Option<Box<Expression>>,
11475 #[serde(default)]
11476 pub path: Option<Box<Expression>>,
11477 #[serde(default)]
11478 pub error_handling: Option<Box<Expression>>,
11479 #[serde(default)]
11480 pub empty_handling: Option<Box<Expression>>,
11481}
11482
11483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11485#[cfg_attr(feature = "bindings", derive(TS))]
11486pub struct JSONType {
11487 pub this: Box<Expression>,
11488 #[serde(default)]
11489 pub expression: Option<Box<Expression>>,
11490}
11491
11492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11494#[cfg_attr(feature = "bindings", derive(TS))]
11495pub struct ObjectInsert {
11496 pub this: Box<Expression>,
11497 #[serde(default)]
11498 pub key: Option<Box<Expression>>,
11499 #[serde(default)]
11500 pub value: Option<Box<Expression>>,
11501 #[serde(default)]
11502 pub update_flag: Option<Box<Expression>>,
11503}
11504
11505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11507#[cfg_attr(feature = "bindings", derive(TS))]
11508pub struct OpenJSONColumnDef {
11509 pub this: Box<Expression>,
11510 pub kind: String,
11511 #[serde(default)]
11512 pub path: Option<Box<Expression>>,
11513 #[serde(default)]
11514 pub as_json: Option<Box<Expression>>,
11515 #[serde(default, skip_serializing_if = "Option::is_none")]
11517 pub data_type: Option<DataType>,
11518}
11519
11520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11522#[cfg_attr(feature = "bindings", derive(TS))]
11523pub struct OpenJSON {
11524 pub this: Box<Expression>,
11525 #[serde(default)]
11526 pub path: Option<Box<Expression>>,
11527 #[serde(default)]
11528 pub expressions: Vec<Expression>,
11529}
11530
11531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11533#[cfg_attr(feature = "bindings", derive(TS))]
11534pub struct JSONBExists {
11535 pub this: Box<Expression>,
11536 #[serde(default)]
11537 pub path: Option<Box<Expression>>,
11538}
11539
11540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11542#[cfg_attr(feature = "bindings", derive(TS))]
11543pub struct JSONCast {
11544 pub this: Box<Expression>,
11545 pub to: DataType,
11546}
11547
11548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11550#[cfg_attr(feature = "bindings", derive(TS))]
11551pub struct JSONExtract {
11552 pub this: Box<Expression>,
11553 pub expression: Box<Expression>,
11554 #[serde(default)]
11555 pub only_json_types: Option<Box<Expression>>,
11556 #[serde(default)]
11557 pub expressions: Vec<Expression>,
11558 #[serde(default)]
11559 pub variant_extract: Option<Box<Expression>>,
11560 #[serde(default)]
11561 pub json_query: Option<Box<Expression>>,
11562 #[serde(default)]
11563 pub option: Option<Box<Expression>>,
11564 #[serde(default)]
11565 pub quote: Option<Box<Expression>>,
11566 #[serde(default)]
11567 pub on_condition: Option<Box<Expression>>,
11568 #[serde(default)]
11569 pub requires_json: Option<Box<Expression>>,
11570}
11571
11572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11574#[cfg_attr(feature = "bindings", derive(TS))]
11575pub struct JSONExtractQuote {
11576 #[serde(default)]
11577 pub option: Option<Box<Expression>>,
11578 #[serde(default)]
11579 pub scalar: Option<Box<Expression>>,
11580}
11581
11582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11584#[cfg_attr(feature = "bindings", derive(TS))]
11585pub struct JSONExtractArray {
11586 pub this: Box<Expression>,
11587 #[serde(default)]
11588 pub expression: Option<Box<Expression>>,
11589}
11590
11591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11593#[cfg_attr(feature = "bindings", derive(TS))]
11594pub struct JSONExtractScalar {
11595 pub this: Box<Expression>,
11596 pub expression: Box<Expression>,
11597 #[serde(default)]
11598 pub only_json_types: Option<Box<Expression>>,
11599 #[serde(default)]
11600 pub expressions: Vec<Expression>,
11601 #[serde(default)]
11602 pub json_type: Option<Box<Expression>>,
11603 #[serde(default)]
11604 pub scalar_only: Option<Box<Expression>>,
11605}
11606
11607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11609#[cfg_attr(feature = "bindings", derive(TS))]
11610pub struct JSONBExtractScalar {
11611 pub this: Box<Expression>,
11612 pub expression: Box<Expression>,
11613 #[serde(default)]
11614 pub json_type: Option<Box<Expression>>,
11615}
11616
11617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11619#[cfg_attr(feature = "bindings", derive(TS))]
11620pub struct JSONFormat {
11621 #[serde(default)]
11622 pub this: Option<Box<Expression>>,
11623 #[serde(default)]
11624 pub options: Vec<Expression>,
11625 #[serde(default)]
11626 pub is_json: Option<Box<Expression>>,
11627 #[serde(default)]
11628 pub to_json: Option<Box<Expression>>,
11629}
11630
11631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11633#[cfg_attr(feature = "bindings", derive(TS))]
11634pub struct JSONArrayAppend {
11635 pub this: Box<Expression>,
11636 #[serde(default)]
11637 pub expressions: Vec<Expression>,
11638}
11639
11640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11642#[cfg_attr(feature = "bindings", derive(TS))]
11643pub struct JSONArrayContains {
11644 pub this: Box<Expression>,
11645 pub expression: Box<Expression>,
11646 #[serde(default)]
11647 pub json_type: Option<Box<Expression>>,
11648}
11649
11650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11652#[cfg_attr(feature = "bindings", derive(TS))]
11653pub struct JSONArrayInsert {
11654 pub this: Box<Expression>,
11655 #[serde(default)]
11656 pub expressions: Vec<Expression>,
11657}
11658
11659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11661#[cfg_attr(feature = "bindings", derive(TS))]
11662pub struct ParseJSON {
11663 pub this: Box<Expression>,
11664 #[serde(default)]
11665 pub expression: Option<Box<Expression>>,
11666 #[serde(default)]
11667 pub safe: Option<Box<Expression>>,
11668}
11669
11670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11672#[cfg_attr(feature = "bindings", derive(TS))]
11673pub struct ParseUrl {
11674 pub this: Box<Expression>,
11675 #[serde(default)]
11676 pub part_to_extract: Option<Box<Expression>>,
11677 #[serde(default)]
11678 pub key: Option<Box<Expression>>,
11679 #[serde(default)]
11680 pub permissive: Option<Box<Expression>>,
11681}
11682
11683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11685#[cfg_attr(feature = "bindings", derive(TS))]
11686pub struct ParseIp {
11687 pub this: Box<Expression>,
11688 #[serde(default)]
11689 pub type_: Option<Box<Expression>>,
11690 #[serde(default)]
11691 pub permissive: Option<Box<Expression>>,
11692}
11693
11694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11696#[cfg_attr(feature = "bindings", derive(TS))]
11697pub struct ParseTime {
11698 pub this: Box<Expression>,
11699 pub format: String,
11700}
11701
11702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11704#[cfg_attr(feature = "bindings", derive(TS))]
11705pub struct ParseDatetime {
11706 pub this: Box<Expression>,
11707 #[serde(default)]
11708 pub format: Option<String>,
11709 #[serde(default)]
11710 pub zone: Option<Box<Expression>>,
11711}
11712
11713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11715#[cfg_attr(feature = "bindings", derive(TS))]
11716pub struct Map {
11717 #[serde(default)]
11718 pub keys: Vec<Expression>,
11719 #[serde(default)]
11720 pub values: Vec<Expression>,
11721}
11722
11723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11725#[cfg_attr(feature = "bindings", derive(TS))]
11726pub struct MapCat {
11727 pub this: Box<Expression>,
11728 pub expression: Box<Expression>,
11729}
11730
11731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11733#[cfg_attr(feature = "bindings", derive(TS))]
11734pub struct MapDelete {
11735 pub this: Box<Expression>,
11736 #[serde(default)]
11737 pub expressions: Vec<Expression>,
11738}
11739
11740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11742#[cfg_attr(feature = "bindings", derive(TS))]
11743pub struct MapInsert {
11744 pub this: Box<Expression>,
11745 #[serde(default)]
11746 pub key: Option<Box<Expression>>,
11747 #[serde(default)]
11748 pub value: Option<Box<Expression>>,
11749 #[serde(default)]
11750 pub update_flag: Option<Box<Expression>>,
11751}
11752
11753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11755#[cfg_attr(feature = "bindings", derive(TS))]
11756pub struct MapPick {
11757 pub this: Box<Expression>,
11758 #[serde(default)]
11759 pub expressions: Vec<Expression>,
11760}
11761
11762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11764#[cfg_attr(feature = "bindings", derive(TS))]
11765pub struct ScopeResolution {
11766 #[serde(default)]
11767 pub this: Option<Box<Expression>>,
11768 pub expression: Box<Expression>,
11769}
11770
11771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11773#[cfg_attr(feature = "bindings", derive(TS))]
11774pub struct Slice {
11775 #[serde(default)]
11776 pub this: Option<Box<Expression>>,
11777 #[serde(default)]
11778 pub expression: Option<Box<Expression>>,
11779 #[serde(default)]
11780 pub step: Option<Box<Expression>>,
11781}
11782
11783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11785#[cfg_attr(feature = "bindings", derive(TS))]
11786pub struct VarMap {
11787 #[serde(default)]
11788 pub keys: Vec<Expression>,
11789 #[serde(default)]
11790 pub values: Vec<Expression>,
11791}
11792
11793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11795#[cfg_attr(feature = "bindings", derive(TS))]
11796pub struct MatchAgainst {
11797 pub this: Box<Expression>,
11798 #[serde(default)]
11799 pub expressions: Vec<Expression>,
11800 #[serde(default)]
11801 pub modifier: Option<Box<Expression>>,
11802}
11803
11804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11806#[cfg_attr(feature = "bindings", derive(TS))]
11807pub struct MD5Digest {
11808 pub this: Box<Expression>,
11809 #[serde(default)]
11810 pub expressions: Vec<Expression>,
11811}
11812
11813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11815#[cfg_attr(feature = "bindings", derive(TS))]
11816pub struct Monthname {
11817 pub this: Box<Expression>,
11818 #[serde(default)]
11819 pub abbreviated: Option<Box<Expression>>,
11820}
11821
11822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11824#[cfg_attr(feature = "bindings", derive(TS))]
11825pub struct Ntile {
11826 #[serde(default)]
11827 pub this: Option<Box<Expression>>,
11828}
11829
11830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11832#[cfg_attr(feature = "bindings", derive(TS))]
11833pub struct Normalize {
11834 pub this: Box<Expression>,
11835 #[serde(default)]
11836 pub form: Option<Box<Expression>>,
11837 #[serde(default)]
11838 pub is_casefold: Option<Box<Expression>>,
11839}
11840
11841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11843#[cfg_attr(feature = "bindings", derive(TS))]
11844pub struct Normal {
11845 pub this: Box<Expression>,
11846 #[serde(default)]
11847 pub stddev: Option<Box<Expression>>,
11848 #[serde(default)]
11849 pub gen: Option<Box<Expression>>,
11850}
11851
11852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11854#[cfg_attr(feature = "bindings", derive(TS))]
11855pub struct Predict {
11856 pub this: Box<Expression>,
11857 pub expression: Box<Expression>,
11858 #[serde(default)]
11859 pub params_struct: Option<Box<Expression>>,
11860}
11861
11862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11864#[cfg_attr(feature = "bindings", derive(TS))]
11865pub struct MLTranslate {
11866 pub this: Box<Expression>,
11867 pub expression: Box<Expression>,
11868 #[serde(default)]
11869 pub params_struct: Option<Box<Expression>>,
11870}
11871
11872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11874#[cfg_attr(feature = "bindings", derive(TS))]
11875pub struct FeaturesAtTime {
11876 pub this: Box<Expression>,
11877 #[serde(default)]
11878 pub time: Option<Box<Expression>>,
11879 #[serde(default)]
11880 pub num_rows: Option<Box<Expression>>,
11881 #[serde(default)]
11882 pub ignore_feature_nulls: Option<Box<Expression>>,
11883}
11884
11885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11887#[cfg_attr(feature = "bindings", derive(TS))]
11888pub struct GenerateEmbedding {
11889 pub this: Box<Expression>,
11890 pub expression: Box<Expression>,
11891 #[serde(default)]
11892 pub params_struct: Option<Box<Expression>>,
11893 #[serde(default)]
11894 pub is_text: Option<Box<Expression>>,
11895}
11896
11897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11899#[cfg_attr(feature = "bindings", derive(TS))]
11900pub struct MLForecast {
11901 pub this: Box<Expression>,
11902 #[serde(default)]
11903 pub expression: Option<Box<Expression>>,
11904 #[serde(default)]
11905 pub params_struct: Option<Box<Expression>>,
11906}
11907
11908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11910#[cfg_attr(feature = "bindings", derive(TS))]
11911pub struct ModelAttribute {
11912 pub this: Box<Expression>,
11913 pub expression: Box<Expression>,
11914}
11915
11916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11918#[cfg_attr(feature = "bindings", derive(TS))]
11919pub struct VectorSearch {
11920 pub this: Box<Expression>,
11921 #[serde(default)]
11922 pub column_to_search: Option<Box<Expression>>,
11923 #[serde(default)]
11924 pub query_table: Option<Box<Expression>>,
11925 #[serde(default)]
11926 pub query_column_to_search: Option<Box<Expression>>,
11927 #[serde(default)]
11928 pub top_k: Option<Box<Expression>>,
11929 #[serde(default)]
11930 pub distance_type: Option<Box<Expression>>,
11931 #[serde(default)]
11932 pub options: Vec<Expression>,
11933}
11934
11935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11937#[cfg_attr(feature = "bindings", derive(TS))]
11938pub struct Quantile {
11939 pub this: Box<Expression>,
11940 #[serde(default)]
11941 pub quantile: Option<Box<Expression>>,
11942}
11943
11944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11946#[cfg_attr(feature = "bindings", derive(TS))]
11947pub struct ApproxQuantile {
11948 pub this: Box<Expression>,
11949 #[serde(default)]
11950 pub quantile: Option<Box<Expression>>,
11951 #[serde(default)]
11952 pub accuracy: Option<Box<Expression>>,
11953 #[serde(default)]
11954 pub weight: Option<Box<Expression>>,
11955 #[serde(default)]
11956 pub error_tolerance: Option<Box<Expression>>,
11957}
11958
11959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11961#[cfg_attr(feature = "bindings", derive(TS))]
11962pub struct ApproxPercentileEstimate {
11963 pub this: Box<Expression>,
11964 #[serde(default)]
11965 pub percentile: Option<Box<Expression>>,
11966}
11967
11968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11970#[cfg_attr(feature = "bindings", derive(TS))]
11971pub struct Randn {
11972 #[serde(default)]
11973 pub this: Option<Box<Expression>>,
11974}
11975
11976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11978#[cfg_attr(feature = "bindings", derive(TS))]
11979pub struct Randstr {
11980 pub this: Box<Expression>,
11981 #[serde(default)]
11982 pub generator: Option<Box<Expression>>,
11983}
11984
11985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11987#[cfg_attr(feature = "bindings", derive(TS))]
11988pub struct RangeN {
11989 pub this: Box<Expression>,
11990 #[serde(default)]
11991 pub expressions: Vec<Expression>,
11992 #[serde(default)]
11993 pub each: Option<Box<Expression>>,
11994}
11995
11996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11998#[cfg_attr(feature = "bindings", derive(TS))]
11999pub struct RangeBucket {
12000 pub this: Box<Expression>,
12001 pub expression: Box<Expression>,
12002}
12003
12004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12006#[cfg_attr(feature = "bindings", derive(TS))]
12007pub struct ReadCSV {
12008 pub this: Box<Expression>,
12009 #[serde(default)]
12010 pub expressions: Vec<Expression>,
12011}
12012
12013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12015#[cfg_attr(feature = "bindings", derive(TS))]
12016pub struct ReadParquet {
12017 #[serde(default)]
12018 pub expressions: Vec<Expression>,
12019}
12020
12021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12023#[cfg_attr(feature = "bindings", derive(TS))]
12024pub struct Reduce {
12025 pub this: Box<Expression>,
12026 #[serde(default)]
12027 pub initial: Option<Box<Expression>>,
12028 #[serde(default)]
12029 pub merge: Option<Box<Expression>>,
12030 #[serde(default)]
12031 pub finish: Option<Box<Expression>>,
12032}
12033
12034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12036#[cfg_attr(feature = "bindings", derive(TS))]
12037pub struct RegexpExtractAll {
12038 pub this: Box<Expression>,
12039 pub expression: Box<Expression>,
12040 #[serde(default)]
12041 pub group: Option<Box<Expression>>,
12042 #[serde(default)]
12043 pub parameters: Option<Box<Expression>>,
12044 #[serde(default)]
12045 pub position: Option<Box<Expression>>,
12046 #[serde(default)]
12047 pub occurrence: Option<Box<Expression>>,
12048}
12049
12050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12052#[cfg_attr(feature = "bindings", derive(TS))]
12053pub struct RegexpILike {
12054 pub this: Box<Expression>,
12055 pub expression: Box<Expression>,
12056 #[serde(default)]
12057 pub flag: Option<Box<Expression>>,
12058}
12059
12060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12062#[cfg_attr(feature = "bindings", derive(TS))]
12063pub struct RegexpFullMatch {
12064 pub this: Box<Expression>,
12065 pub expression: Box<Expression>,
12066 #[serde(default)]
12067 pub options: Vec<Expression>,
12068}
12069
12070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12072#[cfg_attr(feature = "bindings", derive(TS))]
12073pub struct RegexpInstr {
12074 pub this: Box<Expression>,
12075 pub expression: Box<Expression>,
12076 #[serde(default)]
12077 pub position: Option<Box<Expression>>,
12078 #[serde(default)]
12079 pub occurrence: Option<Box<Expression>>,
12080 #[serde(default)]
12081 pub option: Option<Box<Expression>>,
12082 #[serde(default)]
12083 pub parameters: Option<Box<Expression>>,
12084 #[serde(default)]
12085 pub group: Option<Box<Expression>>,
12086}
12087
12088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12090#[cfg_attr(feature = "bindings", derive(TS))]
12091pub struct RegexpSplit {
12092 pub this: Box<Expression>,
12093 pub expression: Box<Expression>,
12094 #[serde(default)]
12095 pub limit: Option<Box<Expression>>,
12096}
12097
12098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12100#[cfg_attr(feature = "bindings", derive(TS))]
12101pub struct RegexpCount {
12102 pub this: Box<Expression>,
12103 pub expression: Box<Expression>,
12104 #[serde(default)]
12105 pub position: Option<Box<Expression>>,
12106 #[serde(default)]
12107 pub parameters: Option<Box<Expression>>,
12108}
12109
12110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12112#[cfg_attr(feature = "bindings", derive(TS))]
12113pub struct RegrValx {
12114 pub this: Box<Expression>,
12115 pub expression: Box<Expression>,
12116}
12117
12118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12120#[cfg_attr(feature = "bindings", derive(TS))]
12121pub struct RegrValy {
12122 pub this: Box<Expression>,
12123 pub expression: Box<Expression>,
12124}
12125
12126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12128#[cfg_attr(feature = "bindings", derive(TS))]
12129pub struct RegrAvgy {
12130 pub this: Box<Expression>,
12131 pub expression: Box<Expression>,
12132}
12133
12134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12136#[cfg_attr(feature = "bindings", derive(TS))]
12137pub struct RegrAvgx {
12138 pub this: Box<Expression>,
12139 pub expression: Box<Expression>,
12140}
12141
12142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12144#[cfg_attr(feature = "bindings", derive(TS))]
12145pub struct RegrCount {
12146 pub this: Box<Expression>,
12147 pub expression: Box<Expression>,
12148}
12149
12150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12152#[cfg_attr(feature = "bindings", derive(TS))]
12153pub struct RegrIntercept {
12154 pub this: Box<Expression>,
12155 pub expression: Box<Expression>,
12156}
12157
12158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12160#[cfg_attr(feature = "bindings", derive(TS))]
12161pub struct RegrR2 {
12162 pub this: Box<Expression>,
12163 pub expression: Box<Expression>,
12164}
12165
12166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12168#[cfg_attr(feature = "bindings", derive(TS))]
12169pub struct RegrSxx {
12170 pub this: Box<Expression>,
12171 pub expression: Box<Expression>,
12172}
12173
12174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12176#[cfg_attr(feature = "bindings", derive(TS))]
12177pub struct RegrSxy {
12178 pub this: Box<Expression>,
12179 pub expression: Box<Expression>,
12180}
12181
12182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12184#[cfg_attr(feature = "bindings", derive(TS))]
12185pub struct RegrSyy {
12186 pub this: Box<Expression>,
12187 pub expression: Box<Expression>,
12188}
12189
12190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12192#[cfg_attr(feature = "bindings", derive(TS))]
12193pub struct RegrSlope {
12194 pub this: Box<Expression>,
12195 pub expression: Box<Expression>,
12196}
12197
12198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12200#[cfg_attr(feature = "bindings", derive(TS))]
12201pub struct SafeAdd {
12202 pub this: Box<Expression>,
12203 pub expression: Box<Expression>,
12204}
12205
12206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12208#[cfg_attr(feature = "bindings", derive(TS))]
12209pub struct SafeDivide {
12210 pub this: Box<Expression>,
12211 pub expression: Box<Expression>,
12212}
12213
12214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12216#[cfg_attr(feature = "bindings", derive(TS))]
12217pub struct SafeMultiply {
12218 pub this: Box<Expression>,
12219 pub expression: Box<Expression>,
12220}
12221
12222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12224#[cfg_attr(feature = "bindings", derive(TS))]
12225pub struct SafeSubtract {
12226 pub this: Box<Expression>,
12227 pub expression: Box<Expression>,
12228}
12229
12230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12232#[cfg_attr(feature = "bindings", derive(TS))]
12233pub struct SHA2 {
12234 pub this: Box<Expression>,
12235 #[serde(default)]
12236 pub length: Option<i64>,
12237}
12238
12239#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12241#[cfg_attr(feature = "bindings", derive(TS))]
12242pub struct SHA2Digest {
12243 pub this: Box<Expression>,
12244 #[serde(default)]
12245 pub length: Option<i64>,
12246}
12247
12248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12250#[cfg_attr(feature = "bindings", derive(TS))]
12251pub struct SortArray {
12252 pub this: Box<Expression>,
12253 #[serde(default)]
12254 pub asc: Option<Box<Expression>>,
12255 #[serde(default)]
12256 pub nulls_first: Option<Box<Expression>>,
12257}
12258
12259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12261#[cfg_attr(feature = "bindings", derive(TS))]
12262pub struct SplitPart {
12263 pub this: Box<Expression>,
12264 #[serde(default)]
12265 pub delimiter: Option<Box<Expression>>,
12266 #[serde(default)]
12267 pub part_index: Option<Box<Expression>>,
12268}
12269
12270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12272#[cfg_attr(feature = "bindings", derive(TS))]
12273pub struct SubstringIndex {
12274 pub this: Box<Expression>,
12275 #[serde(default)]
12276 pub delimiter: Option<Box<Expression>>,
12277 #[serde(default)]
12278 pub count: Option<Box<Expression>>,
12279}
12280
12281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12283#[cfg_attr(feature = "bindings", derive(TS))]
12284pub struct StandardHash {
12285 pub this: Box<Expression>,
12286 #[serde(default)]
12287 pub expression: Option<Box<Expression>>,
12288}
12289
12290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12292#[cfg_attr(feature = "bindings", derive(TS))]
12293pub struct StrPosition {
12294 pub this: Box<Expression>,
12295 #[serde(default)]
12296 pub substr: Option<Box<Expression>>,
12297 #[serde(default)]
12298 pub position: Option<Box<Expression>>,
12299 #[serde(default)]
12300 pub occurrence: Option<Box<Expression>>,
12301}
12302
12303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12305#[cfg_attr(feature = "bindings", derive(TS))]
12306pub struct Search {
12307 pub this: Box<Expression>,
12308 pub expression: Box<Expression>,
12309 #[serde(default)]
12310 pub json_scope: Option<Box<Expression>>,
12311 #[serde(default)]
12312 pub analyzer: Option<Box<Expression>>,
12313 #[serde(default)]
12314 pub analyzer_options: Option<Box<Expression>>,
12315 #[serde(default)]
12316 pub search_mode: Option<Box<Expression>>,
12317}
12318
12319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12321#[cfg_attr(feature = "bindings", derive(TS))]
12322pub struct SearchIp {
12323 pub this: Box<Expression>,
12324 pub expression: Box<Expression>,
12325}
12326
12327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12329#[cfg_attr(feature = "bindings", derive(TS))]
12330pub struct StrToDate {
12331 pub this: Box<Expression>,
12332 #[serde(default)]
12333 pub format: Option<String>,
12334 #[serde(default)]
12335 pub safe: Option<Box<Expression>>,
12336}
12337
12338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12340#[cfg_attr(feature = "bindings", derive(TS))]
12341pub struct StrToTime {
12342 pub this: Box<Expression>,
12343 pub format: String,
12344 #[serde(default)]
12345 pub zone: Option<Box<Expression>>,
12346 #[serde(default)]
12347 pub safe: Option<Box<Expression>>,
12348 #[serde(default)]
12349 pub target_type: Option<Box<Expression>>,
12350}
12351
12352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12354#[cfg_attr(feature = "bindings", derive(TS))]
12355pub struct StrToUnix {
12356 #[serde(default)]
12357 pub this: Option<Box<Expression>>,
12358 #[serde(default)]
12359 pub format: Option<String>,
12360}
12361
12362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12364#[cfg_attr(feature = "bindings", derive(TS))]
12365pub struct StrToMap {
12366 pub this: Box<Expression>,
12367 #[serde(default)]
12368 pub pair_delim: Option<Box<Expression>>,
12369 #[serde(default)]
12370 pub key_value_delim: Option<Box<Expression>>,
12371 #[serde(default)]
12372 pub duplicate_resolution_callback: Option<Box<Expression>>,
12373}
12374
12375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12377#[cfg_attr(feature = "bindings", derive(TS))]
12378pub struct NumberToStr {
12379 pub this: Box<Expression>,
12380 pub format: String,
12381 #[serde(default)]
12382 pub culture: Option<Box<Expression>>,
12383}
12384
12385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12387#[cfg_attr(feature = "bindings", derive(TS))]
12388pub struct FromBase {
12389 pub this: Box<Expression>,
12390 pub expression: Box<Expression>,
12391}
12392
12393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12395#[cfg_attr(feature = "bindings", derive(TS))]
12396pub struct Stuff {
12397 pub this: Box<Expression>,
12398 #[serde(default)]
12399 pub start: Option<Box<Expression>>,
12400 #[serde(default)]
12401 pub length: Option<i64>,
12402 pub expression: Box<Expression>,
12403}
12404
12405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12407#[cfg_attr(feature = "bindings", derive(TS))]
12408pub struct TimeToStr {
12409 pub this: Box<Expression>,
12410 pub format: String,
12411 #[serde(default)]
12412 pub culture: Option<Box<Expression>>,
12413 #[serde(default)]
12414 pub zone: Option<Box<Expression>>,
12415}
12416
12417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12419#[cfg_attr(feature = "bindings", derive(TS))]
12420pub struct TimeStrToTime {
12421 pub this: Box<Expression>,
12422 #[serde(default)]
12423 pub zone: Option<Box<Expression>>,
12424}
12425
12426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12428#[cfg_attr(feature = "bindings", derive(TS))]
12429pub struct TsOrDsAdd {
12430 pub this: Box<Expression>,
12431 pub expression: Box<Expression>,
12432 #[serde(default)]
12433 pub unit: Option<String>,
12434 #[serde(default)]
12435 pub return_type: Option<Box<Expression>>,
12436}
12437
12438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12440#[cfg_attr(feature = "bindings", derive(TS))]
12441pub struct TsOrDsDiff {
12442 pub this: Box<Expression>,
12443 pub expression: Box<Expression>,
12444 #[serde(default)]
12445 pub unit: Option<String>,
12446}
12447
12448#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12450#[cfg_attr(feature = "bindings", derive(TS))]
12451pub struct TsOrDsToDate {
12452 pub this: Box<Expression>,
12453 #[serde(default)]
12454 pub format: Option<String>,
12455 #[serde(default)]
12456 pub safe: Option<Box<Expression>>,
12457}
12458
12459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12461#[cfg_attr(feature = "bindings", derive(TS))]
12462pub struct TsOrDsToTime {
12463 pub this: Box<Expression>,
12464 #[serde(default)]
12465 pub format: Option<String>,
12466 #[serde(default)]
12467 pub safe: Option<Box<Expression>>,
12468}
12469
12470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12472#[cfg_attr(feature = "bindings", derive(TS))]
12473pub struct Unhex {
12474 pub this: Box<Expression>,
12475 #[serde(default)]
12476 pub expression: Option<Box<Expression>>,
12477}
12478
12479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12481#[cfg_attr(feature = "bindings", derive(TS))]
12482pub struct Uniform {
12483 pub this: Box<Expression>,
12484 pub expression: Box<Expression>,
12485 #[serde(default)]
12486 pub gen: Option<Box<Expression>>,
12487 #[serde(default)]
12488 pub seed: Option<Box<Expression>>,
12489}
12490
12491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12493#[cfg_attr(feature = "bindings", derive(TS))]
12494pub struct UnixToStr {
12495 pub this: Box<Expression>,
12496 #[serde(default)]
12497 pub format: Option<String>,
12498}
12499
12500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12502#[cfg_attr(feature = "bindings", derive(TS))]
12503pub struct UnixToTime {
12504 pub this: Box<Expression>,
12505 #[serde(default)]
12506 pub scale: Option<i64>,
12507 #[serde(default)]
12508 pub zone: Option<Box<Expression>>,
12509 #[serde(default)]
12510 pub hours: Option<Box<Expression>>,
12511 #[serde(default)]
12512 pub minutes: Option<Box<Expression>>,
12513 #[serde(default)]
12514 pub format: Option<String>,
12515 #[serde(default)]
12516 pub target_type: Option<Box<Expression>>,
12517}
12518
12519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12521#[cfg_attr(feature = "bindings", derive(TS))]
12522pub struct Uuid {
12523 #[serde(default)]
12524 pub this: Option<Box<Expression>>,
12525 #[serde(default)]
12526 pub name: Option<String>,
12527 #[serde(default)]
12528 pub is_string: Option<Box<Expression>>,
12529}
12530
12531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12533#[cfg_attr(feature = "bindings", derive(TS))]
12534pub struct TimestampFromParts {
12535 #[serde(default)]
12536 pub zone: Option<Box<Expression>>,
12537 #[serde(default)]
12538 pub milli: Option<Box<Expression>>,
12539 #[serde(default)]
12540 pub this: Option<Box<Expression>>,
12541 #[serde(default)]
12542 pub expression: Option<Box<Expression>>,
12543}
12544
12545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12547#[cfg_attr(feature = "bindings", derive(TS))]
12548pub struct TimestampTzFromParts {
12549 #[serde(default)]
12550 pub zone: Option<Box<Expression>>,
12551}
12552
12553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12555#[cfg_attr(feature = "bindings", derive(TS))]
12556pub struct Corr {
12557 pub this: Box<Expression>,
12558 pub expression: Box<Expression>,
12559 #[serde(default)]
12560 pub null_on_zero_variance: Option<Box<Expression>>,
12561}
12562
12563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12565#[cfg_attr(feature = "bindings", derive(TS))]
12566pub struct WidthBucket {
12567 pub this: Box<Expression>,
12568 #[serde(default)]
12569 pub min_value: Option<Box<Expression>>,
12570 #[serde(default)]
12571 pub max_value: Option<Box<Expression>>,
12572 #[serde(default)]
12573 pub num_buckets: Option<Box<Expression>>,
12574 #[serde(default)]
12575 pub threshold: Option<Box<Expression>>,
12576}
12577
12578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12580#[cfg_attr(feature = "bindings", derive(TS))]
12581pub struct CovarSamp {
12582 pub this: Box<Expression>,
12583 pub expression: Box<Expression>,
12584}
12585
12586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12588#[cfg_attr(feature = "bindings", derive(TS))]
12589pub struct CovarPop {
12590 pub this: Box<Expression>,
12591 pub expression: Box<Expression>,
12592}
12593
12594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12596#[cfg_attr(feature = "bindings", derive(TS))]
12597pub struct Week {
12598 pub this: Box<Expression>,
12599 #[serde(default)]
12600 pub mode: Option<Box<Expression>>,
12601}
12602
12603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12605#[cfg_attr(feature = "bindings", derive(TS))]
12606pub struct XMLElement {
12607 pub this: Box<Expression>,
12608 #[serde(default)]
12609 pub expressions: Vec<Expression>,
12610 #[serde(default)]
12611 pub evalname: Option<Box<Expression>>,
12612}
12613
12614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12616#[cfg_attr(feature = "bindings", derive(TS))]
12617pub struct XMLGet {
12618 pub this: Box<Expression>,
12619 pub expression: Box<Expression>,
12620 #[serde(default)]
12621 pub instance: Option<Box<Expression>>,
12622}
12623
12624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12626#[cfg_attr(feature = "bindings", derive(TS))]
12627pub struct XMLTable {
12628 pub this: Box<Expression>,
12629 #[serde(default)]
12630 pub namespaces: Option<Box<Expression>>,
12631 #[serde(default)]
12632 pub passing: Option<Box<Expression>>,
12633 #[serde(default)]
12634 pub columns: Vec<Expression>,
12635 #[serde(default)]
12636 pub by_ref: Option<Box<Expression>>,
12637}
12638
12639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12641#[cfg_attr(feature = "bindings", derive(TS))]
12642pub struct XMLKeyValueOption {
12643 pub this: Box<Expression>,
12644 #[serde(default)]
12645 pub expression: Option<Box<Expression>>,
12646}
12647
12648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12650#[cfg_attr(feature = "bindings", derive(TS))]
12651pub struct Zipf {
12652 pub this: Box<Expression>,
12653 #[serde(default)]
12654 pub elementcount: Option<Box<Expression>>,
12655 #[serde(default)]
12656 pub gen: Option<Box<Expression>>,
12657}
12658
12659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12661#[cfg_attr(feature = "bindings", derive(TS))]
12662pub struct Merge {
12663 pub this: Box<Expression>,
12664 pub using: Box<Expression>,
12665 #[serde(default)]
12666 pub on: Option<Box<Expression>>,
12667 #[serde(default)]
12668 pub using_cond: Option<Box<Expression>>,
12669 #[serde(default)]
12670 pub whens: Option<Box<Expression>>,
12671 #[serde(default)]
12672 pub with_: Option<Box<Expression>>,
12673 #[serde(default)]
12674 pub returning: Option<Box<Expression>>,
12675}
12676
12677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12679#[cfg_attr(feature = "bindings", derive(TS))]
12680pub struct When {
12681 #[serde(default)]
12682 pub matched: Option<Box<Expression>>,
12683 #[serde(default)]
12684 pub source: Option<Box<Expression>>,
12685 #[serde(default)]
12686 pub condition: Option<Box<Expression>>,
12687 pub then: Box<Expression>,
12688}
12689
12690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12692#[cfg_attr(feature = "bindings", derive(TS))]
12693pub struct Whens {
12694 #[serde(default)]
12695 pub expressions: Vec<Expression>,
12696}
12697
12698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12700#[cfg_attr(feature = "bindings", derive(TS))]
12701pub struct NextValueFor {
12702 pub this: Box<Expression>,
12703 #[serde(default)]
12704 pub order: Option<Box<Expression>>,
12705}
12706
12707#[cfg(test)]
12708mod tests {
12709 use super::*;
12710
12711 #[test]
12712 #[cfg(feature = "bindings")]
12713 fn export_typescript_types() {
12714 Expression::export_all(&ts_rs::Config::default())
12717 .expect("Failed to export Expression types");
12718 }
12719
12720 #[test]
12721 fn test_simple_select_builder() {
12722 let select = Select::new()
12723 .column(Expression::star())
12724 .from(Expression::Table(TableRef::new("users")));
12725
12726 assert_eq!(select.expressions.len(), 1);
12727 assert!(select.from.is_some());
12728 }
12729
12730 #[test]
12731 fn test_expression_alias() {
12732 let expr = Expression::column("id").alias("user_id");
12733
12734 match expr {
12735 Expression::Alias(a) => {
12736 assert_eq!(a.alias.name, "user_id");
12737 }
12738 _ => panic!("Expected Alias"),
12739 }
12740 }
12741
12742 #[test]
12743 fn test_literal_creation() {
12744 let num = Expression::number(42);
12745 let str = Expression::string("hello");
12746
12747 match num {
12748 Expression::Literal(Literal::Number(n)) => assert_eq!(n, "42"),
12749 _ => panic!("Expected Number"),
12750 }
12751
12752 match str {
12753 Expression::Literal(Literal::String(s)) => assert_eq!(s, "hello"),
12754 _ => panic!("Expected String"),
12755 }
12756 }
12757
12758 #[test]
12759 fn test_expression_sql() {
12760 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
12761 assert_eq!(expr.sql(), "SELECT 1 + 2");
12762 }
12763
12764 #[test]
12765 fn test_expression_sql_for() {
12766 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
12767 let sql = expr.sql_for(crate::DialectType::Generic);
12768 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
12770 }
12771}