1use serde::{Deserialize, Serialize};
34use std::fmt;
35#[cfg(feature = "bindings")]
36use ts_rs::TS;
37
38fn default_true() -> bool {
40 true
41}
42
43fn is_true(v: &bool) -> bool {
44 *v
45}
46
47#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
76#[cfg_attr(feature = "bindings", derive(TS))]
77#[serde(rename_all = "snake_case")]
78#[cfg_attr(feature = "bindings", ts(export))]
79pub enum Expression {
80 Literal(Literal),
82 Boolean(BooleanLiteral),
83 Null(Null),
84
85 Identifier(Identifier),
87 Column(Column),
88 Table(TableRef),
89 Star(Star),
90 BracedWildcard(Box<Expression>),
92
93 Select(Box<Select>),
95 Union(Box<Union>),
96 Intersect(Box<Intersect>),
97 Except(Box<Except>),
98 Subquery(Box<Subquery>),
99 PipeOperator(Box<PipeOperator>),
100 Pivot(Box<Pivot>),
101 PivotAlias(Box<PivotAlias>),
102 Unpivot(Box<Unpivot>),
103 Values(Box<Values>),
104 PreWhere(Box<PreWhere>),
105 Stream(Box<Stream>),
106 UsingData(Box<UsingData>),
107 XmlNamespace(Box<XmlNamespace>),
108
109 Insert(Box<Insert>),
111 Update(Box<Update>),
112 Delete(Box<Delete>),
113 Copy(Box<CopyStmt>),
114 Put(Box<PutStmt>),
115 StageReference(Box<StageReference>),
116
117 Alias(Box<Alias>),
119 Cast(Box<Cast>),
120 Collation(Box<CollationExpr>),
121 Case(Box<Case>),
122
123 And(Box<BinaryOp>),
125 Or(Box<BinaryOp>),
126 Add(Box<BinaryOp>),
127 Sub(Box<BinaryOp>),
128 Mul(Box<BinaryOp>),
129 Div(Box<BinaryOp>),
130 Mod(Box<BinaryOp>),
131 Eq(Box<BinaryOp>),
132 Neq(Box<BinaryOp>),
133 Lt(Box<BinaryOp>),
134 Lte(Box<BinaryOp>),
135 Gt(Box<BinaryOp>),
136 Gte(Box<BinaryOp>),
137 Like(Box<LikeOp>),
138 ILike(Box<LikeOp>),
139 Match(Box<BinaryOp>),
141 BitwiseAnd(Box<BinaryOp>),
142 BitwiseOr(Box<BinaryOp>),
143 BitwiseXor(Box<BinaryOp>),
144 Concat(Box<BinaryOp>),
145 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>),
161 Neg(Box<UnaryOp>),
162 BitwiseNot(Box<UnaryOp>),
163
164 In(Box<In>),
166 Between(Box<Between>),
167 IsNull(Box<IsNull>),
168 IsTrue(Box<IsTrueFalse>),
169 IsFalse(Box<IsTrueFalse>),
170 IsJson(Box<IsJson>),
171 Is(Box<BinaryOp>), Exists(Box<Exists>),
173 MemberOf(Box<BinaryOp>),
175
176 Function(Box<Function>),
178 AggregateFunction(Box<AggregateFunction>),
179 WindowFunction(Box<WindowFunction>),
180
181 From(Box<From>),
183 Join(Box<Join>),
184 JoinedTable(Box<JoinedTable>),
185 Where(Box<Where>),
186 GroupBy(Box<GroupBy>),
187 Having(Box<Having>),
188 OrderBy(Box<OrderBy>),
189 Limit(Box<Limit>),
190 Offset(Box<Offset>),
191 Qualify(Box<Qualify>),
192 With(Box<With>),
193 Cte(Box<Cte>),
194 DistributeBy(Box<DistributeBy>),
195 ClusterBy(Box<ClusterBy>),
196 SortBy(Box<SortBy>),
197 LateralView(Box<LateralView>),
198 Hint(Box<Hint>),
199 Pseudocolumn(Pseudocolumn),
200
201 Connect(Box<Connect>),
203 Prior(Box<Prior>),
204 ConnectByRoot(Box<ConnectByRoot>),
205
206 MatchRecognize(Box<MatchRecognize>),
208
209 Ordered(Box<Ordered>),
211
212 Window(Box<WindowSpec>),
214 Over(Box<Over>),
215 WithinGroup(Box<WithinGroup>),
216
217 DataType(DataType),
219
220 Array(Box<Array>),
222 Struct(Box<Struct>),
223 Tuple(Box<Tuple>),
224
225 Interval(Box<Interval>),
227
228 ConcatWs(Box<ConcatWs>),
230 Substring(Box<SubstringFunc>),
231 Upper(Box<UnaryFunc>),
232 Lower(Box<UnaryFunc>),
233 Length(Box<UnaryFunc>),
234 Trim(Box<TrimFunc>),
235 LTrim(Box<UnaryFunc>),
236 RTrim(Box<UnaryFunc>),
237 Replace(Box<ReplaceFunc>),
238 Reverse(Box<UnaryFunc>),
239 Left(Box<LeftRightFunc>),
240 Right(Box<LeftRightFunc>),
241 Repeat(Box<RepeatFunc>),
242 Lpad(Box<PadFunc>),
243 Rpad(Box<PadFunc>),
244 Split(Box<SplitFunc>),
245 RegexpLike(Box<RegexpFunc>),
246 RegexpReplace(Box<RegexpReplaceFunc>),
247 RegexpExtract(Box<RegexpExtractFunc>),
248 Overlay(Box<OverlayFunc>),
249
250 Abs(Box<UnaryFunc>),
252 Round(Box<RoundFunc>),
253 Floor(Box<FloorFunc>),
254 Ceil(Box<CeilFunc>),
255 Power(Box<BinaryFunc>),
256 Sqrt(Box<UnaryFunc>),
257 Cbrt(Box<UnaryFunc>),
258 Ln(Box<UnaryFunc>),
259 Log(Box<LogFunc>),
260 Exp(Box<UnaryFunc>),
261 Sign(Box<UnaryFunc>),
262 Greatest(Box<VarArgFunc>),
263 Least(Box<VarArgFunc>),
264
265 CurrentDate(CurrentDate),
267 CurrentTime(CurrentTime),
268 CurrentTimestamp(CurrentTimestamp),
269 CurrentTimestampLTZ(CurrentTimestampLTZ),
270 AtTimeZone(Box<AtTimeZone>),
271 DateAdd(Box<DateAddFunc>),
272 DateSub(Box<DateAddFunc>),
273 DateDiff(Box<DateDiffFunc>),
274 DateTrunc(Box<DateTruncFunc>),
275 Extract(Box<ExtractFunc>),
276 ToDate(Box<ToDateFunc>),
277 ToTimestamp(Box<ToTimestampFunc>),
278 Date(Box<UnaryFunc>),
279 Time(Box<UnaryFunc>),
280 DateFromUnixDate(Box<UnaryFunc>),
281 UnixDate(Box<UnaryFunc>),
282 UnixSeconds(Box<UnaryFunc>),
283 UnixMillis(Box<UnaryFunc>),
284 UnixMicros(Box<UnaryFunc>),
285 UnixToTimeStr(Box<BinaryFunc>),
286 TimeStrToDate(Box<UnaryFunc>),
287 DateToDi(Box<UnaryFunc>),
288 DiToDate(Box<UnaryFunc>),
289 TsOrDiToDi(Box<UnaryFunc>),
290 TsOrDsToDatetime(Box<UnaryFunc>),
291 TsOrDsToTimestamp(Box<UnaryFunc>),
292 YearOfWeek(Box<UnaryFunc>),
293 YearOfWeekIso(Box<UnaryFunc>),
294
295 Coalesce(Box<VarArgFunc>),
297 NullIf(Box<BinaryFunc>),
298 IfFunc(Box<IfFunc>),
299 IfNull(Box<BinaryFunc>),
300 Nvl(Box<BinaryFunc>),
301 Nvl2(Box<Nvl2Func>),
302
303 TryCast(Box<Cast>),
305 SafeCast(Box<Cast>),
306
307 Count(Box<CountFunc>),
309 Sum(Box<AggFunc>),
310 Avg(Box<AggFunc>),
311 Min(Box<AggFunc>),
312 Max(Box<AggFunc>),
313 GroupConcat(Box<GroupConcatFunc>),
314 StringAgg(Box<StringAggFunc>),
315 ListAgg(Box<ListAggFunc>),
316 ArrayAgg(Box<AggFunc>),
317 CountIf(Box<AggFunc>),
318 SumIf(Box<SumIfFunc>),
319 Stddev(Box<AggFunc>),
320 StddevPop(Box<AggFunc>),
321 StddevSamp(Box<AggFunc>),
322 Variance(Box<AggFunc>),
323 VarPop(Box<AggFunc>),
324 VarSamp(Box<AggFunc>),
325 Median(Box<AggFunc>),
326 Mode(Box<AggFunc>),
327 First(Box<AggFunc>),
328 Last(Box<AggFunc>),
329 AnyValue(Box<AggFunc>),
330 ApproxDistinct(Box<AggFunc>),
331 ApproxCountDistinct(Box<AggFunc>),
332 ApproxPercentile(Box<ApproxPercentileFunc>),
333 Percentile(Box<PercentileFunc>),
334 LogicalAnd(Box<AggFunc>),
335 LogicalOr(Box<AggFunc>),
336 Skewness(Box<AggFunc>),
337 BitwiseCount(Box<UnaryFunc>),
338 ArrayConcatAgg(Box<AggFunc>),
339 ArrayUniqueAgg(Box<AggFunc>),
340 BoolXorAgg(Box<AggFunc>),
341
342 RowNumber(RowNumber),
344 Rank(Rank),
345 DenseRank(DenseRank),
346 NTile(Box<NTileFunc>),
347 Lead(Box<LeadLagFunc>),
348 Lag(Box<LeadLagFunc>),
349 FirstValue(Box<ValueFunc>),
350 LastValue(Box<ValueFunc>),
351 NthValue(Box<NthValueFunc>),
352 PercentRank(PercentRank),
353 CumeDist(CumeDist),
354 PercentileCont(Box<PercentileFunc>),
355 PercentileDisc(Box<PercentileFunc>),
356
357 Contains(Box<BinaryFunc>),
359 StartsWith(Box<BinaryFunc>),
360 EndsWith(Box<BinaryFunc>),
361 Position(Box<PositionFunc>),
362 Initcap(Box<UnaryFunc>),
363 Ascii(Box<UnaryFunc>),
364 Chr(Box<UnaryFunc>),
365 CharFunc(Box<CharFunc>),
367 Soundex(Box<UnaryFunc>),
368 Levenshtein(Box<BinaryFunc>),
369 ByteLength(Box<UnaryFunc>),
370 Hex(Box<UnaryFunc>),
371 LowerHex(Box<UnaryFunc>),
372 Unicode(Box<UnaryFunc>),
373
374 ModFunc(Box<BinaryFunc>),
376 Random(Random),
377 Rand(Box<Rand>),
378 TruncFunc(Box<TruncateFunc>),
379 Pi(Pi),
380 Radians(Box<UnaryFunc>),
381 Degrees(Box<UnaryFunc>),
382 Sin(Box<UnaryFunc>),
383 Cos(Box<UnaryFunc>),
384 Tan(Box<UnaryFunc>),
385 Asin(Box<UnaryFunc>),
386 Acos(Box<UnaryFunc>),
387 Atan(Box<UnaryFunc>),
388 Atan2(Box<BinaryFunc>),
389 IsNan(Box<UnaryFunc>),
390 IsInf(Box<UnaryFunc>),
391 IntDiv(Box<BinaryFunc>),
392
393 Decode(Box<DecodeFunc>),
395
396 DateFormat(Box<DateFormatFunc>),
398 FormatDate(Box<DateFormatFunc>),
399 Year(Box<UnaryFunc>),
400 Month(Box<UnaryFunc>),
401 Day(Box<UnaryFunc>),
402 Hour(Box<UnaryFunc>),
403 Minute(Box<UnaryFunc>),
404 Second(Box<UnaryFunc>),
405 DayOfWeek(Box<UnaryFunc>),
406 DayOfWeekIso(Box<UnaryFunc>),
407 DayOfMonth(Box<UnaryFunc>),
408 DayOfYear(Box<UnaryFunc>),
409 WeekOfYear(Box<UnaryFunc>),
410 Quarter(Box<UnaryFunc>),
411 AddMonths(Box<BinaryFunc>),
412 MonthsBetween(Box<BinaryFunc>),
413 LastDay(Box<LastDayFunc>),
414 NextDay(Box<BinaryFunc>),
415 Epoch(Box<UnaryFunc>),
416 EpochMs(Box<UnaryFunc>),
417 FromUnixtime(Box<FromUnixtimeFunc>),
418 UnixTimestamp(Box<UnixTimestampFunc>),
419 MakeDate(Box<MakeDateFunc>),
420 MakeTimestamp(Box<MakeTimestampFunc>),
421 TimestampTrunc(Box<DateTruncFunc>),
422 TimeStrToUnix(Box<UnaryFunc>),
423
424 SessionUser(SessionUser),
426
427 SHA(Box<UnaryFunc>),
429 SHA1Digest(Box<UnaryFunc>),
430
431 TimeToUnix(Box<UnaryFunc>),
433
434 ArrayFunc(Box<ArrayConstructor>),
436 ArrayLength(Box<UnaryFunc>),
437 ArraySize(Box<UnaryFunc>),
438 Cardinality(Box<UnaryFunc>),
439 ArrayContains(Box<BinaryFunc>),
440 ArrayPosition(Box<BinaryFunc>),
441 ArrayAppend(Box<BinaryFunc>),
442 ArrayPrepend(Box<BinaryFunc>),
443 ArrayConcat(Box<VarArgFunc>),
444 ArraySort(Box<ArraySortFunc>),
445 ArrayReverse(Box<UnaryFunc>),
446 ArrayDistinct(Box<UnaryFunc>),
447 ArrayJoin(Box<ArrayJoinFunc>),
448 ArrayToString(Box<ArrayJoinFunc>),
449 Unnest(Box<UnnestFunc>),
450 Explode(Box<UnaryFunc>),
451 ExplodeOuter(Box<UnaryFunc>),
452 ArrayFilter(Box<ArrayFilterFunc>),
453 ArrayTransform(Box<ArrayTransformFunc>),
454 ArrayFlatten(Box<UnaryFunc>),
455 ArrayCompact(Box<UnaryFunc>),
456 ArrayIntersect(Box<BinaryFunc>),
457 ArrayUnion(Box<BinaryFunc>),
458 ArrayExcept(Box<BinaryFunc>),
459 ArrayRemove(Box<BinaryFunc>),
460 ArrayZip(Box<VarArgFunc>),
461 Sequence(Box<SequenceFunc>),
462 Generate(Box<SequenceFunc>),
463 ExplodingGenerateSeries(Box<SequenceFunc>),
464 ToArray(Box<UnaryFunc>),
465 StarMap(Box<BinaryFunc>),
466
467 StructFunc(Box<StructConstructor>),
469 StructExtract(Box<StructExtractFunc>),
470 NamedStruct(Box<NamedStructFunc>),
471
472 MapFunc(Box<MapConstructor>),
474 MapFromEntries(Box<UnaryFunc>),
475 MapFromArrays(Box<BinaryFunc>),
476 MapKeys(Box<UnaryFunc>),
477 MapValues(Box<UnaryFunc>),
478 MapContainsKey(Box<BinaryFunc>),
479 MapConcat(Box<VarArgFunc>),
480 ElementAt(Box<BinaryFunc>),
481 TransformKeys(Box<TransformFunc>),
482 TransformValues(Box<TransformFunc>),
483
484 JsonExtract(Box<JsonExtractFunc>),
486 JsonExtractScalar(Box<JsonExtractFunc>),
487 JsonExtractPath(Box<JsonPathFunc>),
488 JsonArray(Box<VarArgFunc>),
489 JsonObject(Box<JsonObjectFunc>),
490 JsonQuery(Box<JsonExtractFunc>),
491 JsonValue(Box<JsonExtractFunc>),
492 JsonArrayLength(Box<UnaryFunc>),
493 JsonKeys(Box<UnaryFunc>),
494 JsonType(Box<UnaryFunc>),
495 ParseJson(Box<UnaryFunc>),
496 ToJson(Box<UnaryFunc>),
497 JsonSet(Box<JsonModifyFunc>),
498 JsonInsert(Box<JsonModifyFunc>),
499 JsonRemove(Box<JsonPathFunc>),
500 JsonMergePatch(Box<BinaryFunc>),
501 JsonArrayAgg(Box<JsonArrayAggFunc>),
502 JsonObjectAgg(Box<JsonObjectAggFunc>),
503
504 Convert(Box<ConvertFunc>),
506 Typeof(Box<UnaryFunc>),
507
508 Lambda(Box<LambdaExpr>),
510 Parameter(Box<Parameter>),
511 Placeholder(Placeholder),
512 NamedArgument(Box<NamedArgument>),
513 TableArgument(Box<TableArgument>),
516 SqlComment(Box<SqlComment>),
517
518 NullSafeEq(Box<BinaryOp>),
520 NullSafeNeq(Box<BinaryOp>),
521 Glob(Box<BinaryOp>),
522 SimilarTo(Box<SimilarToExpr>),
523 Any(Box<QuantifiedExpr>),
524 All(Box<QuantifiedExpr>),
525 Overlaps(Box<OverlapsExpr>),
526
527 BitwiseLeftShift(Box<BinaryOp>),
529 BitwiseRightShift(Box<BinaryOp>),
530 BitwiseAndAgg(Box<AggFunc>),
531 BitwiseOrAgg(Box<AggFunc>),
532 BitwiseXorAgg(Box<AggFunc>),
533
534 Subscript(Box<Subscript>),
536 Dot(Box<DotAccess>),
537 MethodCall(Box<MethodCall>),
538 ArraySlice(Box<ArraySlice>),
539
540 CreateTable(Box<CreateTable>),
542 DropTable(Box<DropTable>),
543 AlterTable(Box<AlterTable>),
544 CreateIndex(Box<CreateIndex>),
545 DropIndex(Box<DropIndex>),
546 CreateView(Box<CreateView>),
547 DropView(Box<DropView>),
548 AlterView(Box<AlterView>),
549 AlterIndex(Box<AlterIndex>),
550 Truncate(Box<Truncate>),
551 Use(Box<Use>),
552 Cache(Box<Cache>),
553 Uncache(Box<Uncache>),
554 LoadData(Box<LoadData>),
555 Pragma(Box<Pragma>),
556 Grant(Box<Grant>),
557 Revoke(Box<Revoke>),
558 Comment(Box<Comment>),
559 SetStatement(Box<SetStatement>),
560 CreateSchema(Box<CreateSchema>),
562 DropSchema(Box<DropSchema>),
563 DropNamespace(Box<DropNamespace>),
564 CreateDatabase(Box<CreateDatabase>),
565 DropDatabase(Box<DropDatabase>),
566 CreateFunction(Box<CreateFunction>),
567 DropFunction(Box<DropFunction>),
568 CreateProcedure(Box<CreateProcedure>),
569 DropProcedure(Box<DropProcedure>),
570 CreateSequence(Box<CreateSequence>),
571 DropSequence(Box<DropSequence>),
572 AlterSequence(Box<AlterSequence>),
573 CreateTrigger(Box<CreateTrigger>),
574 DropTrigger(Box<DropTrigger>),
575 CreateType(Box<CreateType>),
576 DropType(Box<DropType>),
577 Describe(Box<Describe>),
578 Show(Box<Show>),
579
580 Command(Box<Command>),
582 Kill(Box<Kill>),
583 Execute(Box<ExecuteStatement>),
585
586 Raw(Raw),
588
589 Paren(Box<Paren>),
591
592 Annotated(Box<Annotated>),
594
595 Refresh(Box<Refresh>),
598 LockingStatement(Box<LockingStatement>),
599 SequenceProperties(Box<SequenceProperties>),
600 TruncateTable(Box<TruncateTable>),
601 Clone(Box<Clone>),
602 Attach(Box<Attach>),
603 Detach(Box<Detach>),
604 Install(Box<Install>),
605 Summarize(Box<Summarize>),
606 Declare(Box<Declare>),
607 DeclareItem(Box<DeclareItem>),
608 Set(Box<Set>),
609 Heredoc(Box<Heredoc>),
610 SetItem(Box<SetItem>),
611 QueryBand(Box<QueryBand>),
612 UserDefinedFunction(Box<UserDefinedFunction>),
613 RecursiveWithSearch(Box<RecursiveWithSearch>),
614 ProjectionDef(Box<ProjectionDef>),
615 TableAlias(Box<TableAlias>),
616 ByteString(Box<ByteString>),
617 HexStringExpr(Box<HexStringExpr>),
618 UnicodeString(Box<UnicodeString>),
619 ColumnPosition(Box<ColumnPosition>),
620 ColumnDef(Box<ColumnDef>),
621 AlterColumn(Box<AlterColumn>),
622 AlterSortKey(Box<AlterSortKey>),
623 AlterSet(Box<AlterSet>),
624 RenameColumn(Box<RenameColumn>),
625 Comprehension(Box<Comprehension>),
626 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
627 MergeTreeTTL(Box<MergeTreeTTL>),
628 IndexConstraintOption(Box<IndexConstraintOption>),
629 ColumnConstraint(Box<ColumnConstraint>),
630 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
631 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
632 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
633 CheckColumnConstraint(Box<CheckColumnConstraint>),
634 CompressColumnConstraint(Box<CompressColumnConstraint>),
635 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
636 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
637 WithOperator(Box<WithOperator>),
638 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
639 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
640 CommentColumnConstraint(CommentColumnConstraint),
641 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
642 IndexColumnConstraint(Box<IndexColumnConstraint>),
643 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
644 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
645 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
646 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
647 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
648 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
649 InOutColumnConstraint(Box<InOutColumnConstraint>),
650 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
651 PathColumnConstraint(Box<PathColumnConstraint>),
652 Constraint(Box<Constraint>),
653 Export(Box<Export>),
654 Filter(Box<Filter>),
655 Changes(Box<Changes>),
656 CopyParameter(Box<CopyParameter>),
657 Credentials(Box<Credentials>),
658 Directory(Box<Directory>),
659 ForeignKey(Box<ForeignKey>),
660 ColumnPrefix(Box<ColumnPrefix>),
661 PrimaryKey(Box<PrimaryKey>),
662 IntoClause(Box<IntoClause>),
663 JoinHint(Box<JoinHint>),
664 Opclass(Box<Opclass>),
665 Index(Box<Index>),
666 IndexParameters(Box<IndexParameters>),
667 ConditionalInsert(Box<ConditionalInsert>),
668 MultitableInserts(Box<MultitableInserts>),
669 OnConflict(Box<OnConflict>),
670 OnCondition(Box<OnCondition>),
671 Returning(Box<Returning>),
672 Introducer(Box<Introducer>),
673 PartitionRange(Box<PartitionRange>),
674 Fetch(Box<Fetch>),
675 Group(Box<Group>),
676 Cube(Box<Cube>),
677 Rollup(Box<Rollup>),
678 GroupingSets(Box<GroupingSets>),
679 LimitOptions(Box<LimitOptions>),
680 Lateral(Box<Lateral>),
681 TableFromRows(Box<TableFromRows>),
682 RowsFrom(Box<RowsFrom>),
683 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
684 WithFill(Box<WithFill>),
685 Property(Box<Property>),
686 GrantPrivilege(Box<GrantPrivilege>),
687 GrantPrincipal(Box<GrantPrincipal>),
688 AllowedValuesProperty(Box<AllowedValuesProperty>),
689 AlgorithmProperty(Box<AlgorithmProperty>),
690 AutoIncrementProperty(Box<AutoIncrementProperty>),
691 AutoRefreshProperty(Box<AutoRefreshProperty>),
692 BackupProperty(Box<BackupProperty>),
693 BuildProperty(Box<BuildProperty>),
694 BlockCompressionProperty(Box<BlockCompressionProperty>),
695 CharacterSetProperty(Box<CharacterSetProperty>),
696 ChecksumProperty(Box<ChecksumProperty>),
697 CollateProperty(Box<CollateProperty>),
698 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
699 DataDeletionProperty(Box<DataDeletionProperty>),
700 DefinerProperty(Box<DefinerProperty>),
701 DistKeyProperty(Box<DistKeyProperty>),
702 DistributedByProperty(Box<DistributedByProperty>),
703 DistStyleProperty(Box<DistStyleProperty>),
704 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
705 EngineProperty(Box<EngineProperty>),
706 ToTableProperty(Box<ToTableProperty>),
707 ExecuteAsProperty(Box<ExecuteAsProperty>),
708 ExternalProperty(Box<ExternalProperty>),
709 FallbackProperty(Box<FallbackProperty>),
710 FileFormatProperty(Box<FileFormatProperty>),
711 CredentialsProperty(Box<CredentialsProperty>),
712 FreespaceProperty(Box<FreespaceProperty>),
713 InheritsProperty(Box<InheritsProperty>),
714 InputModelProperty(Box<InputModelProperty>),
715 OutputModelProperty(Box<OutputModelProperty>),
716 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
717 JournalProperty(Box<JournalProperty>),
718 LanguageProperty(Box<LanguageProperty>),
719 EnviromentProperty(Box<EnviromentProperty>),
720 ClusteredByProperty(Box<ClusteredByProperty>),
721 DictProperty(Box<DictProperty>),
722 DictRange(Box<DictRange>),
723 OnCluster(Box<OnCluster>),
724 LikeProperty(Box<LikeProperty>),
725 LocationProperty(Box<LocationProperty>),
726 LockProperty(Box<LockProperty>),
727 LockingProperty(Box<LockingProperty>),
728 LogProperty(Box<LogProperty>),
729 MaterializedProperty(Box<MaterializedProperty>),
730 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
731 OnProperty(Box<OnProperty>),
732 OnCommitProperty(Box<OnCommitProperty>),
733 PartitionedByProperty(Box<PartitionedByProperty>),
734 PartitionedByBucket(Box<PartitionedByBucket>),
735 PartitionByTruncate(Box<PartitionByTruncate>),
736 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
737 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
738 PartitionByListProperty(Box<PartitionByListProperty>),
739 PartitionList(Box<PartitionList>),
740 Partition(Box<Partition>),
741 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
742 UniqueKeyProperty(Box<UniqueKeyProperty>),
743 RollupProperty(Box<RollupProperty>),
744 PartitionBoundSpec(Box<PartitionBoundSpec>),
745 PartitionedOfProperty(Box<PartitionedOfProperty>),
746 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
747 ReturnsProperty(Box<ReturnsProperty>),
748 RowFormatProperty(Box<RowFormatProperty>),
749 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
750 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
751 QueryTransform(Box<QueryTransform>),
752 SampleProperty(Box<SampleProperty>),
753 SecurityProperty(Box<SecurityProperty>),
754 SchemaCommentProperty(Box<SchemaCommentProperty>),
755 SemanticView(Box<SemanticView>),
756 SerdeProperties(Box<SerdeProperties>),
757 SetProperty(Box<SetProperty>),
758 SharingProperty(Box<SharingProperty>),
759 SetConfigProperty(Box<SetConfigProperty>),
760 SettingsProperty(Box<SettingsProperty>),
761 SortKeyProperty(Box<SortKeyProperty>),
762 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
763 SqlSecurityProperty(Box<SqlSecurityProperty>),
764 StabilityProperty(Box<StabilityProperty>),
765 StorageHandlerProperty(Box<StorageHandlerProperty>),
766 TemporaryProperty(Box<TemporaryProperty>),
767 Tags(Box<Tags>),
768 TransformModelProperty(Box<TransformModelProperty>),
769 TransientProperty(Box<TransientProperty>),
770 UsingTemplateProperty(Box<UsingTemplateProperty>),
771 ViewAttributeProperty(Box<ViewAttributeProperty>),
772 VolatileProperty(Box<VolatileProperty>),
773 WithDataProperty(Box<WithDataProperty>),
774 WithJournalTableProperty(Box<WithJournalTableProperty>),
775 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
776 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
777 WithProcedureOptions(Box<WithProcedureOptions>),
778 EncodeProperty(Box<EncodeProperty>),
779 IncludeProperty(Box<IncludeProperty>),
780 Properties(Box<Properties>),
781 InputOutputFormat(Box<InputOutputFormat>),
782 Reference(Box<Reference>),
783 QueryOption(Box<QueryOption>),
784 WithTableHint(Box<WithTableHint>),
785 IndexTableHint(Box<IndexTableHint>),
786 HistoricalData(Box<HistoricalData>),
787 Get(Box<Get>),
788 SetOperation(Box<SetOperation>),
789 Var(Box<Var>),
790 Version(Box<Version>),
791 Schema(Box<Schema>),
792 Lock(Box<Lock>),
793 TableSample(Box<TableSample>),
794 Tag(Box<Tag>),
795 UnpivotColumns(Box<UnpivotColumns>),
796 WindowSpec(Box<WindowSpec>),
797 SessionParameter(Box<SessionParameter>),
798 PseudoType(Box<PseudoType>),
799 ObjectIdentifier(Box<ObjectIdentifier>),
800 Transaction(Box<Transaction>),
801 Commit(Box<Commit>),
802 Rollback(Box<Rollback>),
803 AlterSession(Box<AlterSession>),
804 Analyze(Box<Analyze>),
805 AnalyzeStatistics(Box<AnalyzeStatistics>),
806 AnalyzeHistogram(Box<AnalyzeHistogram>),
807 AnalyzeSample(Box<AnalyzeSample>),
808 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
809 AnalyzeDelete(Box<AnalyzeDelete>),
810 AnalyzeWith(Box<AnalyzeWith>),
811 AnalyzeValidate(Box<AnalyzeValidate>),
812 AddPartition(Box<AddPartition>),
813 AttachOption(Box<AttachOption>),
814 DropPartition(Box<DropPartition>),
815 ReplacePartition(Box<ReplacePartition>),
816 DPipe(Box<DPipe>),
817 Operator(Box<Operator>),
818 PivotAny(Box<PivotAny>),
819 Aliases(Box<Aliases>),
820 AtIndex(Box<AtIndex>),
821 FromTimeZone(Box<FromTimeZone>),
822 FormatPhrase(Box<FormatPhrase>),
823 ForIn(Box<ForIn>),
824 TimeUnit(Box<TimeUnit>),
825 IntervalOp(Box<IntervalOp>),
826 IntervalSpan(Box<IntervalSpan>),
827 HavingMax(Box<HavingMax>),
828 CosineDistance(Box<CosineDistance>),
829 DotProduct(Box<DotProduct>),
830 EuclideanDistance(Box<EuclideanDistance>),
831 ManhattanDistance(Box<ManhattanDistance>),
832 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
833 Booland(Box<Booland>),
834 Boolor(Box<Boolor>),
835 ParameterizedAgg(Box<ParameterizedAgg>),
836 ArgMax(Box<ArgMax>),
837 ArgMin(Box<ArgMin>),
838 ApproxTopK(Box<ApproxTopK>),
839 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
840 ApproxTopKCombine(Box<ApproxTopKCombine>),
841 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
842 ApproxTopSum(Box<ApproxTopSum>),
843 ApproxQuantiles(Box<ApproxQuantiles>),
844 Minhash(Box<Minhash>),
845 FarmFingerprint(Box<FarmFingerprint>),
846 Float64(Box<Float64>),
847 Transform(Box<Transform>),
848 Translate(Box<Translate>),
849 Grouping(Box<Grouping>),
850 GroupingId(Box<GroupingId>),
851 Anonymous(Box<Anonymous>),
852 AnonymousAggFunc(Box<AnonymousAggFunc>),
853 CombinedAggFunc(Box<CombinedAggFunc>),
854 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
855 HashAgg(Box<HashAgg>),
856 Hll(Box<Hll>),
857 Apply(Box<Apply>),
858 ToBoolean(Box<ToBoolean>),
859 List(Box<List>),
860 ToMap(Box<ToMap>),
861 Pad(Box<Pad>),
862 ToChar(Box<ToChar>),
863 ToNumber(Box<ToNumber>),
864 ToDouble(Box<ToDouble>),
865 Int64(Box<UnaryFunc>),
866 StringFunc(Box<StringFunc>),
867 ToDecfloat(Box<ToDecfloat>),
868 TryToDecfloat(Box<TryToDecfloat>),
869 ToFile(Box<ToFile>),
870 Columns(Box<Columns>),
871 ConvertToCharset(Box<ConvertToCharset>),
872 ConvertTimezone(Box<ConvertTimezone>),
873 GenerateSeries(Box<GenerateSeries>),
874 AIAgg(Box<AIAgg>),
875 AIClassify(Box<AIClassify>),
876 ArrayAll(Box<ArrayAll>),
877 ArrayAny(Box<ArrayAny>),
878 ArrayConstructCompact(Box<ArrayConstructCompact>),
879 StPoint(Box<StPoint>),
880 StDistance(Box<StDistance>),
881 StringToArray(Box<StringToArray>),
882 ArraySum(Box<ArraySum>),
883 ObjectAgg(Box<ObjectAgg>),
884 CastToStrType(Box<CastToStrType>),
885 CheckJson(Box<CheckJson>),
886 CheckXml(Box<CheckXml>),
887 TranslateCharacters(Box<TranslateCharacters>),
888 CurrentSchemas(Box<CurrentSchemas>),
889 CurrentDatetime(Box<CurrentDatetime>),
890 Localtime(Box<Localtime>),
891 Localtimestamp(Box<Localtimestamp>),
892 Systimestamp(Box<Systimestamp>),
893 CurrentSchema(Box<CurrentSchema>),
894 CurrentUser(Box<CurrentUser>),
895 UtcTime(Box<UtcTime>),
896 UtcTimestamp(Box<UtcTimestamp>),
897 Timestamp(Box<TimestampFunc>),
898 DateBin(Box<DateBin>),
899 Datetime(Box<Datetime>),
900 DatetimeAdd(Box<DatetimeAdd>),
901 DatetimeSub(Box<DatetimeSub>),
902 DatetimeDiff(Box<DatetimeDiff>),
903 DatetimeTrunc(Box<DatetimeTrunc>),
904 Dayname(Box<Dayname>),
905 MakeInterval(Box<MakeInterval>),
906 PreviousDay(Box<PreviousDay>),
907 Elt(Box<Elt>),
908 TimestampAdd(Box<TimestampAdd>),
909 TimestampSub(Box<TimestampSub>),
910 TimestampDiff(Box<TimestampDiff>),
911 TimeSlice(Box<TimeSlice>),
912 TimeAdd(Box<TimeAdd>),
913 TimeSub(Box<TimeSub>),
914 TimeDiff(Box<TimeDiff>),
915 TimeTrunc(Box<TimeTrunc>),
916 DateFromParts(Box<DateFromParts>),
917 TimeFromParts(Box<TimeFromParts>),
918 DecodeCase(Box<DecodeCase>),
919 Decrypt(Box<Decrypt>),
920 DecryptRaw(Box<DecryptRaw>),
921 Encode(Box<Encode>),
922 Encrypt(Box<Encrypt>),
923 EncryptRaw(Box<EncryptRaw>),
924 EqualNull(Box<EqualNull>),
925 ToBinary(Box<ToBinary>),
926 Base64DecodeBinary(Box<Base64DecodeBinary>),
927 Base64DecodeString(Box<Base64DecodeString>),
928 Base64Encode(Box<Base64Encode>),
929 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
930 TryBase64DecodeString(Box<TryBase64DecodeString>),
931 GapFill(Box<GapFill>),
932 GenerateDateArray(Box<GenerateDateArray>),
933 GenerateTimestampArray(Box<GenerateTimestampArray>),
934 GetExtract(Box<GetExtract>),
935 Getbit(Box<Getbit>),
936 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
937 HexEncode(Box<HexEncode>),
938 Compress(Box<Compress>),
939 DecompressBinary(Box<DecompressBinary>),
940 DecompressString(Box<DecompressString>),
941 Xor(Box<Xor>),
942 Nullif(Box<Nullif>),
943 JSON(Box<JSON>),
944 JSONPath(Box<JSONPath>),
945 JSONPathFilter(Box<JSONPathFilter>),
946 JSONPathKey(Box<JSONPathKey>),
947 JSONPathRecursive(Box<JSONPathRecursive>),
948 JSONPathScript(Box<JSONPathScript>),
949 JSONPathSlice(Box<JSONPathSlice>),
950 JSONPathSelector(Box<JSONPathSelector>),
951 JSONPathSubscript(Box<JSONPathSubscript>),
952 JSONPathUnion(Box<JSONPathUnion>),
953 Format(Box<Format>),
954 JSONKeys(Box<JSONKeys>),
955 JSONKeyValue(Box<JSONKeyValue>),
956 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
957 JSONObject(Box<JSONObject>),
958 JSONObjectAgg(Box<JSONObjectAgg>),
959 JSONBObjectAgg(Box<JSONBObjectAgg>),
960 JSONArray(Box<JSONArray>),
961 JSONArrayAgg(Box<JSONArrayAgg>),
962 JSONExists(Box<JSONExists>),
963 JSONColumnDef(Box<JSONColumnDef>),
964 JSONSchema(Box<JSONSchema>),
965 JSONSet(Box<JSONSet>),
966 JSONStripNulls(Box<JSONStripNulls>),
967 JSONValue(Box<JSONValue>),
968 JSONValueArray(Box<JSONValueArray>),
969 JSONRemove(Box<JSONRemove>),
970 JSONTable(Box<JSONTable>),
971 JSONType(Box<JSONType>),
972 ObjectInsert(Box<ObjectInsert>),
973 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
974 OpenJSON(Box<OpenJSON>),
975 JSONBExists(Box<JSONBExists>),
976 JSONBContains(Box<BinaryFunc>),
977 JSONBExtract(Box<BinaryFunc>),
978 JSONCast(Box<JSONCast>),
979 JSONExtract(Box<JSONExtract>),
980 JSONExtractQuote(Box<JSONExtractQuote>),
981 JSONExtractArray(Box<JSONExtractArray>),
982 JSONExtractScalar(Box<JSONExtractScalar>),
983 JSONBExtractScalar(Box<JSONBExtractScalar>),
984 JSONFormat(Box<JSONFormat>),
985 JSONBool(Box<UnaryFunc>),
986 JSONPathRoot(JSONPathRoot),
987 JSONArrayAppend(Box<JSONArrayAppend>),
988 JSONArrayContains(Box<JSONArrayContains>),
989 JSONArrayInsert(Box<JSONArrayInsert>),
990 ParseJSON(Box<ParseJSON>),
991 ParseUrl(Box<ParseUrl>),
992 ParseIp(Box<ParseIp>),
993 ParseTime(Box<ParseTime>),
994 ParseDatetime(Box<ParseDatetime>),
995 Map(Box<Map>),
996 MapCat(Box<MapCat>),
997 MapDelete(Box<MapDelete>),
998 MapInsert(Box<MapInsert>),
999 MapPick(Box<MapPick>),
1000 ScopeResolution(Box<ScopeResolution>),
1001 Slice(Box<Slice>),
1002 VarMap(Box<VarMap>),
1003 MatchAgainst(Box<MatchAgainst>),
1004 MD5Digest(Box<MD5Digest>),
1005 MD5NumberLower64(Box<UnaryFunc>),
1006 MD5NumberUpper64(Box<UnaryFunc>),
1007 Monthname(Box<Monthname>),
1008 Ntile(Box<Ntile>),
1009 Normalize(Box<Normalize>),
1010 Normal(Box<Normal>),
1011 Predict(Box<Predict>),
1012 MLTranslate(Box<MLTranslate>),
1013 FeaturesAtTime(Box<FeaturesAtTime>),
1014 GenerateEmbedding(Box<GenerateEmbedding>),
1015 MLForecast(Box<MLForecast>),
1016 ModelAttribute(Box<ModelAttribute>),
1017 VectorSearch(Box<VectorSearch>),
1018 Quantile(Box<Quantile>),
1019 ApproxQuantile(Box<ApproxQuantile>),
1020 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1021 Randn(Box<Randn>),
1022 Randstr(Box<Randstr>),
1023 RangeN(Box<RangeN>),
1024 RangeBucket(Box<RangeBucket>),
1025 ReadCSV(Box<ReadCSV>),
1026 ReadParquet(Box<ReadParquet>),
1027 Reduce(Box<Reduce>),
1028 RegexpExtractAll(Box<RegexpExtractAll>),
1029 RegexpILike(Box<RegexpILike>),
1030 RegexpFullMatch(Box<RegexpFullMatch>),
1031 RegexpInstr(Box<RegexpInstr>),
1032 RegexpSplit(Box<RegexpSplit>),
1033 RegexpCount(Box<RegexpCount>),
1034 RegrValx(Box<RegrValx>),
1035 RegrValy(Box<RegrValy>),
1036 RegrAvgy(Box<RegrAvgy>),
1037 RegrAvgx(Box<RegrAvgx>),
1038 RegrCount(Box<RegrCount>),
1039 RegrIntercept(Box<RegrIntercept>),
1040 RegrR2(Box<RegrR2>),
1041 RegrSxx(Box<RegrSxx>),
1042 RegrSxy(Box<RegrSxy>),
1043 RegrSyy(Box<RegrSyy>),
1044 RegrSlope(Box<RegrSlope>),
1045 SafeAdd(Box<SafeAdd>),
1046 SafeDivide(Box<SafeDivide>),
1047 SafeMultiply(Box<SafeMultiply>),
1048 SafeSubtract(Box<SafeSubtract>),
1049 SHA2(Box<SHA2>),
1050 SHA2Digest(Box<SHA2Digest>),
1051 SortArray(Box<SortArray>),
1052 SplitPart(Box<SplitPart>),
1053 SubstringIndex(Box<SubstringIndex>),
1054 StandardHash(Box<StandardHash>),
1055 StrPosition(Box<StrPosition>),
1056 Search(Box<Search>),
1057 SearchIp(Box<SearchIp>),
1058 StrToDate(Box<StrToDate>),
1059 DateStrToDate(Box<UnaryFunc>),
1060 DateToDateStr(Box<UnaryFunc>),
1061 StrToTime(Box<StrToTime>),
1062 StrToUnix(Box<StrToUnix>),
1063 StrToMap(Box<StrToMap>),
1064 NumberToStr(Box<NumberToStr>),
1065 FromBase(Box<FromBase>),
1066 Stuff(Box<Stuff>),
1067 TimeToStr(Box<TimeToStr>),
1068 TimeStrToTime(Box<TimeStrToTime>),
1069 TsOrDsAdd(Box<TsOrDsAdd>),
1070 TsOrDsDiff(Box<TsOrDsDiff>),
1071 TsOrDsToDate(Box<TsOrDsToDate>),
1072 TsOrDsToTime(Box<TsOrDsToTime>),
1073 Unhex(Box<Unhex>),
1074 Uniform(Box<Uniform>),
1075 UnixToStr(Box<UnixToStr>),
1076 UnixToTime(Box<UnixToTime>),
1077 Uuid(Box<Uuid>),
1078 TimestampFromParts(Box<TimestampFromParts>),
1079 TimestampTzFromParts(Box<TimestampTzFromParts>),
1080 Corr(Box<Corr>),
1081 WidthBucket(Box<WidthBucket>),
1082 CovarSamp(Box<CovarSamp>),
1083 CovarPop(Box<CovarPop>),
1084 Week(Box<Week>),
1085 XMLElement(Box<XMLElement>),
1086 XMLGet(Box<XMLGet>),
1087 XMLTable(Box<XMLTable>),
1088 XMLKeyValueOption(Box<XMLKeyValueOption>),
1089 Zipf(Box<Zipf>),
1090 Merge(Box<Merge>),
1091 When(Box<When>),
1092 Whens(Box<Whens>),
1093 NextValueFor(Box<NextValueFor>),
1094 ReturnStmt(Box<Expression>),
1096}
1097
1098impl Expression {
1099 pub fn is_statement(&self) -> bool {
1106 match self {
1107 Expression::Select(_)
1109 | Expression::Union(_)
1110 | Expression::Intersect(_)
1111 | Expression::Except(_)
1112 | Expression::Subquery(_)
1113 | Expression::Values(_)
1114 | Expression::PipeOperator(_)
1115
1116 | Expression::Insert(_)
1118 | Expression::Update(_)
1119 | Expression::Delete(_)
1120 | Expression::Copy(_)
1121 | Expression::Put(_)
1122 | Expression::Merge(_)
1123
1124 | Expression::CreateTable(_)
1126 | Expression::DropTable(_)
1127 | Expression::AlterTable(_)
1128 | Expression::CreateIndex(_)
1129 | Expression::DropIndex(_)
1130 | Expression::CreateView(_)
1131 | Expression::DropView(_)
1132 | Expression::AlterView(_)
1133 | Expression::AlterIndex(_)
1134 | Expression::Truncate(_)
1135 | Expression::TruncateTable(_)
1136 | Expression::CreateSchema(_)
1137 | Expression::DropSchema(_)
1138 | Expression::DropNamespace(_)
1139 | Expression::CreateDatabase(_)
1140 | Expression::DropDatabase(_)
1141 | Expression::CreateFunction(_)
1142 | Expression::DropFunction(_)
1143 | Expression::CreateProcedure(_)
1144 | Expression::DropProcedure(_)
1145 | Expression::CreateSequence(_)
1146 | Expression::DropSequence(_)
1147 | Expression::AlterSequence(_)
1148 | Expression::CreateTrigger(_)
1149 | Expression::DropTrigger(_)
1150 | Expression::CreateType(_)
1151 | Expression::DropType(_)
1152 | Expression::Comment(_)
1153
1154 | Expression::Use(_)
1156 | Expression::Set(_)
1157 | Expression::SetStatement(_)
1158 | Expression::Transaction(_)
1159 | Expression::Commit(_)
1160 | Expression::Rollback(_)
1161 | Expression::Grant(_)
1162 | Expression::Revoke(_)
1163 | Expression::Cache(_)
1164 | Expression::Uncache(_)
1165 | Expression::LoadData(_)
1166 | Expression::Pragma(_)
1167 | Expression::Describe(_)
1168 | Expression::Show(_)
1169 | Expression::Kill(_)
1170 | Expression::Execute(_)
1171 | Expression::Declare(_)
1172 | Expression::Refresh(_)
1173 | Expression::AlterSession(_)
1174 | Expression::LockingStatement(_)
1175
1176 | Expression::Analyze(_)
1178 | Expression::AnalyzeStatistics(_)
1179 | Expression::AnalyzeHistogram(_)
1180 | Expression::AnalyzeSample(_)
1181 | Expression::AnalyzeListChainedRows(_)
1182 | Expression::AnalyzeDelete(_)
1183
1184 | Expression::Attach(_)
1186 | Expression::Detach(_)
1187 | Expression::Install(_)
1188 | Expression::Summarize(_)
1189
1190 | Expression::Pivot(_)
1192 | Expression::Unpivot(_)
1193
1194 | Expression::Command(_)
1196 | Expression::Raw(_)
1197
1198 | Expression::ReturnStmt(_) => true,
1200
1201 Expression::Annotated(a) => a.this.is_statement(),
1203
1204 Expression::Alias(a) => a.this.is_statement(),
1206
1207 _ => false,
1209 }
1210 }
1211
1212 pub fn number(n: i64) -> Self {
1214 Expression::Literal(Literal::Number(n.to_string()))
1215 }
1216
1217 pub fn string(s: impl Into<String>) -> Self {
1219 Expression::Literal(Literal::String(s.into()))
1220 }
1221
1222 pub fn float(f: f64) -> Self {
1224 Expression::Literal(Literal::Number(f.to_string()))
1225 }
1226
1227 pub fn column(name: impl Into<String>) -> Self {
1229 Expression::Column(Column {
1230 name: Identifier::new(name),
1231 table: None,
1232 join_mark: false,
1233 trailing_comments: Vec::new(),
1234 })
1235 }
1236
1237 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1239 Expression::Column(Column {
1240 name: Identifier::new(column),
1241 table: Some(Identifier::new(table)),
1242 join_mark: false,
1243 trailing_comments: Vec::new(),
1244 })
1245 }
1246
1247 pub fn identifier(name: impl Into<String>) -> Self {
1249 Expression::Identifier(Identifier::new(name))
1250 }
1251
1252 pub fn null() -> Self {
1254 Expression::Null(Null)
1255 }
1256
1257 pub fn true_() -> Self {
1259 Expression::Boolean(BooleanLiteral { value: true })
1260 }
1261
1262 pub fn false_() -> Self {
1264 Expression::Boolean(BooleanLiteral { value: false })
1265 }
1266
1267 pub fn star() -> Self {
1269 Expression::Star(Star {
1270 table: None,
1271 except: None,
1272 replace: None,
1273 rename: None,
1274 trailing_comments: Vec::new(),
1275 })
1276 }
1277
1278 pub fn alias(self, name: impl Into<String>) -> Self {
1280 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1281 }
1282
1283 pub fn is_select(&self) -> bool {
1285 matches!(self, Expression::Select(_))
1286 }
1287
1288 pub fn as_select(&self) -> Option<&Select> {
1290 match self {
1291 Expression::Select(s) => Some(s),
1292 _ => None,
1293 }
1294 }
1295
1296 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1298 match self {
1299 Expression::Select(s) => Some(s),
1300 _ => None,
1301 }
1302 }
1303
1304 pub fn sql(&self) -> String {
1309 crate::generator::Generator::sql(self).unwrap_or_default()
1310 }
1311
1312 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1318 crate::generate(self, dialect).unwrap_or_default()
1319 }
1320
1321}
1322
1323impl fmt::Display for Expression {
1324 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1325 match self {
1327 Expression::Literal(lit) => write!(f, "{}", lit),
1328 Expression::Identifier(id) => write!(f, "{}", id),
1329 Expression::Column(col) => write!(f, "{}", col),
1330 Expression::Star(_) => write!(f, "*"),
1331 Expression::Null(_) => write!(f, "NULL"),
1332 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
1333 Expression::Select(_) => write!(f, "SELECT ..."),
1334 _ => write!(f, "{:?}", self),
1335 }
1336 }
1337}
1338
1339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1349#[cfg_attr(feature = "bindings", derive(TS))]
1350#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
1351pub enum Literal {
1352 String(String),
1354 Number(String),
1356 HexString(String),
1358 HexNumber(String),
1360 BitString(String),
1361 ByteString(String),
1363 NationalString(String),
1365 Date(String),
1367 Time(String),
1369 Timestamp(String),
1371 Datetime(String),
1373 TripleQuotedString(String, char),
1376 EscapeString(String),
1378 DollarString(String),
1380 RawString(String),
1384}
1385
1386impl fmt::Display for Literal {
1387 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1388 match self {
1389 Literal::String(s) => write!(f, "'{}'", s),
1390 Literal::Number(n) => write!(f, "{}", n),
1391 Literal::HexString(h) => write!(f, "X'{}'", h),
1392 Literal::HexNumber(h) => write!(f, "0x{}", h),
1393 Literal::BitString(b) => write!(f, "B'{}'", b),
1394 Literal::ByteString(b) => write!(f, "b'{}'", b),
1395 Literal::NationalString(s) => write!(f, "N'{}'", s),
1396 Literal::Date(d) => write!(f, "DATE '{}'", d),
1397 Literal::Time(t) => write!(f, "TIME '{}'", t),
1398 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
1399 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
1400 Literal::TripleQuotedString(s, q) => {
1401 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
1402 }
1403 Literal::EscapeString(s) => write!(f, "E'{}'", s),
1404 Literal::DollarString(s) => write!(f, "$${}$$", s),
1405 Literal::RawString(s) => write!(f, "r'{}'", s),
1406 }
1407 }
1408}
1409
1410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1412#[cfg_attr(feature = "bindings", derive(TS))]
1413pub struct BooleanLiteral {
1414 pub value: bool,
1415}
1416
1417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1419#[cfg_attr(feature = "bindings", derive(TS))]
1420pub struct Null;
1421
1422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1429#[cfg_attr(feature = "bindings", derive(TS))]
1430pub struct Identifier {
1431 pub name: String,
1433 pub quoted: bool,
1435 #[serde(default)]
1436 pub trailing_comments: Vec<String>,
1437}
1438
1439impl Identifier {
1440 pub fn new(name: impl Into<String>) -> Self {
1441 Self {
1442 name: name.into(),
1443 quoted: false,
1444 trailing_comments: Vec::new(),
1445 }
1446 }
1447
1448 pub fn quoted(name: impl Into<String>) -> Self {
1449 Self {
1450 name: name.into(),
1451 quoted: true,
1452 trailing_comments: Vec::new(),
1453 }
1454 }
1455
1456 pub fn empty() -> Self {
1457 Self {
1458 name: String::new(),
1459 quoted: false,
1460 trailing_comments: Vec::new(),
1461 }
1462 }
1463
1464 pub fn is_empty(&self) -> bool {
1465 self.name.is_empty()
1466 }
1467}
1468
1469impl fmt::Display for Identifier {
1470 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1471 if self.quoted {
1472 write!(f, "\"{}\"", self.name)
1473 } else {
1474 write!(f, "{}", self.name)
1475 }
1476 }
1477}
1478
1479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1485#[cfg_attr(feature = "bindings", derive(TS))]
1486pub struct Column {
1487 pub name: Identifier,
1489 pub table: Option<Identifier>,
1491 #[serde(default)]
1493 pub join_mark: bool,
1494 #[serde(default)]
1496 pub trailing_comments: Vec<String>,
1497}
1498
1499impl fmt::Display for Column {
1500 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1501 if let Some(table) = &self.table {
1502 write!(f, "{}.{}", table, self.name)
1503 } else {
1504 write!(f, "{}", self.name)
1505 }
1506 }
1507}
1508
1509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1516#[cfg_attr(feature = "bindings", derive(TS))]
1517pub struct TableRef {
1518 pub name: Identifier,
1520 pub schema: Option<Identifier>,
1522 pub catalog: Option<Identifier>,
1524 pub alias: Option<Identifier>,
1526 #[serde(default)]
1528 pub alias_explicit_as: bool,
1529 #[serde(default)]
1531 pub column_aliases: Vec<Identifier>,
1532 #[serde(default)]
1534 pub trailing_comments: Vec<String>,
1535 #[serde(default)]
1537 pub when: Option<Box<HistoricalData>>,
1538 #[serde(default)]
1540 pub only: bool,
1541 #[serde(default)]
1543 pub final_: bool,
1544 #[serde(default, skip_serializing_if = "Option::is_none")]
1546 pub table_sample: Option<Box<Sample>>,
1547 #[serde(default)]
1549 pub hints: Vec<Expression>,
1550 #[serde(default, skip_serializing_if = "Option::is_none")]
1553 pub system_time: Option<String>,
1554 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1556 pub partitions: Vec<Identifier>,
1557 #[serde(default, skip_serializing_if = "Option::is_none")]
1560 pub identifier_func: Option<Box<Expression>>,
1561 #[serde(default, skip_serializing_if = "Option::is_none")]
1563 pub changes: Option<Box<Changes>>,
1564 #[serde(default, skip_serializing_if = "Option::is_none")]
1566 pub version: Option<Box<Version>>,
1567}
1568
1569impl TableRef {
1570 pub fn new(name: impl Into<String>) -> Self {
1571 Self {
1572 name: Identifier::new(name),
1573 schema: None,
1574 catalog: None,
1575 alias: None,
1576 alias_explicit_as: false,
1577 column_aliases: Vec::new(),
1578 trailing_comments: Vec::new(),
1579 when: None,
1580 only: false,
1581 final_: false,
1582 table_sample: None,
1583 hints: Vec::new(),
1584 system_time: None,
1585 partitions: Vec::new(),
1586 identifier_func: None,
1587 changes: None,
1588 version: None,
1589 }
1590 }
1591
1592 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
1594 let mut t = Self::new(name);
1595 t.schema = Some(Identifier::new(schema));
1596 t
1597 }
1598
1599 pub fn new_with_catalog(
1601 name: impl Into<String>,
1602 schema: impl Into<String>,
1603 catalog: impl Into<String>,
1604 ) -> Self {
1605 let mut t = Self::new(name);
1606 t.schema = Some(Identifier::new(schema));
1607 t.catalog = Some(Identifier::new(catalog));
1608 t
1609 }
1610
1611 pub fn from_identifier(name: Identifier) -> Self {
1613 Self {
1614 name,
1615 schema: None,
1616 catalog: None,
1617 alias: None,
1618 alias_explicit_as: false,
1619 column_aliases: Vec::new(),
1620 trailing_comments: Vec::new(),
1621 when: None,
1622 only: false,
1623 final_: false,
1624 table_sample: None,
1625 hints: Vec::new(),
1626 system_time: None,
1627 partitions: Vec::new(),
1628 identifier_func: None,
1629 changes: None,
1630 version: None,
1631 }
1632 }
1633
1634 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
1635 self.alias = Some(Identifier::new(alias));
1636 self
1637 }
1638
1639 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
1640 self.schema = Some(Identifier::new(schema));
1641 self
1642 }
1643}
1644
1645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1650#[cfg_attr(feature = "bindings", derive(TS))]
1651pub struct Star {
1652 pub table: Option<Identifier>,
1654 pub except: Option<Vec<Identifier>>,
1656 pub replace: Option<Vec<Alias>>,
1658 pub rename: Option<Vec<(Identifier, Identifier)>>,
1660 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1662 pub trailing_comments: Vec<String>,
1663}
1664
1665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1689#[cfg_attr(feature = "bindings", derive(TS))]
1690pub struct Select {
1691 pub expressions: Vec<Expression>,
1693 pub from: Option<From>,
1695 pub joins: Vec<Join>,
1697 pub lateral_views: Vec<LateralView>,
1698 #[serde(default, skip_serializing_if = "Option::is_none")]
1700 pub prewhere: Option<Expression>,
1701 pub where_clause: Option<Where>,
1702 pub group_by: Option<GroupBy>,
1703 pub having: Option<Having>,
1704 pub qualify: Option<Qualify>,
1705 pub order_by: Option<OrderBy>,
1706 pub distribute_by: Option<DistributeBy>,
1707 pub cluster_by: Option<ClusterBy>,
1708 pub sort_by: Option<SortBy>,
1709 pub limit: Option<Limit>,
1710 pub offset: Option<Offset>,
1711 #[serde(default, skip_serializing_if = "Option::is_none")]
1713 pub limit_by: Option<Vec<Expression>>,
1714 pub fetch: Option<Fetch>,
1715 pub distinct: bool,
1716 pub distinct_on: Option<Vec<Expression>>,
1717 pub top: Option<Top>,
1718 pub with: Option<With>,
1719 pub sample: Option<Sample>,
1720 #[serde(default, skip_serializing_if = "Option::is_none")]
1722 pub settings: Option<Vec<Expression>>,
1723 #[serde(default, skip_serializing_if = "Option::is_none")]
1725 pub format: Option<Expression>,
1726 pub windows: Option<Vec<NamedWindow>>,
1727 pub hint: Option<Hint>,
1728 pub connect: Option<Connect>,
1730 pub into: Option<SelectInto>,
1732 #[serde(default)]
1734 pub locks: Vec<Lock>,
1735 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1737 pub for_xml: Vec<Expression>,
1738 #[serde(default)]
1740 pub leading_comments: Vec<String>,
1741 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1744 pub post_select_comments: Vec<String>,
1745 #[serde(default, skip_serializing_if = "Option::is_none")]
1747 pub kind: Option<String>,
1748 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1750 pub operation_modifiers: Vec<String>,
1751 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
1753 pub qualify_after_window: bool,
1754 #[serde(default, skip_serializing_if = "Option::is_none")]
1756 pub option: Option<String>,
1757}
1758
1759impl Select {
1760 pub fn new() -> Self {
1761 Self {
1762 expressions: Vec::new(),
1763 from: None,
1764 joins: Vec::new(),
1765 lateral_views: Vec::new(),
1766 prewhere: None,
1767 where_clause: None,
1768 group_by: None,
1769 having: None,
1770 qualify: None,
1771 order_by: None,
1772 distribute_by: None,
1773 cluster_by: None,
1774 sort_by: None,
1775 limit: None,
1776 offset: None,
1777 limit_by: None,
1778 fetch: None,
1779 distinct: false,
1780 distinct_on: None,
1781 top: None,
1782 with: None,
1783 sample: None,
1784 settings: None,
1785 format: None,
1786 windows: None,
1787 hint: None,
1788 connect: None,
1789 into: None,
1790 locks: Vec::new(),
1791 for_xml: Vec::new(),
1792 leading_comments: Vec::new(),
1793 post_select_comments: Vec::new(),
1794 kind: None,
1795 operation_modifiers: Vec::new(),
1796 qualify_after_window: false,
1797 option: None,
1798 }
1799 }
1800
1801 pub fn column(mut self, expr: Expression) -> Self {
1803 self.expressions.push(expr);
1804 self
1805 }
1806
1807 pub fn from(mut self, table: Expression) -> Self {
1809 self.from = Some(From {
1810 expressions: vec![table],
1811 });
1812 self
1813 }
1814
1815 pub fn where_(mut self, condition: Expression) -> Self {
1817 self.where_clause = Some(Where { this: condition });
1818 self
1819 }
1820
1821 pub fn distinct(mut self) -> Self {
1823 self.distinct = true;
1824 self
1825 }
1826
1827 pub fn join(mut self, join: Join) -> Self {
1829 self.joins.push(join);
1830 self
1831 }
1832
1833 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
1835 self.order_by = Some(OrderBy { expressions, siblings: false });
1836 self
1837 }
1838
1839 pub fn limit(mut self, n: Expression) -> Self {
1841 self.limit = Some(Limit { this: n, percent: false });
1842 self
1843 }
1844
1845 pub fn offset(mut self, n: Expression) -> Self {
1847 self.offset = Some(Offset { this: n, rows: None });
1848 self
1849 }
1850}
1851
1852impl Default for Select {
1853 fn default() -> Self {
1854 Self::new()
1855 }
1856}
1857
1858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1864#[cfg_attr(feature = "bindings", derive(TS))]
1865pub struct Union {
1866 pub left: Expression,
1868 pub right: Expression,
1870 pub all: bool,
1872 #[serde(default)]
1874 pub distinct: bool,
1875 pub with: Option<With>,
1877 pub order_by: Option<OrderBy>,
1879 pub limit: Option<Box<Expression>>,
1881 pub offset: Option<Box<Expression>>,
1883 #[serde(default, skip_serializing_if = "Option::is_none")]
1885 pub distribute_by: Option<DistributeBy>,
1886 #[serde(default, skip_serializing_if = "Option::is_none")]
1888 pub sort_by: Option<SortBy>,
1889 #[serde(default, skip_serializing_if = "Option::is_none")]
1891 pub cluster_by: Option<ClusterBy>,
1892 #[serde(default)]
1894 pub by_name: bool,
1895 #[serde(default, skip_serializing_if = "Option::is_none")]
1897 pub side: Option<String>,
1898 #[serde(default, skip_serializing_if = "Option::is_none")]
1900 pub kind: Option<String>,
1901 #[serde(default)]
1903 pub corresponding: bool,
1904 #[serde(default)]
1906 pub strict: bool,
1907 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1909 pub on_columns: Vec<Expression>,
1910}
1911
1912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1917#[cfg_attr(feature = "bindings", derive(TS))]
1918pub struct Intersect {
1919 pub left: Expression,
1921 pub right: Expression,
1923 pub all: bool,
1925 #[serde(default)]
1927 pub distinct: bool,
1928 pub with: Option<With>,
1930 pub order_by: Option<OrderBy>,
1932 pub limit: Option<Box<Expression>>,
1934 pub offset: Option<Box<Expression>>,
1936 #[serde(default, skip_serializing_if = "Option::is_none")]
1938 pub distribute_by: Option<DistributeBy>,
1939 #[serde(default, skip_serializing_if = "Option::is_none")]
1941 pub sort_by: Option<SortBy>,
1942 #[serde(default, skip_serializing_if = "Option::is_none")]
1944 pub cluster_by: Option<ClusterBy>,
1945 #[serde(default)]
1947 pub by_name: bool,
1948 #[serde(default, skip_serializing_if = "Option::is_none")]
1950 pub side: Option<String>,
1951 #[serde(default, skip_serializing_if = "Option::is_none")]
1953 pub kind: Option<String>,
1954 #[serde(default)]
1956 pub corresponding: bool,
1957 #[serde(default)]
1959 pub strict: bool,
1960 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1962 pub on_columns: Vec<Expression>,
1963}
1964
1965#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1970#[cfg_attr(feature = "bindings", derive(TS))]
1971pub struct Except {
1972 pub left: Expression,
1974 pub right: Expression,
1976 pub all: bool,
1978 #[serde(default)]
1980 pub distinct: bool,
1981 pub with: Option<With>,
1983 pub order_by: Option<OrderBy>,
1985 pub limit: Option<Box<Expression>>,
1987 pub offset: Option<Box<Expression>>,
1989 #[serde(default, skip_serializing_if = "Option::is_none")]
1991 pub distribute_by: Option<DistributeBy>,
1992 #[serde(default, skip_serializing_if = "Option::is_none")]
1994 pub sort_by: Option<SortBy>,
1995 #[serde(default, skip_serializing_if = "Option::is_none")]
1997 pub cluster_by: Option<ClusterBy>,
1998 #[serde(default)]
2000 pub by_name: bool,
2001 #[serde(default, skip_serializing_if = "Option::is_none")]
2003 pub side: Option<String>,
2004 #[serde(default, skip_serializing_if = "Option::is_none")]
2006 pub kind: Option<String>,
2007 #[serde(default)]
2009 pub corresponding: bool,
2010 #[serde(default)]
2012 pub strict: bool,
2013 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2015 pub on_columns: Vec<Expression>,
2016}
2017
2018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2020#[cfg_attr(feature = "bindings", derive(TS))]
2021pub struct SelectInto {
2022 pub this: Expression,
2024 #[serde(default)]
2026 pub temporary: bool,
2027 #[serde(default)]
2029 pub unlogged: bool,
2030 #[serde(default)]
2032 pub bulk_collect: bool,
2033 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2035 pub expressions: Vec<Expression>,
2036}
2037
2038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2048#[cfg_attr(feature = "bindings", derive(TS))]
2049pub struct Subquery {
2050 pub this: Expression,
2052 pub alias: Option<Identifier>,
2054 pub column_aliases: Vec<Identifier>,
2056 pub order_by: Option<OrderBy>,
2058 pub limit: Option<Limit>,
2060 pub offset: Option<Offset>,
2062 #[serde(default, skip_serializing_if = "Option::is_none")]
2064 pub distribute_by: Option<DistributeBy>,
2065 #[serde(default, skip_serializing_if = "Option::is_none")]
2067 pub sort_by: Option<SortBy>,
2068 #[serde(default, skip_serializing_if = "Option::is_none")]
2070 pub cluster_by: Option<ClusterBy>,
2071 #[serde(default)]
2073 pub lateral: bool,
2074 #[serde(default)]
2078 pub modifiers_inside: bool,
2079 #[serde(default)]
2081 pub trailing_comments: Vec<String>,
2082}
2083
2084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2089#[cfg_attr(feature = "bindings", derive(TS))]
2090pub struct PipeOperator {
2091 pub this: Expression,
2093 pub expression: Expression,
2095}
2096
2097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2099#[cfg_attr(feature = "bindings", derive(TS))]
2100pub struct Values {
2101 pub expressions: Vec<Tuple>,
2103 pub alias: Option<Identifier>,
2105 pub column_aliases: Vec<Identifier>,
2107}
2108
2109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2119#[cfg_attr(feature = "bindings", derive(TS))]
2120pub struct Pivot {
2121 pub this: Expression,
2123 #[serde(default)]
2126 pub expressions: Vec<Expression>,
2127 #[serde(default)]
2129 pub fields: Vec<Expression>,
2130 #[serde(default)]
2132 pub using: Vec<Expression>,
2133 #[serde(default)]
2135 pub group: Option<Box<Expression>>,
2136 #[serde(default)]
2138 pub unpivot: bool,
2139 #[serde(default)]
2141 pub into: Option<Box<Expression>>,
2142 #[serde(default)]
2144 pub alias: Option<Identifier>,
2145 #[serde(default)]
2147 pub include_nulls: Option<bool>,
2148 #[serde(default)]
2150 pub default_on_null: Option<Box<Expression>>,
2151 #[serde(default, skip_serializing_if = "Option::is_none")]
2153 pub with: Option<With>,
2154}
2155
2156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2158#[cfg_attr(feature = "bindings", derive(TS))]
2159pub struct Unpivot {
2160 pub this: Expression,
2161 pub value_column: Identifier,
2162 pub name_column: Identifier,
2163 pub columns: Vec<Expression>,
2164 pub alias: Option<Identifier>,
2165 #[serde(default)]
2167 pub value_column_parenthesized: bool,
2168 #[serde(default)]
2170 pub include_nulls: Option<bool>,
2171 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2173 pub extra_value_columns: Vec<Identifier>,
2174}
2175
2176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2179#[cfg_attr(feature = "bindings", derive(TS))]
2180pub struct PivotAlias {
2181 pub this: Expression,
2182 pub alias: Expression,
2183}
2184
2185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2187#[cfg_attr(feature = "bindings", derive(TS))]
2188pub struct PreWhere {
2189 pub this: Expression,
2190}
2191
2192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2194#[cfg_attr(feature = "bindings", derive(TS))]
2195pub struct Stream {
2196 pub this: Expression,
2197 #[serde(skip_serializing_if = "Option::is_none")]
2198 pub on: Option<Expression>,
2199 #[serde(skip_serializing_if = "Option::is_none")]
2200 pub show_initial_rows: Option<bool>,
2201}
2202
2203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2205#[cfg_attr(feature = "bindings", derive(TS))]
2206pub struct UsingData {
2207 pub this: Expression,
2208}
2209
2210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2212#[cfg_attr(feature = "bindings", derive(TS))]
2213pub struct XmlNamespace {
2214 pub this: Expression,
2215 #[serde(skip_serializing_if = "Option::is_none")]
2216 pub alias: Option<Identifier>,
2217}
2218
2219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2221#[cfg_attr(feature = "bindings", derive(TS))]
2222pub struct RowFormat {
2223 pub delimited: bool,
2224 pub fields_terminated_by: Option<String>,
2225 pub collection_items_terminated_by: Option<String>,
2226 pub map_keys_terminated_by: Option<String>,
2227 pub lines_terminated_by: Option<String>,
2228 pub null_defined_as: Option<String>,
2229}
2230
2231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2233#[cfg_attr(feature = "bindings", derive(TS))]
2234pub struct DirectoryInsert {
2235 pub local: bool,
2236 pub path: String,
2237 pub row_format: Option<RowFormat>,
2238 #[serde(default)]
2240 pub stored_as: Option<String>,
2241}
2242
2243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2245#[cfg_attr(feature = "bindings", derive(TS))]
2246pub struct Insert {
2247 pub table: TableRef,
2248 pub columns: Vec<Identifier>,
2249 pub values: Vec<Vec<Expression>>,
2250 pub query: Option<Expression>,
2251 pub overwrite: bool,
2253 pub partition: Vec<(Identifier, Option<Expression>)>,
2255 #[serde(default)]
2257 pub directory: Option<DirectoryInsert>,
2258 #[serde(default)]
2260 pub returning: Vec<Expression>,
2261 #[serde(default)]
2263 pub output: Option<OutputClause>,
2264 #[serde(default)]
2266 pub on_conflict: Option<Box<Expression>>,
2267 #[serde(default)]
2269 pub leading_comments: Vec<String>,
2270 #[serde(default)]
2272 pub if_exists: bool,
2273 #[serde(default)]
2275 pub with: Option<With>,
2276 #[serde(default)]
2278 pub ignore: bool,
2279 #[serde(default)]
2281 pub source_alias: Option<Identifier>,
2282 #[serde(default)]
2284 pub alias: Option<Identifier>,
2285 #[serde(default)]
2287 pub alias_explicit_as: bool,
2288 #[serde(default)]
2290 pub default_values: bool,
2291 #[serde(default)]
2293 pub by_name: bool,
2294 #[serde(default, skip_serializing_if = "Option::is_none")]
2296 pub conflict_action: Option<String>,
2297 #[serde(default)]
2299 pub is_replace: bool,
2300 #[serde(default, skip_serializing_if = "Option::is_none")]
2302 pub hint: Option<Hint>,
2303 #[serde(default)]
2305 pub replace_where: Option<Box<Expression>>,
2306 #[serde(default)]
2308 pub source: Option<Box<Expression>>,
2309 #[serde(default, skip_serializing_if = "Option::is_none")]
2311 pub function_target: Option<Box<Expression>>,
2312 #[serde(default, skip_serializing_if = "Option::is_none")]
2314 pub partition_by: Option<Box<Expression>>,
2315 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2317 pub settings: Vec<Expression>,
2318}
2319
2320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2322#[cfg_attr(feature = "bindings", derive(TS))]
2323pub struct OutputClause {
2324 pub columns: Vec<Expression>,
2326 #[serde(default)]
2328 pub into_table: Option<Expression>,
2329}
2330
2331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2333#[cfg_attr(feature = "bindings", derive(TS))]
2334pub struct Update {
2335 pub table: TableRef,
2336 #[serde(default)]
2338 pub extra_tables: Vec<TableRef>,
2339 #[serde(default)]
2341 pub table_joins: Vec<Join>,
2342 pub set: Vec<(Identifier, Expression)>,
2343 pub from_clause: Option<From>,
2344 #[serde(default)]
2346 pub from_joins: Vec<Join>,
2347 pub where_clause: Option<Where>,
2348 #[serde(default)]
2350 pub returning: Vec<Expression>,
2351 #[serde(default)]
2353 pub output: Option<OutputClause>,
2354 #[serde(default)]
2356 pub with: Option<With>,
2357 #[serde(default)]
2359 pub leading_comments: Vec<String>,
2360 #[serde(default)]
2362 pub limit: Option<Expression>,
2363 #[serde(default)]
2365 pub order_by: Option<OrderBy>,
2366 #[serde(default)]
2368 pub from_before_set: bool,
2369}
2370
2371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2373#[cfg_attr(feature = "bindings", derive(TS))]
2374pub struct Delete {
2375 pub table: TableRef,
2376 #[serde(default, skip_serializing_if = "Option::is_none")]
2378 pub on_cluster: Option<OnCluster>,
2379 pub alias: Option<Identifier>,
2381 #[serde(default)]
2383 pub alias_explicit_as: bool,
2384 pub using: Vec<TableRef>,
2386 pub where_clause: Option<Where>,
2387 #[serde(default)]
2389 pub output: Option<OutputClause>,
2390 #[serde(default)]
2392 pub leading_comments: Vec<String>,
2393 #[serde(default)]
2395 pub with: Option<With>,
2396 #[serde(default)]
2398 pub limit: Option<Expression>,
2399 #[serde(default)]
2401 pub order_by: Option<OrderBy>,
2402 #[serde(default)]
2404 pub returning: Vec<Expression>,
2405 #[serde(default)]
2408 pub tables: Vec<TableRef>,
2409 #[serde(default)]
2412 pub tables_from_using: bool,
2413 #[serde(default)]
2415 pub joins: Vec<Join>,
2416 #[serde(default)]
2418 pub force_index: Option<String>,
2419 #[serde(default)]
2421 pub no_from: bool,
2422}
2423
2424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2426#[cfg_attr(feature = "bindings", derive(TS))]
2427pub struct CopyStmt {
2428 pub this: Expression,
2430 pub kind: bool,
2432 pub files: Vec<Expression>,
2434 #[serde(default)]
2436 pub params: Vec<CopyParameter>,
2437 #[serde(default)]
2439 pub credentials: Option<Box<Credentials>>,
2440 #[serde(default)]
2442 pub is_into: bool,
2443 #[serde(default)]
2445 pub with_wrapped: bool,
2446}
2447
2448#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2450#[cfg_attr(feature = "bindings", derive(TS))]
2451pub struct CopyParameter {
2452 pub name: String,
2453 pub value: Option<Expression>,
2454 pub values: Vec<Expression>,
2455 #[serde(default)]
2457 pub eq: bool,
2458}
2459
2460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2462#[cfg_attr(feature = "bindings", derive(TS))]
2463pub struct Credentials {
2464 pub credentials: Vec<(String, String)>,
2465 pub encryption: Option<String>,
2466 pub storage: Option<String>,
2467}
2468
2469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2471#[cfg_attr(feature = "bindings", derive(TS))]
2472pub struct PutStmt {
2473 pub source: String,
2475 #[serde(default)]
2477 pub source_quoted: bool,
2478 pub target: Expression,
2480 #[serde(default)]
2482 pub params: Vec<CopyParameter>,
2483}
2484
2485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2487#[cfg_attr(feature = "bindings", derive(TS))]
2488pub struct StageReference {
2489 pub name: String,
2491 #[serde(default)]
2493 pub path: Option<String>,
2494 #[serde(default)]
2496 pub file_format: Option<Expression>,
2497 #[serde(default)]
2499 pub pattern: Option<String>,
2500 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2502 pub quoted: bool,
2503}
2504
2505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2507#[cfg_attr(feature = "bindings", derive(TS))]
2508pub struct HistoricalData {
2509 pub this: Box<Expression>,
2511 pub kind: String,
2513 pub expression: Box<Expression>,
2515}
2516
2517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2522#[cfg_attr(feature = "bindings", derive(TS))]
2523pub struct Alias {
2524 pub this: Expression,
2526 pub alias: Identifier,
2528 #[serde(default)]
2530 pub column_aliases: Vec<Identifier>,
2531 #[serde(default)]
2533 pub pre_alias_comments: Vec<String>,
2534 #[serde(default)]
2536 pub trailing_comments: Vec<String>,
2537}
2538
2539impl Alias {
2540 pub fn new(this: Expression, alias: Identifier) -> Self {
2542 Self {
2543 this,
2544 alias,
2545 column_aliases: Vec::new(),
2546 pre_alias_comments: Vec::new(),
2547 trailing_comments: Vec::new(),
2548 }
2549 }
2550
2551 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
2553 Self {
2554 this,
2555 alias: Identifier::empty(),
2556 column_aliases,
2557 pre_alias_comments: Vec::new(),
2558 trailing_comments: Vec::new(),
2559 }
2560 }
2561}
2562
2563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2570#[cfg_attr(feature = "bindings", derive(TS))]
2571pub struct Cast {
2572 pub this: Expression,
2574 pub to: DataType,
2576 #[serde(default)]
2577 pub trailing_comments: Vec<String>,
2578 #[serde(default)]
2580 pub double_colon_syntax: bool,
2581 #[serde(skip_serializing_if = "Option::is_none", default)]
2583 pub format: Option<Box<Expression>>,
2584 #[serde(skip_serializing_if = "Option::is_none", default)]
2586 pub default: Option<Box<Expression>>,
2587}
2588
2589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2591#[cfg_attr(feature = "bindings", derive(TS))]
2592pub struct CollationExpr {
2593 pub this: Expression,
2594 pub collation: String,
2595 #[serde(default)]
2597 pub quoted: bool,
2598 #[serde(default)]
2600 pub double_quoted: bool,
2601}
2602
2603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2609#[cfg_attr(feature = "bindings", derive(TS))]
2610pub struct Case {
2611 pub operand: Option<Expression>,
2613 pub whens: Vec<(Expression, Expression)>,
2615 pub else_: Option<Expression>,
2617}
2618
2619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2627#[cfg_attr(feature = "bindings", derive(TS))]
2628pub struct BinaryOp {
2629 pub left: Expression,
2630 pub right: Expression,
2631 #[serde(default)]
2633 pub left_comments: Vec<String>,
2634 #[serde(default)]
2636 pub operator_comments: Vec<String>,
2637 #[serde(default)]
2639 pub trailing_comments: Vec<String>,
2640}
2641
2642impl BinaryOp {
2643 pub fn new(left: Expression, right: Expression) -> Self {
2644 Self {
2645 left,
2646 right,
2647 left_comments: Vec::new(),
2648 operator_comments: Vec::new(),
2649 trailing_comments: Vec::new(),
2650 }
2651 }
2652}
2653
2654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2656#[cfg_attr(feature = "bindings", derive(TS))]
2657pub struct LikeOp {
2658 pub left: Expression,
2659 pub right: Expression,
2660 #[serde(default)]
2662 pub escape: Option<Expression>,
2663 #[serde(default)]
2665 pub quantifier: Option<String>,
2666}
2667
2668impl LikeOp {
2669 pub fn new(left: Expression, right: Expression) -> Self {
2670 Self {
2671 left,
2672 right,
2673 escape: None,
2674 quantifier: None,
2675 }
2676 }
2677
2678 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
2679 Self {
2680 left,
2681 right,
2682 escape: Some(escape),
2683 quantifier: None,
2684 }
2685 }
2686}
2687
2688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2692#[cfg_attr(feature = "bindings", derive(TS))]
2693pub struct UnaryOp {
2694 pub this: Expression,
2696}
2697
2698impl UnaryOp {
2699 pub fn new(this: Expression) -> Self {
2700 Self { this }
2701 }
2702}
2703
2704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2709#[cfg_attr(feature = "bindings", derive(TS))]
2710pub struct In {
2711 pub this: Expression,
2713 pub expressions: Vec<Expression>,
2715 pub query: Option<Expression>,
2717 pub not: bool,
2719 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2720 pub global: bool,
2721 #[serde(default, skip_serializing_if = "Option::is_none")]
2723 pub unnest: Option<Box<Expression>>,
2724}
2725
2726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2728#[cfg_attr(feature = "bindings", derive(TS))]
2729pub struct Between {
2730 pub this: Expression,
2732 pub low: Expression,
2734 pub high: Expression,
2736 pub not: bool,
2738}
2739
2740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2742#[cfg_attr(feature = "bindings", derive(TS))]
2743pub struct IsNull {
2744 pub this: Expression,
2745 pub not: bool,
2746 #[serde(default)]
2748 pub postfix_form: bool,
2749}
2750
2751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2753#[cfg_attr(feature = "bindings", derive(TS))]
2754pub struct IsTrueFalse {
2755 pub this: Expression,
2756 pub not: bool,
2757}
2758
2759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2762#[cfg_attr(feature = "bindings", derive(TS))]
2763pub struct IsJson {
2764 pub this: Expression,
2765 pub json_type: Option<String>,
2767 pub unique_keys: Option<JsonUniqueKeys>,
2769 pub negated: bool,
2771}
2772
2773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2775#[cfg_attr(feature = "bindings", derive(TS))]
2776pub enum JsonUniqueKeys {
2777 With,
2779 Without,
2781 Shorthand,
2783}
2784
2785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2787#[cfg_attr(feature = "bindings", derive(TS))]
2788pub struct Exists {
2789 pub this: Expression,
2791 pub not: bool,
2793}
2794
2795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2802#[cfg_attr(feature = "bindings", derive(TS))]
2803pub struct Function {
2804 pub name: String,
2806 pub args: Vec<Expression>,
2808 pub distinct: bool,
2810 #[serde(default)]
2811 pub trailing_comments: Vec<String>,
2812 #[serde(default)]
2814 pub use_bracket_syntax: bool,
2815 #[serde(default)]
2817 pub no_parens: bool,
2818 #[serde(default)]
2820 pub quoted: bool,
2821}
2822
2823impl Default for Function {
2824 fn default() -> Self {
2825 Self {
2826 name: String::new(),
2827 args: Vec::new(),
2828 distinct: false,
2829 trailing_comments: Vec::new(),
2830 use_bracket_syntax: false,
2831 no_parens: false,
2832 quoted: false,
2833 }
2834 }
2835}
2836
2837impl Function {
2838 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
2839 Self {
2840 name: name.into(),
2841 args,
2842 distinct: false,
2843 trailing_comments: Vec::new(),
2844 use_bracket_syntax: false,
2845 no_parens: false,
2846 quoted: false,
2847 }
2848 }
2849}
2850
2851#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
2858#[cfg_attr(feature = "bindings", derive(TS))]
2859pub struct AggregateFunction {
2860 pub name: String,
2862 pub args: Vec<Expression>,
2864 pub distinct: bool,
2866 pub filter: Option<Expression>,
2868 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2870 pub order_by: Vec<Ordered>,
2871 #[serde(default, skip_serializing_if = "Option::is_none")]
2873 pub limit: Option<Box<Expression>>,
2874 #[serde(default, skip_serializing_if = "Option::is_none")]
2876 pub ignore_nulls: Option<bool>,
2877}
2878
2879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2886#[cfg_attr(feature = "bindings", derive(TS))]
2887pub struct WindowFunction {
2888 pub this: Expression,
2890 pub over: Over,
2892 #[serde(default, skip_serializing_if = "Option::is_none")]
2894 pub keep: Option<Keep>,
2895}
2896
2897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2900#[cfg_attr(feature = "bindings", derive(TS))]
2901pub struct Keep {
2902 pub first: bool,
2904 pub order_by: Vec<Ordered>,
2906}
2907
2908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2910#[cfg_attr(feature = "bindings", derive(TS))]
2911pub struct WithinGroup {
2912 pub this: Expression,
2914 pub order_by: Vec<Ordered>,
2916}
2917
2918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2923#[cfg_attr(feature = "bindings", derive(TS))]
2924pub struct From {
2925 pub expressions: Vec<Expression>,
2927}
2928
2929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2935#[cfg_attr(feature = "bindings", derive(TS))]
2936pub struct Join {
2937 pub this: Expression,
2939 pub on: Option<Expression>,
2941 pub using: Vec<Identifier>,
2943 pub kind: JoinKind,
2945 pub use_inner_keyword: bool,
2947 pub use_outer_keyword: bool,
2949 pub deferred_condition: bool,
2951 #[serde(default, skip_serializing_if = "Option::is_none")]
2953 pub join_hint: Option<String>,
2954 #[serde(default, skip_serializing_if = "Option::is_none")]
2956 pub match_condition: Option<Expression>,
2957 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2959 pub pivots: Vec<Expression>,
2960}
2961
2962#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2969#[cfg_attr(feature = "bindings", derive(TS))]
2970pub enum JoinKind {
2971 Inner,
2972 Left,
2973 Right,
2974 Full,
2975 Outer, Cross,
2977 Natural,
2978 NaturalLeft,
2979 NaturalRight,
2980 NaturalFull,
2981 Semi,
2982 Anti,
2983 LeftSemi,
2985 LeftAnti,
2986 RightSemi,
2987 RightAnti,
2988 CrossApply,
2990 OuterApply,
2991 AsOf,
2993 AsOfLeft,
2994 AsOfRight,
2995 Lateral,
2997 LeftLateral,
2998 Straight,
3000 Implicit,
3002 Array,
3004 LeftArray,
3005}
3006
3007impl Default for JoinKind {
3008 fn default() -> Self {
3009 JoinKind::Inner
3010 }
3011}
3012
3013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3016#[cfg_attr(feature = "bindings", derive(TS))]
3017pub struct JoinedTable {
3018 pub left: Expression,
3020 pub joins: Vec<Join>,
3022 pub lateral_views: Vec<LateralView>,
3024 pub alias: Option<Identifier>,
3026}
3027
3028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3030#[cfg_attr(feature = "bindings", derive(TS))]
3031pub struct Where {
3032 pub this: Expression,
3034}
3035
3036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3041#[cfg_attr(feature = "bindings", derive(TS))]
3042pub struct GroupBy {
3043 pub expressions: Vec<Expression>,
3045 #[serde(default)]
3047 pub all: Option<bool>,
3048 #[serde(default)]
3050 pub totals: bool,
3051}
3052
3053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3055#[cfg_attr(feature = "bindings", derive(TS))]
3056pub struct Having {
3057 pub this: Expression,
3059}
3060
3061#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3063#[cfg_attr(feature = "bindings", derive(TS))]
3064pub struct OrderBy {
3065 pub expressions: Vec<Ordered>,
3067 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3069 pub siblings: bool,
3070}
3071
3072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3079#[cfg_attr(feature = "bindings", derive(TS))]
3080pub struct Ordered {
3081 pub this: Expression,
3083 pub desc: bool,
3085 pub nulls_first: Option<bool>,
3087 #[serde(default)]
3089 pub explicit_asc: bool,
3090 #[serde(default, skip_serializing_if = "Option::is_none")]
3092 pub with_fill: Option<Box<WithFill>>,
3093}
3094
3095impl Ordered {
3096 pub fn asc(expr: Expression) -> Self {
3097 Self {
3098 this: expr,
3099 desc: false,
3100 nulls_first: None,
3101 explicit_asc: false,
3102 with_fill: None,
3103 }
3104 }
3105
3106 pub fn desc(expr: Expression) -> Self {
3107 Self {
3108 this: expr,
3109 desc: true,
3110 nulls_first: None,
3111 explicit_asc: false,
3112 with_fill: None,
3113 }
3114 }
3115}
3116
3117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3120#[cfg_attr(feature = "bindings", derive(TS))]
3121#[cfg_attr(feature = "bindings", ts(export))]
3122pub struct DistributeBy {
3123 pub expressions: Vec<Expression>,
3124}
3125
3126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3129#[cfg_attr(feature = "bindings", derive(TS))]
3130#[cfg_attr(feature = "bindings", ts(export))]
3131pub struct ClusterBy {
3132 pub expressions: Vec<Ordered>,
3133}
3134
3135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3138#[cfg_attr(feature = "bindings", derive(TS))]
3139#[cfg_attr(feature = "bindings", ts(export))]
3140pub struct SortBy {
3141 pub expressions: Vec<Ordered>,
3142}
3143
3144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3147#[cfg_attr(feature = "bindings", derive(TS))]
3148#[cfg_attr(feature = "bindings", ts(export))]
3149pub struct LateralView {
3150 pub this: Expression,
3152 pub table_alias: Option<Identifier>,
3154 pub column_aliases: Vec<Identifier>,
3156 pub outer: bool,
3158}
3159
3160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3162#[cfg_attr(feature = "bindings", derive(TS))]
3163#[cfg_attr(feature = "bindings", ts(export))]
3164pub struct Hint {
3165 pub expressions: Vec<HintExpression>,
3166}
3167
3168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3170#[cfg_attr(feature = "bindings", derive(TS))]
3171#[cfg_attr(feature = "bindings", ts(export))]
3172pub enum HintExpression {
3173 Function { name: String, args: Vec<Expression> },
3175 Identifier(String),
3177 Raw(String),
3179}
3180
3181#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3183#[cfg_attr(feature = "bindings", derive(TS))]
3184#[cfg_attr(feature = "bindings", ts(export))]
3185pub enum PseudocolumnType {
3186 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
3193
3194impl PseudocolumnType {
3195 pub fn as_str(&self) -> &'static str {
3196 match self {
3197 PseudocolumnType::Rownum => "ROWNUM",
3198 PseudocolumnType::Rowid => "ROWID",
3199 PseudocolumnType::Level => "LEVEL",
3200 PseudocolumnType::Sysdate => "SYSDATE",
3201 PseudocolumnType::ObjectId => "OBJECT_ID",
3202 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
3203 }
3204 }
3205
3206 pub fn from_str(s: &str) -> Option<Self> {
3207 match s.to_uppercase().as_str() {
3208 "ROWNUM" => Some(PseudocolumnType::Rownum),
3209 "ROWID" => Some(PseudocolumnType::Rowid),
3210 "LEVEL" => Some(PseudocolumnType::Level),
3211 "SYSDATE" => Some(PseudocolumnType::Sysdate),
3212 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
3213 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
3214 _ => None,
3215 }
3216 }
3217}
3218
3219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3222#[cfg_attr(feature = "bindings", derive(TS))]
3223#[cfg_attr(feature = "bindings", ts(export))]
3224pub struct Pseudocolumn {
3225 pub kind: PseudocolumnType,
3226}
3227
3228impl Pseudocolumn {
3229 pub fn rownum() -> Self {
3230 Self { kind: PseudocolumnType::Rownum }
3231 }
3232
3233 pub fn rowid() -> Self {
3234 Self { kind: PseudocolumnType::Rowid }
3235 }
3236
3237 pub fn level() -> Self {
3238 Self { kind: PseudocolumnType::Level }
3239 }
3240}
3241
3242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3244#[cfg_attr(feature = "bindings", derive(TS))]
3245#[cfg_attr(feature = "bindings", ts(export))]
3246pub struct Connect {
3247 pub start: Option<Expression>,
3249 pub connect: Expression,
3251 pub nocycle: bool,
3253}
3254
3255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3257#[cfg_attr(feature = "bindings", derive(TS))]
3258#[cfg_attr(feature = "bindings", ts(export))]
3259pub struct Prior {
3260 pub this: Expression,
3261}
3262
3263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3265#[cfg_attr(feature = "bindings", derive(TS))]
3266#[cfg_attr(feature = "bindings", ts(export))]
3267pub struct ConnectByRoot {
3268 pub this: Expression,
3269}
3270
3271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3273#[cfg_attr(feature = "bindings", derive(TS))]
3274#[cfg_attr(feature = "bindings", ts(export))]
3275pub struct MatchRecognize {
3276 pub this: Option<Box<Expression>>,
3278 pub partition_by: Option<Vec<Expression>>,
3280 pub order_by: Option<Vec<Ordered>>,
3282 pub measures: Option<Vec<MatchRecognizeMeasure>>,
3284 pub rows: Option<MatchRecognizeRows>,
3286 pub after: Option<MatchRecognizeAfter>,
3288 pub pattern: Option<String>,
3290 pub define: Option<Vec<(Identifier, Expression)>>,
3292 pub alias: Option<Identifier>,
3294 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3296 pub alias_explicit_as: bool,
3297}
3298
3299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3301#[cfg_attr(feature = "bindings", derive(TS))]
3302#[cfg_attr(feature = "bindings", ts(export))]
3303pub struct MatchRecognizeMeasure {
3304 pub this: Expression,
3306 pub window_frame: Option<MatchRecognizeSemantics>,
3308}
3309
3310#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3312#[cfg_attr(feature = "bindings", derive(TS))]
3313#[cfg_attr(feature = "bindings", ts(export))]
3314pub enum MatchRecognizeSemantics {
3315 Running,
3316 Final,
3317}
3318
3319#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3321#[cfg_attr(feature = "bindings", derive(TS))]
3322#[cfg_attr(feature = "bindings", ts(export))]
3323pub enum MatchRecognizeRows {
3324 OneRowPerMatch,
3325 AllRowsPerMatch,
3326 AllRowsPerMatchShowEmptyMatches,
3327 AllRowsPerMatchOmitEmptyMatches,
3328 AllRowsPerMatchWithUnmatchedRows,
3329}
3330
3331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3333#[cfg_attr(feature = "bindings", derive(TS))]
3334#[cfg_attr(feature = "bindings", ts(export))]
3335pub enum MatchRecognizeAfter {
3336 PastLastRow,
3337 ToNextRow,
3338 ToFirst(Identifier),
3339 ToLast(Identifier),
3340}
3341
3342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3344#[cfg_attr(feature = "bindings", derive(TS))]
3345pub struct Limit {
3346 pub this: Expression,
3348 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3350 pub percent: bool,
3351}
3352
3353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3355#[cfg_attr(feature = "bindings", derive(TS))]
3356pub struct Offset {
3357 pub this: Expression,
3358 #[serde(skip_serializing_if = "Option::is_none", default)]
3360 pub rows: Option<bool>,
3361}
3362
3363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3365#[cfg_attr(feature = "bindings", derive(TS))]
3366pub struct Top {
3367 pub this: Expression,
3368 pub percent: bool,
3369 pub with_ties: bool,
3370 #[serde(default)]
3372 pub parenthesized: bool,
3373}
3374
3375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3377#[cfg_attr(feature = "bindings", derive(TS))]
3378pub struct Fetch {
3379 pub direction: String,
3381 pub count: Option<Expression>,
3383 pub percent: bool,
3385 pub rows: bool,
3387 pub with_ties: bool,
3389}
3390
3391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3397#[cfg_attr(feature = "bindings", derive(TS))]
3398pub struct Qualify {
3399 pub this: Expression,
3401}
3402
3403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3405#[cfg_attr(feature = "bindings", derive(TS))]
3406pub struct Sample {
3407 pub method: SampleMethod,
3408 pub size: Expression,
3409 pub seed: Option<Expression>,
3410 #[serde(default)]
3412 pub offset: Option<Expression>,
3413 pub unit_after_size: bool,
3415 #[serde(default)]
3417 pub use_sample_keyword: bool,
3418 #[serde(default)]
3420 pub explicit_method: bool,
3421 #[serde(default)]
3423 pub method_before_size: bool,
3424 #[serde(default)]
3426 pub use_seed_keyword: bool,
3427 pub bucket_numerator: Option<Box<Expression>>,
3429 pub bucket_denominator: Option<Box<Expression>>,
3431 pub bucket_field: Option<Box<Expression>>,
3433 #[serde(default)]
3435 pub is_using_sample: bool,
3436 #[serde(default)]
3438 pub is_percent: bool,
3439 #[serde(default)]
3441 pub suppress_method_output: bool,
3442}
3443
3444#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3446#[cfg_attr(feature = "bindings", derive(TS))]
3447pub enum SampleMethod {
3448 Bernoulli,
3449 System,
3450 Block,
3451 Row,
3452 Percent,
3453 Bucket,
3455 Reservoir,
3457}
3458
3459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3461#[cfg_attr(feature = "bindings", derive(TS))]
3462pub struct NamedWindow {
3463 pub name: Identifier,
3464 pub spec: Over,
3465}
3466
3467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3473#[cfg_attr(feature = "bindings", derive(TS))]
3474pub struct With {
3475 pub ctes: Vec<Cte>,
3477 pub recursive: bool,
3479 #[serde(default)]
3481 pub leading_comments: Vec<String>,
3482 #[serde(default, skip_serializing_if = "Option::is_none")]
3484 pub search: Option<Box<Expression>>,
3485}
3486
3487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3494#[cfg_attr(feature = "bindings", derive(TS))]
3495pub struct Cte {
3496 pub alias: Identifier,
3498 pub this: Expression,
3500 pub columns: Vec<Identifier>,
3502 pub materialized: Option<bool>,
3504 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3506 pub key_expressions: Vec<Identifier>,
3507 #[serde(default)]
3509 pub alias_first: bool,
3510}
3511
3512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3514#[cfg_attr(feature = "bindings", derive(TS))]
3515pub struct WindowSpec {
3516 pub partition_by: Vec<Expression>,
3517 pub order_by: Vec<Ordered>,
3518 pub frame: Option<WindowFrame>,
3519}
3520
3521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3523#[cfg_attr(feature = "bindings", derive(TS))]
3524pub struct Over {
3525 pub window_name: Option<Identifier>,
3527 pub partition_by: Vec<Expression>,
3528 pub order_by: Vec<Ordered>,
3529 pub frame: Option<WindowFrame>,
3530 pub alias: Option<Identifier>,
3531}
3532
3533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3535#[cfg_attr(feature = "bindings", derive(TS))]
3536pub struct WindowFrame {
3537 pub kind: WindowFrameKind,
3538 pub start: WindowFrameBound,
3539 pub end: Option<WindowFrameBound>,
3540 pub exclude: Option<WindowFrameExclude>,
3541 #[serde(default, skip_serializing_if = "Option::is_none")]
3543 pub kind_text: Option<String>,
3544 #[serde(default, skip_serializing_if = "Option::is_none")]
3546 pub start_side_text: Option<String>,
3547 #[serde(default, skip_serializing_if = "Option::is_none")]
3549 pub end_side_text: Option<String>,
3550}
3551
3552#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3553#[cfg_attr(feature = "bindings", derive(TS))]
3554pub enum WindowFrameKind {
3555 Rows,
3556 Range,
3557 Groups,
3558}
3559
3560#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3562#[cfg_attr(feature = "bindings", derive(TS))]
3563pub enum WindowFrameExclude {
3564 CurrentRow,
3565 Group,
3566 Ties,
3567 NoOthers,
3568}
3569
3570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3571#[cfg_attr(feature = "bindings", derive(TS))]
3572pub enum WindowFrameBound {
3573 CurrentRow,
3574 UnboundedPreceding,
3575 UnboundedFollowing,
3576 Preceding(Box<Expression>),
3577 Following(Box<Expression>),
3578 BarePreceding,
3580 BareFollowing,
3582 Value(Box<Expression>),
3584}
3585
3586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3588#[cfg_attr(feature = "bindings", derive(TS))]
3589pub struct StructField {
3590 pub name: String,
3591 pub data_type: DataType,
3592 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3593 pub options: Vec<Expression>,
3594 #[serde(default, skip_serializing_if = "Option::is_none")]
3595 pub comment: Option<String>,
3596}
3597
3598impl StructField {
3599 pub fn new(name: String, data_type: DataType) -> Self {
3601 Self { name, data_type, options: Vec::new(), comment: None }
3602 }
3603
3604 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
3606 Self { name, data_type, options, comment: None }
3607 }
3608
3609 pub fn with_options_and_comment(name: String, data_type: DataType, options: Vec<Expression>, comment: Option<String>) -> Self {
3611 Self { name, data_type, options, comment }
3612 }
3613}
3614
3615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3627#[cfg_attr(feature = "bindings", derive(TS))]
3628#[serde(tag = "data_type", rename_all = "snake_case")]
3629pub enum DataType {
3630 Boolean,
3632 TinyInt { length: Option<u32> },
3633 SmallInt { length: Option<u32> },
3634 Int { length: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] integer_spelling: bool },
3638 BigInt { length: Option<u32> },
3639 Float { precision: Option<u32>, scale: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] real_spelling: bool },
3643 Double { precision: Option<u32>, scale: Option<u32> },
3644 Decimal { precision: Option<u32>, scale: Option<u32> },
3645
3646 Char { length: Option<u32> },
3648 VarChar { length: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] parenthesized_length: bool },
3651 String { length: Option<u32> },
3653 Text,
3654
3655 Binary { length: Option<u32> },
3657 VarBinary { length: Option<u32> },
3658 Blob,
3659
3660 Bit { length: Option<u32> },
3662 VarBit { length: Option<u32> },
3663
3664 Date,
3666 Time { precision: Option<u32>, #[serde(default)] timezone: bool },
3667 Timestamp { precision: Option<u32>, timezone: bool },
3668 Interval {
3669 unit: Option<String>,
3670 #[serde(default, skip_serializing_if = "Option::is_none")]
3672 to: Option<String>,
3673 },
3674
3675 Json,
3677 JsonB,
3678
3679 Uuid,
3681
3682 Array {
3684 element_type: Box<DataType>,
3685 #[serde(default, skip_serializing_if = "Option::is_none")]
3687 dimension: Option<u32>,
3688 },
3689
3690 List {
3693 element_type: Box<DataType>,
3694 },
3695
3696 Struct { fields: Vec<StructField>, nested: bool },
3700 Map { key_type: Box<DataType>, value_type: Box<DataType> },
3701
3702 Enum { values: Vec<String>, #[serde(default, skip_serializing_if = "Vec::is_empty")] assignments: Vec<Option<String>> },
3704
3705 Set { values: Vec<String> },
3707
3708 Union { fields: Vec<(String, DataType)> },
3710
3711 Vector { #[serde(default)] element_type: Option<Box<DataType>>, dimension: Option<u32> },
3713
3714 Object { fields: Vec<(String, DataType, bool)>, modifier: Option<String> },
3717
3718 Nullable { inner: Box<DataType> },
3720
3721 Custom { name: String },
3723
3724 Geometry {
3726 subtype: Option<String>,
3727 srid: Option<u32>,
3728 },
3729 Geography {
3730 subtype: Option<String>,
3731 srid: Option<u32>,
3732 },
3733
3734 CharacterSet { name: String },
3737
3738 Unknown,
3740}
3741
3742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3744#[cfg_attr(feature = "bindings", derive(TS))]
3745#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
3746pub struct Array {
3747 pub expressions: Vec<Expression>,
3748}
3749
3750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3752#[cfg_attr(feature = "bindings", derive(TS))]
3753pub struct Struct {
3754 pub fields: Vec<(Option<String>, Expression)>,
3755}
3756
3757#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3759#[cfg_attr(feature = "bindings", derive(TS))]
3760pub struct Tuple {
3761 pub expressions: Vec<Expression>,
3762}
3763
3764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3766#[cfg_attr(feature = "bindings", derive(TS))]
3767pub struct Interval {
3768 pub this: Option<Expression>,
3770 pub unit: Option<IntervalUnitSpec>,
3772}
3773
3774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3776#[cfg_attr(feature = "bindings", derive(TS))]
3777#[serde(tag = "type", rename_all = "snake_case")]
3778pub enum IntervalUnitSpec {
3779 Simple {
3781 unit: IntervalUnit,
3782 use_plural: bool,
3784 },
3785 Span(IntervalSpan),
3787 ExprSpan(IntervalSpanExpr),
3790 Expr(Box<Expression>),
3792}
3793
3794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3796#[cfg_attr(feature = "bindings", derive(TS))]
3797pub struct IntervalSpan {
3798 pub this: IntervalUnit,
3800 pub expression: IntervalUnit,
3802}
3803
3804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3807#[cfg_attr(feature = "bindings", derive(TS))]
3808pub struct IntervalSpanExpr {
3809 pub this: Box<Expression>,
3811 pub expression: Box<Expression>,
3813}
3814
3815#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3816#[cfg_attr(feature = "bindings", derive(TS))]
3817pub enum IntervalUnit {
3818 Year,
3819 Quarter,
3820 Month,
3821 Week,
3822 Day,
3823 Hour,
3824 Minute,
3825 Second,
3826 Millisecond,
3827 Microsecond,
3828}
3829
3830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3832#[cfg_attr(feature = "bindings", derive(TS))]
3833pub struct Command {
3834 pub this: String,
3836}
3837
3838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3841#[cfg_attr(feature = "bindings", derive(TS))]
3842pub struct ExecuteStatement {
3843 pub this: Expression,
3845 #[serde(default)]
3847 pub parameters: Vec<ExecuteParameter>,
3848}
3849
3850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3852#[cfg_attr(feature = "bindings", derive(TS))]
3853pub struct ExecuteParameter {
3854 pub name: String,
3856 pub value: Expression,
3858}
3859
3860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3863#[cfg_attr(feature = "bindings", derive(TS))]
3864pub struct Kill {
3865 pub this: Expression,
3867 pub kind: Option<String>,
3869}
3870
3871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3873#[cfg_attr(feature = "bindings", derive(TS))]
3874pub struct Raw {
3875 pub sql: String,
3876}
3877
3878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3884#[cfg_attr(feature = "bindings", derive(TS))]
3885pub struct UnaryFunc {
3886 pub this: Expression,
3887 #[serde(skip_serializing_if = "Option::is_none", default)]
3889 pub original_name: Option<String>,
3890}
3891
3892impl UnaryFunc {
3893 pub fn new(this: Expression) -> Self {
3895 Self { this, original_name: None }
3896 }
3897
3898 pub fn with_name(this: Expression, name: String) -> Self {
3900 Self { this, original_name: Some(name) }
3901 }
3902}
3903
3904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3908#[cfg_attr(feature = "bindings", derive(TS))]
3909pub struct CharFunc {
3910 pub args: Vec<Expression>,
3911 #[serde(skip_serializing_if = "Option::is_none", default)]
3912 pub charset: Option<String>,
3913 #[serde(skip_serializing_if = "Option::is_none", default)]
3915 pub name: Option<String>,
3916}
3917
3918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3920#[cfg_attr(feature = "bindings", derive(TS))]
3921pub struct BinaryFunc {
3922 pub this: Expression,
3923 pub expression: Expression,
3924 #[serde(skip_serializing_if = "Option::is_none", default)]
3926 pub original_name: Option<String>,
3927}
3928
3929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3931#[cfg_attr(feature = "bindings", derive(TS))]
3932pub struct VarArgFunc {
3933 pub expressions: Vec<Expression>,
3934 #[serde(skip_serializing_if = "Option::is_none", default)]
3936 pub original_name: Option<String>,
3937}
3938
3939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3941#[cfg_attr(feature = "bindings", derive(TS))]
3942pub struct ConcatWs {
3943 pub separator: Expression,
3944 pub expressions: Vec<Expression>,
3945}
3946
3947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3949#[cfg_attr(feature = "bindings", derive(TS))]
3950pub struct SubstringFunc {
3951 pub this: Expression,
3952 pub start: Expression,
3953 pub length: Option<Expression>,
3954 #[serde(default)]
3956 pub from_for_syntax: bool,
3957}
3958
3959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3961#[cfg_attr(feature = "bindings", derive(TS))]
3962pub struct OverlayFunc {
3963 pub this: Expression,
3964 pub replacement: Expression,
3965 pub from: Expression,
3966 pub length: Option<Expression>,
3967}
3968
3969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3971#[cfg_attr(feature = "bindings", derive(TS))]
3972pub struct TrimFunc {
3973 pub this: Expression,
3974 pub characters: Option<Expression>,
3975 pub position: TrimPosition,
3976 #[serde(default)]
3978 pub sql_standard_syntax: bool,
3979 #[serde(default)]
3981 pub position_explicit: bool,
3982}
3983
3984#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3985#[cfg_attr(feature = "bindings", derive(TS))]
3986pub enum TrimPosition {
3987 Both,
3988 Leading,
3989 Trailing,
3990}
3991
3992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3994#[cfg_attr(feature = "bindings", derive(TS))]
3995pub struct ReplaceFunc {
3996 pub this: Expression,
3997 pub old: Expression,
3998 pub new: Expression,
3999}
4000
4001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4003#[cfg_attr(feature = "bindings", derive(TS))]
4004pub struct LeftRightFunc {
4005 pub this: Expression,
4006 pub length: Expression,
4007}
4008
4009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4011#[cfg_attr(feature = "bindings", derive(TS))]
4012pub struct RepeatFunc {
4013 pub this: Expression,
4014 pub times: Expression,
4015}
4016
4017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4019#[cfg_attr(feature = "bindings", derive(TS))]
4020pub struct PadFunc {
4021 pub this: Expression,
4022 pub length: Expression,
4023 pub fill: Option<Expression>,
4024}
4025
4026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4028#[cfg_attr(feature = "bindings", derive(TS))]
4029pub struct SplitFunc {
4030 pub this: Expression,
4031 pub delimiter: Expression,
4032}
4033
4034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4036#[cfg_attr(feature = "bindings", derive(TS))]
4037pub struct RegexpFunc {
4038 pub this: Expression,
4039 pub pattern: Expression,
4040 pub flags: Option<Expression>,
4041}
4042
4043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4045#[cfg_attr(feature = "bindings", derive(TS))]
4046pub struct RegexpReplaceFunc {
4047 pub this: Expression,
4048 pub pattern: Expression,
4049 pub replacement: Expression,
4050 pub flags: Option<Expression>,
4051}
4052
4053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4055#[cfg_attr(feature = "bindings", derive(TS))]
4056pub struct RegexpExtractFunc {
4057 pub this: Expression,
4058 pub pattern: Expression,
4059 pub group: Option<Expression>,
4060}
4061
4062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4064#[cfg_attr(feature = "bindings", derive(TS))]
4065pub struct RoundFunc {
4066 pub this: Expression,
4067 pub decimals: Option<Expression>,
4068}
4069
4070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4072#[cfg_attr(feature = "bindings", derive(TS))]
4073pub struct FloorFunc {
4074 pub this: Expression,
4075 pub scale: Option<Expression>,
4076 #[serde(skip_serializing_if = "Option::is_none", default)]
4078 pub to: Option<Expression>,
4079}
4080
4081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4083#[cfg_attr(feature = "bindings", derive(TS))]
4084pub struct CeilFunc {
4085 pub this: Expression,
4086 #[serde(skip_serializing_if = "Option::is_none", default)]
4087 pub decimals: Option<Expression>,
4088 #[serde(skip_serializing_if = "Option::is_none", default)]
4090 pub to: Option<Expression>,
4091}
4092
4093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4095#[cfg_attr(feature = "bindings", derive(TS))]
4096pub struct LogFunc {
4097 pub this: Expression,
4098 pub base: Option<Expression>,
4099}
4100
4101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4103#[cfg_attr(feature = "bindings", derive(TS))]
4104pub struct CurrentDate;
4105
4106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4108#[cfg_attr(feature = "bindings", derive(TS))]
4109pub struct CurrentTime {
4110 pub precision: Option<u32>,
4111}
4112
4113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4115#[cfg_attr(feature = "bindings", derive(TS))]
4116pub struct CurrentTimestamp {
4117 pub precision: Option<u32>,
4118 #[serde(default)]
4120 pub sysdate: bool,
4121}
4122
4123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4125#[cfg_attr(feature = "bindings", derive(TS))]
4126pub struct CurrentTimestampLTZ {
4127 pub precision: Option<u32>,
4128}
4129
4130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4132#[cfg_attr(feature = "bindings", derive(TS))]
4133pub struct AtTimeZone {
4134 pub this: Expression,
4136 pub zone: Expression,
4138}
4139
4140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4142#[cfg_attr(feature = "bindings", derive(TS))]
4143pub struct DateAddFunc {
4144 pub this: Expression,
4145 pub interval: Expression,
4146 pub unit: IntervalUnit,
4147}
4148
4149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4151#[cfg_attr(feature = "bindings", derive(TS))]
4152pub struct DateDiffFunc {
4153 pub this: Expression,
4154 pub expression: Expression,
4155 pub unit: Option<IntervalUnit>,
4156}
4157
4158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4160#[cfg_attr(feature = "bindings", derive(TS))]
4161pub struct DateTruncFunc {
4162 pub this: Expression,
4163 pub unit: DateTimeField,
4164}
4165
4166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4168#[cfg_attr(feature = "bindings", derive(TS))]
4169pub struct ExtractFunc {
4170 pub this: Expression,
4171 pub field: DateTimeField,
4172}
4173
4174#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4175#[cfg_attr(feature = "bindings", derive(TS))]
4176pub enum DateTimeField {
4177 Year,
4178 Month,
4179 Day,
4180 Hour,
4181 Minute,
4182 Second,
4183 Millisecond,
4184 Microsecond,
4185 DayOfWeek,
4186 DayOfYear,
4187 Week,
4188 WeekWithModifier(String),
4190 Quarter,
4191 Epoch,
4192 Timezone,
4193 TimezoneHour,
4194 TimezoneMinute,
4195 Date,
4196 Time,
4197 Custom(String),
4199}
4200
4201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4203#[cfg_attr(feature = "bindings", derive(TS))]
4204pub struct ToDateFunc {
4205 pub this: Expression,
4206 pub format: Option<Expression>,
4207}
4208
4209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4211#[cfg_attr(feature = "bindings", derive(TS))]
4212pub struct ToTimestampFunc {
4213 pub this: Expression,
4214 pub format: Option<Expression>,
4215}
4216
4217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4219#[cfg_attr(feature = "bindings", derive(TS))]
4220pub struct IfFunc {
4221 pub condition: Expression,
4222 pub true_value: Expression,
4223 pub false_value: Option<Expression>,
4224 #[serde(skip_serializing_if = "Option::is_none", default)]
4226 pub original_name: Option<String>,
4227}
4228
4229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4231#[cfg_attr(feature = "bindings", derive(TS))]
4232pub struct Nvl2Func {
4233 pub this: Expression,
4234 pub true_value: Expression,
4235 pub false_value: Expression,
4236}
4237
4238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4244#[cfg_attr(feature = "bindings", derive(TS))]
4245pub struct AggFunc {
4246 pub this: Expression,
4247 pub distinct: bool,
4248 pub filter: Option<Expression>,
4249 pub order_by: Vec<Ordered>,
4250 #[serde(skip_serializing_if = "Option::is_none", default)]
4252 pub name: Option<String>,
4253 #[serde(skip_serializing_if = "Option::is_none", default)]
4255 pub ignore_nulls: Option<bool>,
4256 #[serde(skip_serializing_if = "Option::is_none", default)]
4259 pub having_max: Option<(Box<Expression>, bool)>,
4260 #[serde(skip_serializing_if = "Option::is_none", default)]
4262 pub limit: Option<Box<Expression>>,
4263}
4264
4265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4267#[cfg_attr(feature = "bindings", derive(TS))]
4268pub struct CountFunc {
4269 pub this: Option<Expression>,
4270 pub star: bool,
4271 pub distinct: bool,
4272 pub filter: Option<Expression>,
4273 #[serde(default, skip_serializing_if = "Option::is_none")]
4275 pub ignore_nulls: Option<bool>,
4276 #[serde(default, skip_serializing_if = "Option::is_none")]
4278 pub original_name: Option<String>,
4279}
4280
4281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4283#[cfg_attr(feature = "bindings", derive(TS))]
4284pub struct GroupConcatFunc {
4285 pub this: Expression,
4286 pub separator: Option<Expression>,
4287 pub order_by: Option<Vec<Ordered>>,
4288 pub distinct: bool,
4289 pub filter: Option<Expression>,
4290}
4291
4292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4294#[cfg_attr(feature = "bindings", derive(TS))]
4295pub struct StringAggFunc {
4296 pub this: Expression,
4297 #[serde(default)]
4298 pub separator: Option<Expression>,
4299 #[serde(default)]
4300 pub order_by: Option<Vec<Ordered>>,
4301 #[serde(default)]
4302 pub distinct: bool,
4303 #[serde(default)]
4304 pub filter: Option<Expression>,
4305 #[serde(default, skip_serializing_if = "Option::is_none")]
4307 pub limit: Option<Box<Expression>>,
4308}
4309
4310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4312#[cfg_attr(feature = "bindings", derive(TS))]
4313pub struct ListAggFunc {
4314 pub this: Expression,
4315 pub separator: Option<Expression>,
4316 pub on_overflow: Option<ListAggOverflow>,
4317 pub order_by: Option<Vec<Ordered>>,
4318 pub distinct: bool,
4319 pub filter: Option<Expression>,
4320}
4321
4322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4324#[cfg_attr(feature = "bindings", derive(TS))]
4325pub enum ListAggOverflow {
4326 Error,
4327 Truncate {
4328 filler: Option<Expression>,
4329 with_count: bool,
4330 },
4331}
4332
4333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4335#[cfg_attr(feature = "bindings", derive(TS))]
4336pub struct SumIfFunc {
4337 pub this: Expression,
4338 pub condition: Expression,
4339 pub filter: Option<Expression>,
4340}
4341
4342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4344#[cfg_attr(feature = "bindings", derive(TS))]
4345pub struct ApproxPercentileFunc {
4346 pub this: Expression,
4347 pub percentile: Expression,
4348 pub accuracy: Option<Expression>,
4349 pub filter: Option<Expression>,
4350}
4351
4352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4354#[cfg_attr(feature = "bindings", derive(TS))]
4355pub struct PercentileFunc {
4356 pub this: Expression,
4357 pub percentile: Expression,
4358 pub order_by: Option<Vec<Ordered>>,
4359 pub filter: Option<Expression>,
4360}
4361
4362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4368#[cfg_attr(feature = "bindings", derive(TS))]
4369pub struct RowNumber;
4370
4371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4373#[cfg_attr(feature = "bindings", derive(TS))]
4374pub struct Rank {
4375 #[serde(default, skip_serializing_if = "Option::is_none")]
4377 pub order_by: Option<Vec<Ordered>>,
4378 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4380 pub args: Vec<Expression>,
4381}
4382
4383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4385#[cfg_attr(feature = "bindings", derive(TS))]
4386pub struct DenseRank {
4387 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4389 pub args: Vec<Expression>,
4390}
4391
4392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4394#[cfg_attr(feature = "bindings", derive(TS))]
4395pub struct NTileFunc {
4396 #[serde(default, skip_serializing_if = "Option::is_none")]
4398 pub num_buckets: Option<Expression>,
4399 #[serde(default, skip_serializing_if = "Option::is_none")]
4401 pub order_by: Option<Vec<Ordered>>,
4402}
4403
4404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4406#[cfg_attr(feature = "bindings", derive(TS))]
4407pub struct LeadLagFunc {
4408 pub this: Expression,
4409 pub offset: Option<Expression>,
4410 pub default: Option<Expression>,
4411 pub ignore_nulls: bool,
4412}
4413
4414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4416#[cfg_attr(feature = "bindings", derive(TS))]
4417pub struct ValueFunc {
4418 pub this: Expression,
4419 #[serde(default, skip_serializing_if = "Option::is_none")]
4421 pub ignore_nulls: Option<bool>,
4422}
4423
4424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4426#[cfg_attr(feature = "bindings", derive(TS))]
4427pub struct NthValueFunc {
4428 pub this: Expression,
4429 pub offset: Expression,
4430 #[serde(default, skip_serializing_if = "Option::is_none")]
4432 pub ignore_nulls: Option<bool>,
4433}
4434
4435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4437#[cfg_attr(feature = "bindings", derive(TS))]
4438pub struct PercentRank {
4439 #[serde(default, skip_serializing_if = "Option::is_none")]
4441 pub order_by: Option<Vec<Ordered>>,
4442 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4444 pub args: Vec<Expression>,
4445}
4446
4447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4449#[cfg_attr(feature = "bindings", derive(TS))]
4450pub struct CumeDist {
4451 #[serde(default, skip_serializing_if = "Option::is_none")]
4453 pub order_by: Option<Vec<Ordered>>,
4454 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4456 pub args: Vec<Expression>,
4457}
4458
4459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4465#[cfg_attr(feature = "bindings", derive(TS))]
4466pub struct PositionFunc {
4467 pub substring: Expression,
4468 pub string: Expression,
4469 pub start: Option<Expression>,
4470}
4471
4472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4478#[cfg_attr(feature = "bindings", derive(TS))]
4479pub struct Random;
4480
4481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4483#[cfg_attr(feature = "bindings", derive(TS))]
4484pub struct Rand {
4485 pub seed: Option<Box<Expression>>,
4486 #[serde(default)]
4488 pub lower: Option<Box<Expression>>,
4489 #[serde(default)]
4491 pub upper: Option<Box<Expression>>,
4492}
4493
4494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4496#[cfg_attr(feature = "bindings", derive(TS))]
4497pub struct TruncateFunc {
4498 pub this: Expression,
4499 pub decimals: Option<Expression>,
4500}
4501
4502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4504#[cfg_attr(feature = "bindings", derive(TS))]
4505pub struct Pi;
4506
4507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4513#[cfg_attr(feature = "bindings", derive(TS))]
4514pub struct DecodeFunc {
4515 pub this: Expression,
4516 pub search_results: Vec<(Expression, Expression)>,
4517 pub default: Option<Expression>,
4518}
4519
4520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4526#[cfg_attr(feature = "bindings", derive(TS))]
4527pub struct DateFormatFunc {
4528 pub this: Expression,
4529 pub format: Expression,
4530}
4531
4532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4534#[cfg_attr(feature = "bindings", derive(TS))]
4535pub struct FromUnixtimeFunc {
4536 pub this: Expression,
4537 pub format: Option<Expression>,
4538}
4539
4540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4542#[cfg_attr(feature = "bindings", derive(TS))]
4543pub struct UnixTimestampFunc {
4544 pub this: Option<Expression>,
4545 pub format: Option<Expression>,
4546}
4547
4548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4550#[cfg_attr(feature = "bindings", derive(TS))]
4551pub struct MakeDateFunc {
4552 pub year: Expression,
4553 pub month: Expression,
4554 pub day: Expression,
4555}
4556
4557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4559#[cfg_attr(feature = "bindings", derive(TS))]
4560pub struct MakeTimestampFunc {
4561 pub year: Expression,
4562 pub month: Expression,
4563 pub day: Expression,
4564 pub hour: Expression,
4565 pub minute: Expression,
4566 pub second: Expression,
4567 pub timezone: Option<Expression>,
4568}
4569
4570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4572#[cfg_attr(feature = "bindings", derive(TS))]
4573pub struct LastDayFunc {
4574 pub this: Expression,
4575 #[serde(skip_serializing_if = "Option::is_none", default)]
4577 pub unit: Option<DateTimeField>,
4578}
4579
4580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4586#[cfg_attr(feature = "bindings", derive(TS))]
4587pub struct ArrayConstructor {
4588 pub expressions: Vec<Expression>,
4589 pub bracket_notation: bool,
4590 pub use_list_keyword: bool,
4592}
4593
4594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4596#[cfg_attr(feature = "bindings", derive(TS))]
4597pub struct ArraySortFunc {
4598 pub this: Expression,
4599 pub comparator: Option<Expression>,
4600 pub desc: bool,
4601 pub nulls_first: Option<bool>,
4602}
4603
4604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4606#[cfg_attr(feature = "bindings", derive(TS))]
4607pub struct ArrayJoinFunc {
4608 pub this: Expression,
4609 pub separator: Expression,
4610 pub null_replacement: Option<Expression>,
4611}
4612
4613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4615#[cfg_attr(feature = "bindings", derive(TS))]
4616pub struct UnnestFunc {
4617 pub this: Expression,
4618 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4620 pub expressions: Vec<Expression>,
4621 pub with_ordinality: bool,
4622 pub alias: Option<Identifier>,
4623 #[serde(default, skip_serializing_if = "Option::is_none")]
4625 pub offset_alias: Option<Identifier>,
4626}
4627
4628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4630#[cfg_attr(feature = "bindings", derive(TS))]
4631pub struct ArrayFilterFunc {
4632 pub this: Expression,
4633 pub filter: Expression,
4634}
4635
4636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4638#[cfg_attr(feature = "bindings", derive(TS))]
4639pub struct ArrayTransformFunc {
4640 pub this: Expression,
4641 pub transform: Expression,
4642}
4643
4644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4646#[cfg_attr(feature = "bindings", derive(TS))]
4647pub struct SequenceFunc {
4648 pub start: Expression,
4649 pub stop: Expression,
4650 pub step: Option<Expression>,
4651}
4652
4653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4659#[cfg_attr(feature = "bindings", derive(TS))]
4660pub struct StructConstructor {
4661 pub fields: Vec<(Option<Identifier>, Expression)>,
4662}
4663
4664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4666#[cfg_attr(feature = "bindings", derive(TS))]
4667pub struct StructExtractFunc {
4668 pub this: Expression,
4669 pub field: Identifier,
4670}
4671
4672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4674#[cfg_attr(feature = "bindings", derive(TS))]
4675pub struct NamedStructFunc {
4676 pub pairs: Vec<(Expression, Expression)>,
4677}
4678
4679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4685#[cfg_attr(feature = "bindings", derive(TS))]
4686pub struct MapConstructor {
4687 pub keys: Vec<Expression>,
4688 pub values: Vec<Expression>,
4689 #[serde(default)]
4691 pub curly_brace_syntax: bool,
4692 #[serde(default)]
4694 pub with_map_keyword: bool,
4695}
4696
4697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4699#[cfg_attr(feature = "bindings", derive(TS))]
4700pub struct TransformFunc {
4701 pub this: Expression,
4702 pub transform: Expression,
4703}
4704
4705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4711#[cfg_attr(feature = "bindings", derive(TS))]
4712pub struct JsonExtractFunc {
4713 pub this: Expression,
4714 pub path: Expression,
4715 pub returning: Option<DataType>,
4716 #[serde(default)]
4718 pub arrow_syntax: bool,
4719 #[serde(default)]
4721 pub hash_arrow_syntax: bool,
4722 #[serde(default)]
4724 pub wrapper_option: Option<String>,
4725 #[serde(default)]
4727 pub quotes_option: Option<String>,
4728 #[serde(default)]
4730 pub on_scalar_string: bool,
4731 #[serde(default)]
4733 pub on_error: Option<String>,
4734}
4735
4736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4738#[cfg_attr(feature = "bindings", derive(TS))]
4739pub struct JsonPathFunc {
4740 pub this: Expression,
4741 pub paths: Vec<Expression>,
4742}
4743
4744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4746#[cfg_attr(feature = "bindings", derive(TS))]
4747pub struct JsonObjectFunc {
4748 pub pairs: Vec<(Expression, Expression)>,
4749 pub null_handling: Option<JsonNullHandling>,
4750 #[serde(default)]
4751 pub with_unique_keys: bool,
4752 #[serde(default)]
4753 pub returning_type: Option<DataType>,
4754 #[serde(default)]
4755 pub format_json: bool,
4756 #[serde(default)]
4757 pub encoding: Option<String>,
4758 #[serde(default)]
4760 pub star: bool,
4761}
4762
4763#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4765#[cfg_attr(feature = "bindings", derive(TS))]
4766pub enum JsonNullHandling {
4767 NullOnNull,
4768 AbsentOnNull,
4769}
4770
4771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4773#[cfg_attr(feature = "bindings", derive(TS))]
4774pub struct JsonModifyFunc {
4775 pub this: Expression,
4776 pub path_values: Vec<(Expression, Expression)>,
4777}
4778
4779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4781#[cfg_attr(feature = "bindings", derive(TS))]
4782pub struct JsonArrayAggFunc {
4783 pub this: Expression,
4784 pub order_by: Option<Vec<Ordered>>,
4785 pub null_handling: Option<JsonNullHandling>,
4786 pub filter: Option<Expression>,
4787}
4788
4789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4791#[cfg_attr(feature = "bindings", derive(TS))]
4792pub struct JsonObjectAggFunc {
4793 pub key: Expression,
4794 pub value: Expression,
4795 pub null_handling: Option<JsonNullHandling>,
4796 pub filter: Option<Expression>,
4797}
4798
4799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4805#[cfg_attr(feature = "bindings", derive(TS))]
4806pub struct ConvertFunc {
4807 pub this: Expression,
4808 pub to: DataType,
4809 pub style: Option<Expression>,
4810}
4811
4812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4818#[cfg_attr(feature = "bindings", derive(TS))]
4819pub struct LambdaExpr {
4820 pub parameters: Vec<Identifier>,
4821 pub body: Expression,
4822 #[serde(default)]
4824 pub colon: bool,
4825 #[serde(default)]
4828 pub parameter_types: Vec<Option<DataType>>,
4829}
4830
4831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4833#[cfg_attr(feature = "bindings", derive(TS))]
4834pub struct Parameter {
4835 pub name: Option<String>,
4836 pub index: Option<u32>,
4837 pub style: ParameterStyle,
4838 #[serde(default)]
4840 pub quoted: bool,
4841 #[serde(default)]
4843 pub expression: Option<String>,
4844}
4845
4846#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4848#[cfg_attr(feature = "bindings", derive(TS))]
4849pub enum ParameterStyle {
4850 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
4860
4861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4863#[cfg_attr(feature = "bindings", derive(TS))]
4864pub struct Placeholder {
4865 pub index: Option<u32>,
4866}
4867
4868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4870#[cfg_attr(feature = "bindings", derive(TS))]
4871pub struct NamedArgument {
4872 pub name: Identifier,
4873 pub value: Expression,
4874 pub separator: NamedArgSeparator,
4876}
4877
4878#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4880#[cfg_attr(feature = "bindings", derive(TS))]
4881pub enum NamedArgSeparator {
4882 DArrow,
4884 ColonEq,
4886 Eq,
4888}
4889
4890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4893#[cfg_attr(feature = "bindings", derive(TS))]
4894pub struct TableArgument {
4895 pub prefix: String,
4897 pub this: Expression,
4899}
4900
4901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4903#[cfg_attr(feature = "bindings", derive(TS))]
4904pub struct SqlComment {
4905 pub text: String,
4906 pub is_block: bool,
4907}
4908
4909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4915#[cfg_attr(feature = "bindings", derive(TS))]
4916pub struct SimilarToExpr {
4917 pub this: Expression,
4918 pub pattern: Expression,
4919 pub escape: Option<Expression>,
4920 pub not: bool,
4921}
4922
4923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4925#[cfg_attr(feature = "bindings", derive(TS))]
4926pub struct QuantifiedExpr {
4927 pub this: Expression,
4928 pub subquery: Expression,
4929 pub op: Option<QuantifiedOp>,
4930}
4931
4932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4934#[cfg_attr(feature = "bindings", derive(TS))]
4935pub enum QuantifiedOp {
4936 Eq,
4937 Neq,
4938 Lt,
4939 Lte,
4940 Gt,
4941 Gte,
4942}
4943
4944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4949#[cfg_attr(feature = "bindings", derive(TS))]
4950pub struct OverlapsExpr {
4951 #[serde(skip_serializing_if = "Option::is_none")]
4953 pub this: Option<Expression>,
4954 #[serde(skip_serializing_if = "Option::is_none")]
4956 pub expression: Option<Expression>,
4957 #[serde(skip_serializing_if = "Option::is_none")]
4959 pub left_start: Option<Expression>,
4960 #[serde(skip_serializing_if = "Option::is_none")]
4962 pub left_end: Option<Expression>,
4963 #[serde(skip_serializing_if = "Option::is_none")]
4965 pub right_start: Option<Expression>,
4966 #[serde(skip_serializing_if = "Option::is_none")]
4968 pub right_end: Option<Expression>,
4969}
4970
4971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4977#[cfg_attr(feature = "bindings", derive(TS))]
4978pub struct Subscript {
4979 pub this: Expression,
4980 pub index: Expression,
4981}
4982
4983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4985#[cfg_attr(feature = "bindings", derive(TS))]
4986pub struct DotAccess {
4987 pub this: Expression,
4988 pub field: Identifier,
4989}
4990
4991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4993#[cfg_attr(feature = "bindings", derive(TS))]
4994pub struct MethodCall {
4995 pub this: Expression,
4996 pub method: Identifier,
4997 pub args: Vec<Expression>,
4998}
4999
5000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5002#[cfg_attr(feature = "bindings", derive(TS))]
5003pub struct ArraySlice {
5004 pub this: Expression,
5005 pub start: Option<Expression>,
5006 pub end: Option<Expression>,
5007}
5008
5009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5015#[cfg_attr(feature = "bindings", derive(TS))]
5016pub enum OnCommit {
5017 PreserveRows,
5019 DeleteRows,
5021}
5022
5023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5025#[cfg_attr(feature = "bindings", derive(TS))]
5026pub struct CreateTable {
5027 pub name: TableRef,
5028 #[serde(default, skip_serializing_if = "Option::is_none")]
5030 pub on_cluster: Option<OnCluster>,
5031 pub columns: Vec<ColumnDef>,
5032 pub constraints: Vec<TableConstraint>,
5033 pub if_not_exists: bool,
5034 pub temporary: bool,
5035 pub or_replace: bool,
5036 #[serde(default, skip_serializing_if = "Option::is_none")]
5038 pub table_modifier: Option<String>,
5039 pub as_select: Option<Expression>,
5040 #[serde(default)]
5042 pub as_select_parenthesized: bool,
5043 #[serde(default)]
5045 pub on_commit: Option<OnCommit>,
5046 #[serde(default)]
5048 pub clone_source: Option<TableRef>,
5049 #[serde(default, skip_serializing_if = "Option::is_none")]
5051 pub clone_at_clause: Option<Expression>,
5052 #[serde(default)]
5054 pub is_copy: bool,
5055 #[serde(default)]
5057 pub shallow_clone: bool,
5058 #[serde(default)]
5060 pub leading_comments: Vec<String>,
5061 #[serde(default)]
5063 pub with_properties: Vec<(String, String)>,
5064 #[serde(default)]
5066 pub teradata_post_name_options: Vec<String>,
5067 #[serde(default)]
5069 pub with_data: Option<bool>,
5070 #[serde(default)]
5072 pub with_statistics: Option<bool>,
5073 #[serde(default)]
5075 pub teradata_indexes: Vec<TeradataIndex>,
5076 #[serde(default)]
5078 pub with_cte: Option<With>,
5079 #[serde(default)]
5081 pub properties: Vec<Expression>,
5082 #[serde(default, skip_serializing_if = "Option::is_none")]
5084 pub partition_of: Option<Expression>,
5085 #[serde(default)]
5087 pub post_table_properties: Vec<Expression>,
5088 #[serde(default)]
5090 pub mysql_table_options: Vec<(String, String)>,
5091 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5093 pub inherits: Vec<TableRef>,
5094 #[serde(default, skip_serializing_if = "Option::is_none")]
5096 pub on_property: Option<OnProperty>,
5097 #[serde(default)]
5099 pub copy_grants: bool,
5100 #[serde(default, skip_serializing_if = "Option::is_none")]
5102 pub using_template: Option<Box<Expression>>,
5103 #[serde(default, skip_serializing_if = "Option::is_none")]
5105 pub rollup: Option<RollupProperty>,
5106}
5107
5108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5110#[cfg_attr(feature = "bindings", derive(TS))]
5111pub struct TeradataIndex {
5112 pub kind: TeradataIndexKind,
5114 pub name: Option<String>,
5116 pub columns: Vec<String>,
5118}
5119
5120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5122#[cfg_attr(feature = "bindings", derive(TS))]
5123pub enum TeradataIndexKind {
5124 NoPrimary,
5126 Primary,
5128 PrimaryAmp,
5130 Unique,
5132 UniquePrimary,
5134 Secondary,
5136}
5137
5138impl CreateTable {
5139 pub fn new(name: impl Into<String>) -> Self {
5140 Self {
5141 name: TableRef::new(name),
5142 on_cluster: None,
5143 columns: Vec::new(),
5144 constraints: Vec::new(),
5145 if_not_exists: false,
5146 temporary: false,
5147 or_replace: false,
5148 table_modifier: None,
5149 as_select: None,
5150 as_select_parenthesized: false,
5151 on_commit: None,
5152 clone_source: None,
5153 clone_at_clause: None,
5154 shallow_clone: false, is_copy: false,
5155 leading_comments: Vec::new(),
5156 with_properties: Vec::new(),
5157 teradata_post_name_options: Vec::new(),
5158 with_data: None,
5159 with_statistics: None,
5160 teradata_indexes: Vec::new(),
5161 with_cte: None,
5162 properties: Vec::new(),
5163 partition_of: None,
5164 post_table_properties: Vec::new(),
5165 mysql_table_options: Vec::new(),
5166 inherits: Vec::new(),
5167 on_property: None,
5168 copy_grants: false,
5169 using_template: None,
5170 rollup: None,
5171 }
5172 }
5173}
5174
5175#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
5177#[cfg_attr(feature = "bindings", derive(TS))]
5178pub enum SortOrder {
5179 Asc,
5180 Desc,
5181}
5182
5183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5185#[cfg_attr(feature = "bindings", derive(TS))]
5186pub enum ConstraintType {
5187 NotNull,
5188 Null,
5189 PrimaryKey,
5190 Unique,
5191 Default,
5192 AutoIncrement,
5193 Collate,
5194 Comment,
5195 References,
5196 Check,
5197 GeneratedAsIdentity,
5198 Tags,
5200 ComputedColumn,
5202 GeneratedAsRow,
5204 OnUpdate,
5206 Path,
5208 Encode,
5210}
5211
5212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5214#[cfg_attr(feature = "bindings", derive(TS))]
5215pub struct ColumnDef {
5216 pub name: Identifier,
5217 pub data_type: DataType,
5218 pub nullable: Option<bool>,
5219 pub default: Option<Expression>,
5220 pub primary_key: bool,
5221 #[serde(default)]
5223 pub primary_key_order: Option<SortOrder>,
5224 pub unique: bool,
5225 #[serde(default)]
5227 pub unique_nulls_not_distinct: bool,
5228 pub auto_increment: bool,
5229 pub comment: Option<String>,
5230 pub constraints: Vec<ColumnConstraint>,
5231 #[serde(default)]
5233 pub constraint_order: Vec<ConstraintType>,
5234 #[serde(default)]
5236 pub format: Option<String>,
5237 #[serde(default)]
5239 pub title: Option<String>,
5240 #[serde(default)]
5242 pub inline_length: Option<u64>,
5243 #[serde(default)]
5245 pub compress: Option<Vec<Expression>>,
5246 #[serde(default)]
5248 pub character_set: Option<String>,
5249 #[serde(default)]
5251 pub uppercase: bool,
5252 #[serde(default)]
5254 pub casespecific: Option<bool>,
5255 #[serde(default)]
5257 pub auto_increment_start: Option<Box<Expression>>,
5258 #[serde(default)]
5260 pub auto_increment_increment: Option<Box<Expression>>,
5261 #[serde(default)]
5263 pub auto_increment_order: Option<bool>,
5264 #[serde(default)]
5266 pub unsigned: bool,
5267 #[serde(default)]
5269 pub zerofill: bool,
5270 #[serde(default, skip_serializing_if = "Option::is_none")]
5272 pub on_update: Option<Expression>,
5273 #[serde(default, skip_serializing_if = "Option::is_none")]
5275 pub unique_constraint_name: Option<String>,
5276 #[serde(default, skip_serializing_if = "Option::is_none")]
5278 pub not_null_constraint_name: Option<String>,
5279 #[serde(default, skip_serializing_if = "Option::is_none")]
5281 pub primary_key_constraint_name: Option<String>,
5282 #[serde(default, skip_serializing_if = "Option::is_none")]
5284 pub check_constraint_name: Option<String>,
5285 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5287 pub options: Vec<Expression>,
5288 #[serde(default)]
5290 pub no_type: bool,
5291 #[serde(default, skip_serializing_if = "Option::is_none")]
5293 pub encoding: Option<String>,
5294 #[serde(default, skip_serializing_if = "Option::is_none")]
5296 pub codec: Option<String>,
5297 #[serde(default, skip_serializing_if = "Option::is_none")]
5299 pub ephemeral: Option<Option<Box<Expression>>>,
5300 #[serde(default, skip_serializing_if = "Option::is_none")]
5302 pub materialized_expr: Option<Box<Expression>>,
5303 #[serde(default, skip_serializing_if = "Option::is_none")]
5305 pub alias_expr: Option<Box<Expression>>,
5306 #[serde(default, skip_serializing_if = "Option::is_none")]
5308 pub ttl_expr: Option<Box<Expression>>,
5309 #[serde(default)]
5311 pub not_for_replication: bool,
5312}
5313
5314impl ColumnDef {
5315 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
5316 Self {
5317 name: Identifier::new(name),
5318 data_type,
5319 nullable: None,
5320 default: None,
5321 primary_key: false,
5322 primary_key_order: None,
5323 unique: false,
5324 unique_nulls_not_distinct: false,
5325 auto_increment: false,
5326 comment: None,
5327 constraints: Vec::new(),
5328 constraint_order: Vec::new(),
5329 format: None,
5330 title: None,
5331 inline_length: None,
5332 compress: None,
5333 character_set: None,
5334 uppercase: false,
5335 casespecific: None,
5336 auto_increment_start: None,
5337 auto_increment_increment: None,
5338 auto_increment_order: None,
5339 unsigned: false,
5340 zerofill: false,
5341 on_update: None,
5342 unique_constraint_name: None,
5343 not_null_constraint_name: None,
5344 primary_key_constraint_name: None,
5345 check_constraint_name: None,
5346 options: Vec::new(),
5347 no_type: false,
5348 encoding: None,
5349 codec: None,
5350 ephemeral: None,
5351 materialized_expr: None,
5352 alias_expr: None,
5353 ttl_expr: None,
5354 not_for_replication: false,
5355 }
5356 }
5357}
5358
5359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5361#[cfg_attr(feature = "bindings", derive(TS))]
5362pub enum ColumnConstraint {
5363 NotNull,
5364 Null,
5365 Unique,
5366 PrimaryKey,
5367 Default(Expression),
5368 Check(Expression),
5369 References(ForeignKeyRef),
5370 GeneratedAsIdentity(GeneratedAsIdentity),
5371 Collate(Identifier),
5372 Comment(String),
5373 Tags(Tags),
5375 ComputedColumn(ComputedColumn),
5378 GeneratedAsRow(GeneratedAsRow),
5380 Path(Expression),
5382}
5383
5384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5386#[cfg_attr(feature = "bindings", derive(TS))]
5387pub struct ComputedColumn {
5388 pub expression: Box<Expression>,
5390 #[serde(default)]
5392 pub persisted: bool,
5393 #[serde(default)]
5395 pub not_null: bool,
5396 #[serde(default)]
5399 pub persistence_kind: Option<String>,
5400 #[serde(default, skip_serializing_if = "Option::is_none")]
5402 pub data_type: Option<DataType>,
5403}
5404
5405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5407#[cfg_attr(feature = "bindings", derive(TS))]
5408pub struct GeneratedAsRow {
5409 pub start: bool,
5411 #[serde(default)]
5413 pub hidden: bool,
5414}
5415
5416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5418#[cfg_attr(feature = "bindings", derive(TS))]
5419pub struct GeneratedAsIdentity {
5420 pub always: bool,
5422 pub on_null: bool,
5424 pub start: Option<Box<Expression>>,
5426 pub increment: Option<Box<Expression>>,
5428 pub minvalue: Option<Box<Expression>>,
5430 pub maxvalue: Option<Box<Expression>>,
5432 pub cycle: Option<bool>,
5434}
5435
5436#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5438#[cfg_attr(feature = "bindings", derive(TS))]
5439pub struct ConstraintModifiers {
5440 pub enforced: Option<bool>,
5442 pub deferrable: Option<bool>,
5444 pub initially_deferred: Option<bool>,
5446 pub norely: bool,
5448 pub rely: bool,
5450 #[serde(default)]
5452 pub using: Option<String>,
5453 #[serde(default)]
5455 pub using_before_columns: bool,
5456 #[serde(default, skip_serializing_if = "Option::is_none")]
5458 pub comment: Option<String>,
5459 #[serde(default, skip_serializing_if = "Option::is_none")]
5461 pub visible: Option<bool>,
5462 #[serde(default, skip_serializing_if = "Option::is_none")]
5464 pub engine_attribute: Option<String>,
5465 #[serde(default, skip_serializing_if = "Option::is_none")]
5467 pub with_parser: Option<String>,
5468 #[serde(default)]
5470 pub not_valid: bool,
5471 #[serde(default, skip_serializing_if = "Option::is_none")]
5473 pub clustered: Option<String>,
5474 #[serde(default, skip_serializing_if = "Option::is_none")]
5476 pub on_conflict: Option<String>,
5477 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5479 pub with_options: Vec<(String, String)>,
5480 #[serde(default, skip_serializing_if = "Option::is_none")]
5482 pub on_filegroup: Option<Identifier>,
5483}
5484
5485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5487#[cfg_attr(feature = "bindings", derive(TS))]
5488pub enum TableConstraint {
5489 PrimaryKey {
5490 name: Option<Identifier>,
5491 columns: Vec<Identifier>,
5492 #[serde(default)]
5494 include_columns: Vec<Identifier>,
5495 #[serde(default)]
5496 modifiers: ConstraintModifiers,
5497 #[serde(default)]
5499 has_constraint_keyword: bool,
5500 },
5501 Unique {
5502 name: Option<Identifier>,
5503 columns: Vec<Identifier>,
5504 #[serde(default)]
5506 columns_parenthesized: bool,
5507 #[serde(default)]
5508 modifiers: ConstraintModifiers,
5509 #[serde(default)]
5511 has_constraint_keyword: bool,
5512 #[serde(default)]
5514 nulls_not_distinct: bool,
5515 },
5516 ForeignKey {
5517 name: Option<Identifier>,
5518 columns: Vec<Identifier>,
5519 #[serde(default)]
5520 references: Option<ForeignKeyRef>,
5521 #[serde(default)]
5523 on_delete: Option<ReferentialAction>,
5524 #[serde(default)]
5526 on_update: Option<ReferentialAction>,
5527 #[serde(default)]
5528 modifiers: ConstraintModifiers,
5529 },
5530 Check {
5531 name: Option<Identifier>,
5532 expression: Expression,
5533 #[serde(default)]
5534 modifiers: ConstraintModifiers,
5535 },
5536 Index {
5538 name: Option<Identifier>,
5539 columns: Vec<Identifier>,
5540 #[serde(default)]
5542 kind: Option<String>,
5543 #[serde(default)]
5544 modifiers: ConstraintModifiers,
5545 #[serde(default)]
5547 use_key_keyword: bool,
5548 #[serde(default, skip_serializing_if = "Option::is_none")]
5550 expression: Option<Box<Expression>>,
5551 #[serde(default, skip_serializing_if = "Option::is_none")]
5553 index_type: Option<Box<Expression>>,
5554 #[serde(default, skip_serializing_if = "Option::is_none")]
5556 granularity: Option<Box<Expression>>,
5557 },
5558 Projection {
5560 name: Identifier,
5561 expression: Expression,
5562 },
5563 Like {
5565 source: TableRef,
5566 options: Vec<(LikeOptionAction, String)>,
5568 },
5569 PeriodForSystemTime {
5571 start_col: Identifier,
5572 end_col: Identifier,
5573 },
5574 Exclude {
5577 name: Option<Identifier>,
5578 #[serde(default)]
5580 using: Option<String>,
5581 elements: Vec<ExcludeElement>,
5583 #[serde(default)]
5585 include_columns: Vec<Identifier>,
5586 #[serde(default)]
5588 where_clause: Option<Box<Expression>>,
5589 #[serde(default)]
5591 with_params: Vec<(String, String)>,
5592 #[serde(default)]
5594 using_index_tablespace: Option<String>,
5595 #[serde(default)]
5596 modifiers: ConstraintModifiers,
5597 },
5598 Tags(Tags),
5600 InitiallyDeferred {
5604 deferred: bool,
5606 },
5607}
5608
5609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5611#[cfg_attr(feature = "bindings", derive(TS))]
5612pub struct ExcludeElement {
5613 pub expression: String,
5615 pub operator: String,
5617}
5618
5619#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5621#[cfg_attr(feature = "bindings", derive(TS))]
5622pub enum LikeOptionAction {
5623 Including,
5624 Excluding,
5625}
5626
5627#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5629#[cfg_attr(feature = "bindings", derive(TS))]
5630pub enum MatchType {
5631 Full,
5632 Partial,
5633 Simple,
5634}
5635
5636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5638#[cfg_attr(feature = "bindings", derive(TS))]
5639pub struct ForeignKeyRef {
5640 pub table: TableRef,
5641 pub columns: Vec<Identifier>,
5642 pub on_delete: Option<ReferentialAction>,
5643 pub on_update: Option<ReferentialAction>,
5644 #[serde(default)]
5646 pub on_update_first: bool,
5647 #[serde(default)]
5649 pub match_type: Option<MatchType>,
5650 #[serde(default)]
5652 pub match_after_actions: bool,
5653 #[serde(default)]
5655 pub constraint_name: Option<String>,
5656 #[serde(default)]
5658 pub deferrable: Option<bool>,
5659 #[serde(default)]
5661 pub has_foreign_key_keywords: bool,
5662}
5663
5664#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5666#[cfg_attr(feature = "bindings", derive(TS))]
5667pub enum ReferentialAction {
5668 Cascade,
5669 SetNull,
5670 SetDefault,
5671 Restrict,
5672 NoAction,
5673}
5674
5675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5677#[cfg_attr(feature = "bindings", derive(TS))]
5678pub struct DropTable {
5679 pub names: Vec<TableRef>,
5680 pub if_exists: bool,
5681 pub cascade: bool,
5682 #[serde(default)]
5684 pub cascade_constraints: bool,
5685 #[serde(default)]
5687 pub purge: bool,
5688}
5689
5690impl DropTable {
5691 pub fn new(name: impl Into<String>) -> Self {
5692 Self {
5693 names: vec![TableRef::new(name)],
5694 if_exists: false,
5695 cascade: false,
5696 cascade_constraints: false,
5697 purge: false,
5698 }
5699 }
5700}
5701
5702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5704#[cfg_attr(feature = "bindings", derive(TS))]
5705pub struct AlterTable {
5706 pub name: TableRef,
5707 pub actions: Vec<AlterTableAction>,
5708 #[serde(default)]
5710 pub if_exists: bool,
5711 #[serde(default, skip_serializing_if = "Option::is_none")]
5713 pub algorithm: Option<String>,
5714 #[serde(default, skip_serializing_if = "Option::is_none")]
5716 pub lock: Option<String>,
5717 #[serde(default, skip_serializing_if = "Option::is_none")]
5719 pub with_check: Option<String>,
5720 #[serde(default, skip_serializing_if = "Option::is_none")]
5722 pub partition: Option<Vec<(Identifier, Expression)>>,
5723 #[serde(default, skip_serializing_if = "Option::is_none")]
5725 pub on_cluster: Option<OnCluster>,
5726}
5727
5728impl AlterTable {
5729 pub fn new(name: impl Into<String>) -> Self {
5730 Self {
5731 name: TableRef::new(name),
5732 actions: Vec::new(),
5733 if_exists: false,
5734 algorithm: None,
5735 lock: None,
5736 with_check: None,
5737 partition: None,
5738 on_cluster: None,
5739 }
5740 }
5741}
5742
5743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5745#[cfg_attr(feature = "bindings", derive(TS))]
5746pub enum ColumnPosition {
5747 First,
5748 After(Identifier),
5749}
5750
5751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5753#[cfg_attr(feature = "bindings", derive(TS))]
5754pub enum AlterTableAction {
5755 AddColumn {
5756 column: ColumnDef,
5757 if_not_exists: bool,
5758 position: Option<ColumnPosition>,
5759 },
5760 DropColumn {
5761 name: Identifier,
5762 if_exists: bool,
5763 cascade: bool,
5764 },
5765 RenameColumn {
5766 old_name: Identifier,
5767 new_name: Identifier,
5768 if_exists: bool,
5769 },
5770 AlterColumn {
5771 name: Identifier,
5772 action: AlterColumnAction,
5773 #[serde(default)]
5775 use_modify_keyword: bool,
5776 },
5777 RenameTable(TableRef),
5778 AddConstraint(TableConstraint),
5779 DropConstraint {
5780 name: Identifier,
5781 if_exists: bool,
5782 },
5783 DropForeignKey {
5785 name: Identifier,
5786 },
5787 DropPartition {
5789 partitions: Vec<Vec<(Identifier, Expression)>>,
5791 if_exists: bool,
5792 },
5793 AddPartition {
5795 partition: Expression,
5797 if_not_exists: bool,
5798 location: Option<Expression>,
5799 },
5800 Delete {
5802 where_clause: Expression,
5803 },
5804 SwapWith(TableRef),
5806 SetProperty {
5808 properties: Vec<(String, Expression)>,
5809 },
5810 UnsetProperty {
5812 properties: Vec<String>,
5813 },
5814 ClusterBy {
5816 expressions: Vec<Expression>,
5817 },
5818 SetTag {
5820 expressions: Vec<(String, Expression)>,
5821 },
5822 UnsetTag {
5824 names: Vec<String>,
5825 },
5826 SetOptions {
5828 expressions: Vec<Expression>,
5829 },
5830 AlterIndex {
5832 name: Identifier,
5833 visible: bool,
5834 },
5835 SetAttribute {
5837 attribute: String,
5838 },
5839 SetStageFileFormat {
5841 options: Option<Expression>,
5842 },
5843 SetStageCopyOptions {
5845 options: Option<Expression>,
5846 },
5847 AddColumns {
5849 columns: Vec<ColumnDef>,
5850 cascade: bool,
5851 },
5852 DropColumns {
5854 names: Vec<Identifier>,
5855 },
5856 ChangeColumn {
5859 old_name: Identifier,
5860 new_name: Identifier,
5861 #[serde(default, skip_serializing_if = "Option::is_none")]
5862 data_type: Option<DataType>,
5863 comment: Option<String>,
5864 #[serde(default)]
5865 cascade: bool,
5866 },
5867 AlterSortKey {
5870 this: Option<String>,
5872 expressions: Vec<Expression>,
5874 compound: bool,
5876 },
5877 AlterDistStyle {
5881 style: String,
5883 distkey: Option<Identifier>,
5885 },
5886 SetTableProperties {
5888 properties: Vec<(Expression, Expression)>,
5889 },
5890 SetLocation {
5892 location: String,
5893 },
5894 SetFileFormat {
5896 format: String,
5897 },
5898 ReplacePartition {
5900 partition: Expression,
5901 source: Option<Box<Expression>>,
5902 },
5903}
5904
5905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5907#[cfg_attr(feature = "bindings", derive(TS))]
5908pub enum AlterColumnAction {
5909 SetDataType {
5910 data_type: DataType,
5911 using: Option<Expression>,
5913 #[serde(default, skip_serializing_if = "Option::is_none")]
5915 collate: Option<String>,
5916 },
5917 SetDefault(Expression),
5918 DropDefault,
5919 SetNotNull,
5920 DropNotNull,
5921 Comment(String),
5923 SetVisible,
5925 SetInvisible,
5927}
5928
5929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5931#[cfg_attr(feature = "bindings", derive(TS))]
5932pub struct CreateIndex {
5933 pub name: Identifier,
5934 pub table: TableRef,
5935 pub columns: Vec<IndexColumn>,
5936 pub unique: bool,
5937 pub if_not_exists: bool,
5938 pub using: Option<String>,
5939 #[serde(default)]
5941 pub clustered: Option<String>,
5942 #[serde(default)]
5944 pub concurrently: bool,
5945 #[serde(default)]
5947 pub where_clause: Option<Box<Expression>>,
5948 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5950 pub include_columns: Vec<Identifier>,
5951 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5953 pub with_options: Vec<(String, String)>,
5954 #[serde(default)]
5956 pub on_filegroup: Option<String>,
5957}
5958
5959impl CreateIndex {
5960 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
5961 Self {
5962 name: Identifier::new(name),
5963 table: TableRef::new(table),
5964 columns: Vec::new(),
5965 unique: false,
5966 if_not_exists: false,
5967 using: None,
5968 clustered: None,
5969 concurrently: false,
5970 where_clause: None,
5971 include_columns: Vec::new(),
5972 with_options: Vec::new(),
5973 on_filegroup: None,
5974 }
5975 }
5976}
5977
5978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5980#[cfg_attr(feature = "bindings", derive(TS))]
5981pub struct IndexColumn {
5982 pub column: Identifier,
5983 pub desc: bool,
5984 #[serde(default)]
5986 pub asc: bool,
5987 pub nulls_first: Option<bool>,
5988 #[serde(default, skip_serializing_if = "Option::is_none")]
5990 pub opclass: Option<String>,
5991}
5992
5993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5995#[cfg_attr(feature = "bindings", derive(TS))]
5996pub struct DropIndex {
5997 pub name: Identifier,
5998 pub table: Option<TableRef>,
5999 pub if_exists: bool,
6000 #[serde(default)]
6002 pub concurrently: bool,
6003}
6004
6005impl DropIndex {
6006 pub fn new(name: impl Into<String>) -> Self {
6007 Self {
6008 name: Identifier::new(name),
6009 table: None,
6010 if_exists: false,
6011 concurrently: false,
6012 }
6013 }
6014}
6015
6016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6018#[cfg_attr(feature = "bindings", derive(TS))]
6019pub struct ViewColumn {
6020 pub name: Identifier,
6021 pub comment: Option<String>,
6022 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6024 pub options: Vec<Expression>,
6025}
6026
6027impl ViewColumn {
6028 pub fn new(name: impl Into<String>) -> Self {
6029 Self {
6030 name: Identifier::new(name),
6031 comment: None,
6032 options: Vec::new(),
6033 }
6034 }
6035
6036 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
6037 Self {
6038 name: Identifier::new(name),
6039 comment: Some(comment.into()),
6040 options: Vec::new(),
6041 }
6042 }
6043}
6044
6045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6047#[cfg_attr(feature = "bindings", derive(TS))]
6048pub struct CreateView {
6049 pub name: TableRef,
6050 pub columns: Vec<ViewColumn>,
6051 pub query: Expression,
6052 pub or_replace: bool,
6053 pub if_not_exists: bool,
6054 pub materialized: bool,
6055 pub temporary: bool,
6056 #[serde(default)]
6058 pub secure: bool,
6059 #[serde(skip_serializing_if = "Option::is_none")]
6061 pub algorithm: Option<String>,
6062 #[serde(skip_serializing_if = "Option::is_none")]
6064 pub definer: Option<String>,
6065 #[serde(skip_serializing_if = "Option::is_none")]
6067 pub security: Option<FunctionSecurity>,
6068 #[serde(default = "default_true")]
6070 pub security_sql_style: bool,
6071 #[serde(default)]
6073 pub query_parenthesized: bool,
6074 #[serde(skip_serializing_if = "Option::is_none")]
6076 pub locking_mode: Option<String>,
6077 #[serde(skip_serializing_if = "Option::is_none")]
6079 pub locking_access: Option<String>,
6080 #[serde(default)]
6082 pub copy_grants: bool,
6083 #[serde(skip_serializing_if = "Option::is_none", default)]
6085 pub comment: Option<String>,
6086 #[serde(default)]
6088 pub tags: Vec<(String, String)>,
6089 #[serde(default)]
6091 pub options: Vec<Expression>,
6092 #[serde(skip_serializing_if = "Option::is_none", default)]
6094 pub build: Option<String>,
6095 #[serde(skip_serializing_if = "Option::is_none", default)]
6097 pub refresh: Option<Box<RefreshTriggerProperty>>,
6098 #[serde(skip_serializing_if = "Option::is_none", default)]
6101 pub schema: Option<Box<Schema>>,
6102 #[serde(skip_serializing_if = "Option::is_none", default)]
6104 pub unique_key: Option<Box<UniqueKeyProperty>>,
6105 #[serde(default)]
6107 pub no_schema_binding: bool,
6108 #[serde(skip_serializing_if = "Option::is_none", default)]
6110 pub auto_refresh: Option<bool>,
6111 #[serde(default, skip_serializing_if = "Option::is_none")]
6113 pub on_cluster: Option<OnCluster>,
6114 #[serde(default, skip_serializing_if = "Option::is_none")]
6116 pub to_table: Option<TableRef>,
6117 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6119 pub table_properties: Vec<Expression>,
6120}
6121
6122impl CreateView {
6123 pub fn new(name: impl Into<String>, query: Expression) -> Self {
6124 Self {
6125 name: TableRef::new(name),
6126 columns: Vec::new(),
6127 query,
6128 or_replace: false,
6129 if_not_exists: false,
6130 materialized: false,
6131 temporary: false,
6132 secure: false,
6133 algorithm: None,
6134 definer: None,
6135 security: None,
6136 security_sql_style: true,
6137 query_parenthesized: false,
6138 locking_mode: None,
6139 locking_access: None,
6140 copy_grants: false,
6141 comment: None,
6142 tags: Vec::new(),
6143 options: Vec::new(),
6144 build: None,
6145 refresh: None,
6146 schema: None,
6147 unique_key: None,
6148 no_schema_binding: false,
6149 auto_refresh: None,
6150 on_cluster: None,
6151 to_table: None,
6152 table_properties: Vec::new(),
6153 }
6154 }
6155}
6156
6157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6159#[cfg_attr(feature = "bindings", derive(TS))]
6160pub struct DropView {
6161 pub name: TableRef,
6162 pub if_exists: bool,
6163 pub materialized: bool,
6164}
6165
6166impl DropView {
6167 pub fn new(name: impl Into<String>) -> Self {
6168 Self {
6169 name: TableRef::new(name),
6170 if_exists: false,
6171 materialized: false,
6172 }
6173 }
6174}
6175
6176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6178#[cfg_attr(feature = "bindings", derive(TS))]
6179pub struct Truncate {
6180 #[serde(default)]
6182 pub target: TruncateTarget,
6183 pub table: TableRef,
6184 #[serde(default, skip_serializing_if = "Option::is_none")]
6186 pub on_cluster: Option<OnCluster>,
6187 pub cascade: bool,
6188 #[serde(default)]
6190 pub extra_tables: Vec<TruncateTableEntry>,
6191 #[serde(default)]
6193 pub identity: Option<TruncateIdentity>,
6194 #[serde(default)]
6196 pub restrict: bool,
6197 #[serde(default, skip_serializing_if = "Option::is_none")]
6199 pub partition: Option<Box<Expression>>,
6200}
6201
6202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6204#[cfg_attr(feature = "bindings", derive(TS))]
6205pub struct TruncateTableEntry {
6206 pub table: TableRef,
6207 #[serde(default)]
6209 pub star: bool,
6210}
6211
6212#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6214#[cfg_attr(feature = "bindings", derive(TS))]
6215pub enum TruncateTarget {
6216 Table,
6217 Database,
6218}
6219
6220impl Default for TruncateTarget {
6221 fn default() -> Self {
6222 TruncateTarget::Table
6223 }
6224}
6225
6226#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6228#[cfg_attr(feature = "bindings", derive(TS))]
6229pub enum TruncateIdentity {
6230 Restart,
6231 Continue,
6232}
6233
6234impl Truncate {
6235 pub fn new(table: impl Into<String>) -> Self {
6236 Self {
6237 target: TruncateTarget::Table,
6238 table: TableRef::new(table),
6239 on_cluster: None,
6240 cascade: false,
6241 extra_tables: Vec::new(),
6242 identity: None,
6243 restrict: false,
6244 partition: None,
6245 }
6246 }
6247}
6248
6249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6251#[cfg_attr(feature = "bindings", derive(TS))]
6252pub struct Use {
6253 pub kind: Option<UseKind>,
6255 pub this: Identifier,
6257}
6258
6259#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6261#[cfg_attr(feature = "bindings", derive(TS))]
6262pub enum UseKind {
6263 Database,
6264 Schema,
6265 Role,
6266 Warehouse,
6267 Catalog,
6268 SecondaryRoles,
6270}
6271
6272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6274#[cfg_attr(feature = "bindings", derive(TS))]
6275pub struct SetStatement {
6276 pub items: Vec<SetItem>,
6278}
6279
6280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6282#[cfg_attr(feature = "bindings", derive(TS))]
6283pub struct SetItem {
6284 pub name: Expression,
6286 pub value: Expression,
6288 pub kind: Option<String>,
6290 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6292 pub no_equals: bool,
6293}
6294
6295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6297#[cfg_attr(feature = "bindings", derive(TS))]
6298pub struct Cache {
6299 pub table: Identifier,
6301 pub lazy: bool,
6303 pub options: Vec<(Expression, Expression)>,
6305 pub query: Option<Expression>,
6307}
6308
6309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6311#[cfg_attr(feature = "bindings", derive(TS))]
6312pub struct Uncache {
6313 pub table: Identifier,
6315 pub if_exists: bool,
6317}
6318
6319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6321#[cfg_attr(feature = "bindings", derive(TS))]
6322pub struct LoadData {
6323 pub local: bool,
6325 pub inpath: String,
6327 pub overwrite: bool,
6329 pub table: Expression,
6331 pub partition: Vec<(Identifier, Expression)>,
6333 pub input_format: Option<String>,
6335 pub serde: Option<String>,
6337}
6338
6339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6341#[cfg_attr(feature = "bindings", derive(TS))]
6342pub struct Pragma {
6343 pub schema: Option<Identifier>,
6345 pub name: Identifier,
6347 pub value: Option<Expression>,
6349 pub args: Vec<Expression>,
6351}
6352
6353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6356#[cfg_attr(feature = "bindings", derive(TS))]
6357pub struct Privilege {
6358 pub name: String,
6360 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6362 pub columns: Vec<String>,
6363}
6364
6365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6367#[cfg_attr(feature = "bindings", derive(TS))]
6368pub struct GrantPrincipal {
6369 pub name: Identifier,
6371 pub is_role: bool,
6373 #[serde(default)]
6375 pub is_group: bool,
6376}
6377
6378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6380#[cfg_attr(feature = "bindings", derive(TS))]
6381pub struct Grant {
6382 pub privileges: Vec<Privilege>,
6384 pub kind: Option<String>,
6386 pub securable: Identifier,
6388 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6390 pub function_params: Vec<String>,
6391 pub principals: Vec<GrantPrincipal>,
6393 pub grant_option: bool,
6395 #[serde(default, skip_serializing_if = "Option::is_none")]
6397 pub as_principal: Option<Identifier>,
6398}
6399
6400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6402#[cfg_attr(feature = "bindings", derive(TS))]
6403pub struct Revoke {
6404 pub privileges: Vec<Privilege>,
6406 pub kind: Option<String>,
6408 pub securable: Identifier,
6410 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6412 pub function_params: Vec<String>,
6413 pub principals: Vec<GrantPrincipal>,
6415 pub grant_option: bool,
6417 pub cascade: bool,
6419 #[serde(default)]
6421 pub restrict: bool,
6422}
6423
6424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6426#[cfg_attr(feature = "bindings", derive(TS))]
6427pub struct Comment {
6428 pub this: Expression,
6430 pub kind: String,
6432 pub expression: Expression,
6434 pub exists: bool,
6436 pub materialized: bool,
6438}
6439
6440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6446#[cfg_attr(feature = "bindings", derive(TS))]
6447pub struct AlterView {
6448 pub name: TableRef,
6449 pub actions: Vec<AlterViewAction>,
6450 #[serde(default, skip_serializing_if = "Option::is_none")]
6452 pub algorithm: Option<String>,
6453 #[serde(default, skip_serializing_if = "Option::is_none")]
6455 pub definer: Option<String>,
6456 #[serde(default, skip_serializing_if = "Option::is_none")]
6458 pub sql_security: Option<String>,
6459 #[serde(default, skip_serializing_if = "Option::is_none")]
6461 pub with_option: Option<String>,
6462 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6464 pub columns: Vec<ViewColumn>,
6465}
6466
6467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6469#[cfg_attr(feature = "bindings", derive(TS))]
6470pub enum AlterViewAction {
6471 Rename(TableRef),
6473 OwnerTo(Identifier),
6475 SetSchema(Identifier),
6477 SetAuthorization(String),
6479 AlterColumn {
6481 name: Identifier,
6482 action: AlterColumnAction,
6483 },
6484 AsSelect(Box<Expression>),
6486 SetTblproperties(Vec<(String, String)>),
6488 UnsetTblproperties(Vec<String>),
6490}
6491
6492impl AlterView {
6493 pub fn new(name: impl Into<String>) -> Self {
6494 Self {
6495 name: TableRef::new(name),
6496 actions: Vec::new(),
6497 algorithm: None,
6498 definer: None,
6499 sql_security: None,
6500 with_option: None,
6501 columns: Vec::new(),
6502 }
6503 }
6504}
6505
6506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6508#[cfg_attr(feature = "bindings", derive(TS))]
6509pub struct AlterIndex {
6510 pub name: Identifier,
6511 pub table: Option<TableRef>,
6512 pub actions: Vec<AlterIndexAction>,
6513}
6514
6515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6517#[cfg_attr(feature = "bindings", derive(TS))]
6518pub enum AlterIndexAction {
6519 Rename(Identifier),
6521 SetTablespace(Identifier),
6523 Visible(bool),
6525}
6526
6527impl AlterIndex {
6528 pub fn new(name: impl Into<String>) -> Self {
6529 Self {
6530 name: Identifier::new(name),
6531 table: None,
6532 actions: Vec::new(),
6533 }
6534 }
6535}
6536
6537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6539#[cfg_attr(feature = "bindings", derive(TS))]
6540pub struct CreateSchema {
6541 pub name: Identifier,
6542 pub if_not_exists: bool,
6543 pub authorization: Option<Identifier>,
6544 #[serde(default)]
6545 pub clone_from: Option<Identifier>,
6546 #[serde(default)]
6548 pub at_clause: Option<Expression>,
6549 #[serde(default)]
6551 pub properties: Vec<Expression>,
6552 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6554 pub leading_comments: Vec<String>,
6555}
6556
6557impl CreateSchema {
6558 pub fn new(name: impl Into<String>) -> Self {
6559 Self {
6560 name: Identifier::new(name),
6561 if_not_exists: false,
6562 authorization: None,
6563 clone_from: None,
6564 at_clause: None,
6565 properties: Vec::new(),
6566 leading_comments: Vec::new(),
6567 }
6568 }
6569}
6570
6571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6573#[cfg_attr(feature = "bindings", derive(TS))]
6574pub struct DropSchema {
6575 pub name: Identifier,
6576 pub if_exists: bool,
6577 pub cascade: bool,
6578}
6579
6580impl DropSchema {
6581 pub fn new(name: impl Into<String>) -> Self {
6582 Self {
6583 name: Identifier::new(name),
6584 if_exists: false,
6585 cascade: false,
6586 }
6587 }
6588}
6589
6590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6592#[cfg_attr(feature = "bindings", derive(TS))]
6593pub struct DropNamespace {
6594 pub name: Identifier,
6595 pub if_exists: bool,
6596 pub cascade: bool,
6597}
6598
6599impl DropNamespace {
6600 pub fn new(name: impl Into<String>) -> Self {
6601 Self {
6602 name: Identifier::new(name),
6603 if_exists: false,
6604 cascade: false,
6605 }
6606 }
6607}
6608
6609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6611#[cfg_attr(feature = "bindings", derive(TS))]
6612pub struct CreateDatabase {
6613 pub name: Identifier,
6614 pub if_not_exists: bool,
6615 pub options: Vec<DatabaseOption>,
6616 #[serde(default)]
6618 pub clone_from: Option<Identifier>,
6619 #[serde(default)]
6621 pub at_clause: Option<Expression>,
6622}
6623
6624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6626#[cfg_attr(feature = "bindings", derive(TS))]
6627pub enum DatabaseOption {
6628 CharacterSet(String),
6629 Collate(String),
6630 Owner(Identifier),
6631 Template(Identifier),
6632 Encoding(String),
6633 Location(String),
6634}
6635
6636impl CreateDatabase {
6637 pub fn new(name: impl Into<String>) -> Self {
6638 Self {
6639 name: Identifier::new(name),
6640 if_not_exists: false,
6641 options: Vec::new(),
6642 clone_from: None,
6643 at_clause: None,
6644 }
6645 }
6646}
6647
6648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6650#[cfg_attr(feature = "bindings", derive(TS))]
6651pub struct DropDatabase {
6652 pub name: Identifier,
6653 pub if_exists: bool,
6654}
6655
6656impl DropDatabase {
6657 pub fn new(name: impl Into<String>) -> Self {
6658 Self {
6659 name: Identifier::new(name),
6660 if_exists: false,
6661 }
6662 }
6663}
6664
6665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6667#[cfg_attr(feature = "bindings", derive(TS))]
6668pub struct CreateFunction {
6669 pub name: TableRef,
6670 pub parameters: Vec<FunctionParameter>,
6671 pub return_type: Option<DataType>,
6672 pub body: Option<FunctionBody>,
6673 pub or_replace: bool,
6674 pub if_not_exists: bool,
6675 pub temporary: bool,
6676 pub language: Option<String>,
6677 pub deterministic: Option<bool>,
6678 pub returns_null_on_null_input: Option<bool>,
6679 pub security: Option<FunctionSecurity>,
6680 #[serde(default = "default_true")]
6682 pub has_parens: bool,
6683 #[serde(default)]
6685 pub sql_data_access: Option<SqlDataAccess>,
6686 #[serde(default, skip_serializing_if = "Option::is_none")]
6688 pub returns_table_body: Option<String>,
6689 #[serde(default)]
6691 pub language_first: bool,
6692 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6694 pub set_options: Vec<FunctionSetOption>,
6695 #[serde(default)]
6697 pub strict: bool,
6698 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6700 pub options: Vec<Expression>,
6701 #[serde(default)]
6703 pub is_table_function: bool,
6704 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6706 pub property_order: Vec<FunctionPropertyKind>,
6707 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6709 pub environment: Vec<Expression>,
6710}
6711
6712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6714#[cfg_attr(feature = "bindings", derive(TS))]
6715pub struct FunctionSetOption {
6716 pub name: String,
6717 pub value: FunctionSetValue,
6718}
6719
6720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6722#[cfg_attr(feature = "bindings", derive(TS))]
6723pub enum FunctionSetValue {
6724 Value { value: String, use_to: bool },
6726 FromCurrent,
6728}
6729
6730#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6732#[cfg_attr(feature = "bindings", derive(TS))]
6733pub enum SqlDataAccess {
6734 NoSql,
6736 ContainsSql,
6738 ReadsSqlData,
6740 ModifiesSqlData,
6742}
6743
6744#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6746#[cfg_attr(feature = "bindings", derive(TS))]
6747pub enum FunctionPropertyKind {
6748 Set,
6750 As,
6752 Language,
6754 Determinism,
6756 NullInput,
6758 Security,
6760 SqlDataAccess,
6762 Options,
6764 Environment,
6766}
6767
6768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6770#[cfg_attr(feature = "bindings", derive(TS))]
6771pub struct FunctionParameter {
6772 pub name: Option<Identifier>,
6773 pub data_type: DataType,
6774 pub mode: Option<ParameterMode>,
6775 pub default: Option<Expression>,
6776}
6777
6778#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6780#[cfg_attr(feature = "bindings", derive(TS))]
6781pub enum ParameterMode {
6782 In,
6783 Out,
6784 InOut,
6785}
6786
6787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6789#[cfg_attr(feature = "bindings", derive(TS))]
6790pub enum FunctionBody {
6791 Block(String),
6793 StringLiteral(String),
6795 Expression(Expression),
6797 External(String),
6799 Return(Expression),
6801 Statements(Vec<Expression>),
6803 DollarQuoted {
6806 content: String,
6807 tag: Option<String>,
6808 },
6809}
6810
6811#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6813#[cfg_attr(feature = "bindings", derive(TS))]
6814pub enum FunctionSecurity {
6815 Definer,
6816 Invoker,
6817 None,
6819}
6820
6821impl CreateFunction {
6822 pub fn new(name: impl Into<String>) -> Self {
6823 Self {
6824 name: TableRef::new(name),
6825 parameters: Vec::new(),
6826 return_type: None,
6827 body: None,
6828 or_replace: false,
6829 if_not_exists: false,
6830 temporary: false,
6831 language: None,
6832 deterministic: None,
6833 returns_null_on_null_input: None,
6834 security: None,
6835 has_parens: true,
6836 sql_data_access: None,
6837 returns_table_body: None,
6838 language_first: false,
6839 set_options: Vec::new(),
6840 strict: false,
6841 options: Vec::new(),
6842 is_table_function: false,
6843 property_order: Vec::new(),
6844 environment: Vec::new(),
6845 }
6846 }
6847}
6848
6849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6851#[cfg_attr(feature = "bindings", derive(TS))]
6852pub struct DropFunction {
6853 pub name: TableRef,
6854 pub parameters: Option<Vec<DataType>>,
6855 pub if_exists: bool,
6856 pub cascade: bool,
6857}
6858
6859impl DropFunction {
6860 pub fn new(name: impl Into<String>) -> Self {
6861 Self {
6862 name: TableRef::new(name),
6863 parameters: None,
6864 if_exists: false,
6865 cascade: false,
6866 }
6867 }
6868}
6869
6870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6872#[cfg_attr(feature = "bindings", derive(TS))]
6873pub struct CreateProcedure {
6874 pub name: TableRef,
6875 pub parameters: Vec<FunctionParameter>,
6876 pub body: Option<FunctionBody>,
6877 pub or_replace: bool,
6878 pub if_not_exists: bool,
6879 pub language: Option<String>,
6880 pub security: Option<FunctionSecurity>,
6881 #[serde(default)]
6883 pub return_type: Option<DataType>,
6884 #[serde(default)]
6886 pub execute_as: Option<String>,
6887 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6889 pub with_options: Vec<String>,
6890 #[serde(default = "default_true", skip_serializing_if = "is_true")]
6892 pub has_parens: bool,
6893 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6895 pub use_proc_keyword: bool,
6896}
6897
6898impl CreateProcedure {
6899 pub fn new(name: impl Into<String>) -> Self {
6900 Self {
6901 name: TableRef::new(name),
6902 parameters: Vec::new(),
6903 body: None,
6904 or_replace: false,
6905 if_not_exists: false,
6906 language: None,
6907 security: None,
6908 return_type: None,
6909 execute_as: None,
6910 with_options: Vec::new(),
6911 has_parens: true,
6912 use_proc_keyword: false,
6913 }
6914 }
6915}
6916
6917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6919#[cfg_attr(feature = "bindings", derive(TS))]
6920pub struct DropProcedure {
6921 pub name: TableRef,
6922 pub parameters: Option<Vec<DataType>>,
6923 pub if_exists: bool,
6924 pub cascade: bool,
6925}
6926
6927impl DropProcedure {
6928 pub fn new(name: impl Into<String>) -> Self {
6929 Self {
6930 name: TableRef::new(name),
6931 parameters: None,
6932 if_exists: false,
6933 cascade: false,
6934 }
6935 }
6936}
6937
6938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6940#[cfg_attr(feature = "bindings", derive(TS))]
6941pub enum SeqPropKind {
6942 Start,
6943 Increment,
6944 Minvalue,
6945 Maxvalue,
6946 Cache,
6947 Cycle,
6948 NoCycle,
6949 OwnedBy,
6950 Order,
6951 NoOrder,
6952 Comment,
6953}
6954
6955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6957#[cfg_attr(feature = "bindings", derive(TS))]
6958pub struct CreateSequence {
6959 pub name: TableRef,
6960 pub if_not_exists: bool,
6961 pub temporary: bool,
6962 pub increment: Option<i64>,
6963 pub minvalue: Option<SequenceBound>,
6964 pub maxvalue: Option<SequenceBound>,
6965 pub start: Option<i64>,
6966 pub cache: Option<i64>,
6967 pub cycle: bool,
6968 pub owned_by: Option<TableRef>,
6969 #[serde(default)]
6971 pub order: Option<bool>,
6972 #[serde(default)]
6974 pub comment: Option<String>,
6975 #[serde(default)]
6977 pub property_order: Vec<SeqPropKind>,
6978}
6979
6980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6982#[cfg_attr(feature = "bindings", derive(TS))]
6983pub enum SequenceBound {
6984 Value(i64),
6985 None,
6986}
6987
6988impl CreateSequence {
6989 pub fn new(name: impl Into<String>) -> Self {
6990 Self {
6991 name: TableRef::new(name),
6992 if_not_exists: false,
6993 temporary: false,
6994 increment: None,
6995 minvalue: None,
6996 maxvalue: None,
6997 start: None,
6998 cache: None,
6999 cycle: false,
7000 owned_by: None,
7001 order: None,
7002 comment: None,
7003 property_order: Vec::new(),
7004 }
7005 }
7006}
7007
7008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7010#[cfg_attr(feature = "bindings", derive(TS))]
7011pub struct DropSequence {
7012 pub name: TableRef,
7013 pub if_exists: bool,
7014 pub cascade: bool,
7015}
7016
7017impl DropSequence {
7018 pub fn new(name: impl Into<String>) -> Self {
7019 Self {
7020 name: TableRef::new(name),
7021 if_exists: false,
7022 cascade: false,
7023 }
7024 }
7025}
7026
7027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7029#[cfg_attr(feature = "bindings", derive(TS))]
7030pub struct AlterSequence {
7031 pub name: TableRef,
7032 pub if_exists: bool,
7033 pub increment: Option<i64>,
7034 pub minvalue: Option<SequenceBound>,
7035 pub maxvalue: Option<SequenceBound>,
7036 pub start: Option<i64>,
7037 pub restart: Option<Option<i64>>,
7038 pub cache: Option<i64>,
7039 pub cycle: Option<bool>,
7040 pub owned_by: Option<Option<TableRef>>,
7041}
7042
7043impl AlterSequence {
7044 pub fn new(name: impl Into<String>) -> Self {
7045 Self {
7046 name: TableRef::new(name),
7047 if_exists: false,
7048 increment: None,
7049 minvalue: None,
7050 maxvalue: None,
7051 start: None,
7052 restart: None,
7053 cache: None,
7054 cycle: None,
7055 owned_by: None,
7056 }
7057 }
7058}
7059
7060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7062#[cfg_attr(feature = "bindings", derive(TS))]
7063pub struct CreateTrigger {
7064 pub name: Identifier,
7065 pub table: TableRef,
7066 pub timing: TriggerTiming,
7067 pub events: Vec<TriggerEvent>,
7068 pub for_each: TriggerForEach,
7069 pub when: Option<Expression>,
7070 pub body: TriggerBody,
7071 pub or_replace: bool,
7072 pub constraint: bool,
7073 pub deferrable: Option<bool>,
7074 pub initially_deferred: Option<bool>,
7075 pub referencing: Option<TriggerReferencing>,
7076}
7077
7078#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7080#[cfg_attr(feature = "bindings", derive(TS))]
7081pub enum TriggerTiming {
7082 Before,
7083 After,
7084 InsteadOf,
7085}
7086
7087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7089#[cfg_attr(feature = "bindings", derive(TS))]
7090pub enum TriggerEvent {
7091 Insert,
7092 Update(Option<Vec<Identifier>>),
7093 Delete,
7094 Truncate,
7095}
7096
7097#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7099#[cfg_attr(feature = "bindings", derive(TS))]
7100pub enum TriggerForEach {
7101 Row,
7102 Statement,
7103}
7104
7105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7107#[cfg_attr(feature = "bindings", derive(TS))]
7108pub enum TriggerBody {
7109 Execute {
7111 function: TableRef,
7112 args: Vec<Expression>,
7113 },
7114 Block(String),
7116}
7117
7118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7120#[cfg_attr(feature = "bindings", derive(TS))]
7121pub struct TriggerReferencing {
7122 pub old_table: Option<Identifier>,
7123 pub new_table: Option<Identifier>,
7124 pub old_row: Option<Identifier>,
7125 pub new_row: Option<Identifier>,
7126}
7127
7128impl CreateTrigger {
7129 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
7130 Self {
7131 name: Identifier::new(name),
7132 table: TableRef::new(table),
7133 timing: TriggerTiming::Before,
7134 events: Vec::new(),
7135 for_each: TriggerForEach::Row,
7136 when: None,
7137 body: TriggerBody::Execute {
7138 function: TableRef::new(""),
7139 args: Vec::new(),
7140 },
7141 or_replace: false,
7142 constraint: false,
7143 deferrable: None,
7144 initially_deferred: None,
7145 referencing: None,
7146 }
7147 }
7148}
7149
7150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7152#[cfg_attr(feature = "bindings", derive(TS))]
7153pub struct DropTrigger {
7154 pub name: Identifier,
7155 pub table: Option<TableRef>,
7156 pub if_exists: bool,
7157 pub cascade: bool,
7158}
7159
7160impl DropTrigger {
7161 pub fn new(name: impl Into<String>) -> Self {
7162 Self {
7163 name: Identifier::new(name),
7164 table: None,
7165 if_exists: false,
7166 cascade: false,
7167 }
7168 }
7169}
7170
7171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7173#[cfg_attr(feature = "bindings", derive(TS))]
7174pub struct CreateType {
7175 pub name: TableRef,
7176 pub definition: TypeDefinition,
7177 pub if_not_exists: bool,
7178}
7179
7180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7182#[cfg_attr(feature = "bindings", derive(TS))]
7183pub enum TypeDefinition {
7184 Enum(Vec<String>),
7186 Composite(Vec<TypeAttribute>),
7188 Range {
7190 subtype: DataType,
7191 subtype_diff: Option<String>,
7192 canonical: Option<String>,
7193 },
7194 Base {
7196 input: String,
7197 output: String,
7198 internallength: Option<i32>,
7199 },
7200 Domain {
7202 base_type: DataType,
7203 default: Option<Expression>,
7204 constraints: Vec<DomainConstraint>,
7205 },
7206}
7207
7208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7210#[cfg_attr(feature = "bindings", derive(TS))]
7211pub struct TypeAttribute {
7212 pub name: Identifier,
7213 pub data_type: DataType,
7214 pub collate: Option<Identifier>,
7215}
7216
7217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7219#[cfg_attr(feature = "bindings", derive(TS))]
7220pub struct DomainConstraint {
7221 pub name: Option<Identifier>,
7222 pub check: Expression,
7223}
7224
7225impl CreateType {
7226 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
7227 Self {
7228 name: TableRef::new(name),
7229 definition: TypeDefinition::Enum(values),
7230 if_not_exists: false,
7231 }
7232 }
7233
7234 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
7235 Self {
7236 name: TableRef::new(name),
7237 definition: TypeDefinition::Composite(attributes),
7238 if_not_exists: false,
7239 }
7240 }
7241}
7242
7243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7245#[cfg_attr(feature = "bindings", derive(TS))]
7246pub struct DropType {
7247 pub name: TableRef,
7248 pub if_exists: bool,
7249 pub cascade: bool,
7250}
7251
7252impl DropType {
7253 pub fn new(name: impl Into<String>) -> Self {
7254 Self {
7255 name: TableRef::new(name),
7256 if_exists: false,
7257 cascade: false,
7258 }
7259 }
7260}
7261
7262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7264#[cfg_attr(feature = "bindings", derive(TS))]
7265pub struct Describe {
7266 pub target: Expression,
7268 pub extended: bool,
7270 pub formatted: bool,
7272 #[serde(default)]
7274 pub kind: Option<String>,
7275 #[serde(default)]
7277 pub properties: Vec<(String, String)>,
7278 #[serde(default, skip_serializing_if = "Option::is_none")]
7280 pub style: Option<String>,
7281 #[serde(default)]
7283 pub partition: Option<Box<Expression>>,
7284 #[serde(default)]
7286 pub leading_comments: Vec<String>,
7287}
7288
7289impl Describe {
7290 pub fn new(target: Expression) -> Self {
7291 Self {
7292 target,
7293 extended: false,
7294 formatted: false,
7295 kind: None,
7296 properties: Vec::new(),
7297 style: None,
7298 partition: None,
7299 leading_comments: Vec::new(),
7300 }
7301 }
7302}
7303
7304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7306#[cfg_attr(feature = "bindings", derive(TS))]
7307pub struct Show {
7308 pub this: String,
7310 #[serde(default)]
7312 pub terse: bool,
7313 #[serde(default)]
7315 pub history: bool,
7316 pub like: Option<Expression>,
7318 pub scope_kind: Option<String>,
7320 pub scope: Option<Expression>,
7322 pub starts_with: Option<Expression>,
7324 pub limit: Option<Box<Limit>>,
7326 pub from: Option<Expression>,
7328 #[serde(default, skip_serializing_if = "Option::is_none")]
7330 pub where_clause: Option<Expression>,
7331 #[serde(default, skip_serializing_if = "Option::is_none")]
7333 pub for_target: Option<Expression>,
7334 #[serde(default, skip_serializing_if = "Option::is_none")]
7336 pub db: Option<Expression>,
7337 #[serde(default, skip_serializing_if = "Option::is_none")]
7339 pub target: Option<Expression>,
7340 #[serde(default, skip_serializing_if = "Option::is_none")]
7342 pub mutex: Option<bool>,
7343 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7345 pub privileges: Vec<String>,
7346}
7347
7348impl Show {
7349 pub fn new(this: impl Into<String>) -> Self {
7350 Self {
7351 this: this.into(),
7352 terse: false,
7353 history: false,
7354 like: None,
7355 scope_kind: None,
7356 scope: None,
7357 starts_with: None,
7358 limit: None,
7359 from: None,
7360 where_clause: None,
7361 for_target: None,
7362 db: None,
7363 target: None,
7364 mutex: None,
7365 privileges: Vec::new(),
7366 }
7367 }
7368}
7369
7370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7375#[cfg_attr(feature = "bindings", derive(TS))]
7376pub struct Paren {
7377 pub this: Expression,
7379 #[serde(default)]
7380 pub trailing_comments: Vec<String>,
7381}
7382
7383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7385#[cfg_attr(feature = "bindings", derive(TS))]
7386pub struct Annotated {
7387 pub this: Expression,
7388 pub trailing_comments: Vec<String>,
7389}
7390
7391
7392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7397#[cfg_attr(feature = "bindings", derive(TS))]
7398pub struct Refresh {
7399 pub this: Box<Expression>,
7400 pub kind: String,
7401}
7402
7403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7405#[cfg_attr(feature = "bindings", derive(TS))]
7406pub struct LockingStatement {
7407 pub this: Box<Expression>,
7408 pub expression: Box<Expression>,
7409}
7410
7411#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7413#[cfg_attr(feature = "bindings", derive(TS))]
7414pub struct SequenceProperties {
7415 #[serde(default)]
7416 pub increment: Option<Box<Expression>>,
7417 #[serde(default)]
7418 pub minvalue: Option<Box<Expression>>,
7419 #[serde(default)]
7420 pub maxvalue: Option<Box<Expression>>,
7421 #[serde(default)]
7422 pub cache: Option<Box<Expression>>,
7423 #[serde(default)]
7424 pub start: Option<Box<Expression>>,
7425 #[serde(default)]
7426 pub owned: Option<Box<Expression>>,
7427 #[serde(default)]
7428 pub options: Vec<Expression>,
7429}
7430
7431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7433#[cfg_attr(feature = "bindings", derive(TS))]
7434pub struct TruncateTable {
7435 #[serde(default)]
7436 pub expressions: Vec<Expression>,
7437 #[serde(default)]
7438 pub is_database: Option<Box<Expression>>,
7439 #[serde(default)]
7440 pub exists: bool,
7441 #[serde(default)]
7442 pub only: Option<Box<Expression>>,
7443 #[serde(default)]
7444 pub cluster: Option<Box<Expression>>,
7445 #[serde(default)]
7446 pub identity: Option<Box<Expression>>,
7447 #[serde(default)]
7448 pub option: Option<Box<Expression>>,
7449 #[serde(default)]
7450 pub partition: Option<Box<Expression>>,
7451}
7452
7453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7455#[cfg_attr(feature = "bindings", derive(TS))]
7456pub struct Clone {
7457 pub this: Box<Expression>,
7458 #[serde(default)]
7459 pub shallow: Option<Box<Expression>>,
7460 #[serde(default)]
7461 pub copy: Option<Box<Expression>>,
7462}
7463
7464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7466#[cfg_attr(feature = "bindings", derive(TS))]
7467pub struct Attach {
7468 pub this: Box<Expression>,
7469 #[serde(default)]
7470 pub exists: bool,
7471 #[serde(default)]
7472 pub expressions: Vec<Expression>,
7473}
7474
7475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7477#[cfg_attr(feature = "bindings", derive(TS))]
7478pub struct Detach {
7479 pub this: Box<Expression>,
7480 #[serde(default)]
7481 pub exists: bool,
7482}
7483
7484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7486#[cfg_attr(feature = "bindings", derive(TS))]
7487pub struct Install {
7488 pub this: Box<Expression>,
7489 #[serde(default)]
7490 pub from_: Option<Box<Expression>>,
7491 #[serde(default)]
7492 pub force: Option<Box<Expression>>,
7493}
7494
7495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7497#[cfg_attr(feature = "bindings", derive(TS))]
7498pub struct Summarize {
7499 pub this: Box<Expression>,
7500 #[serde(default)]
7501 pub table: Option<Box<Expression>>,
7502}
7503
7504#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7506#[cfg_attr(feature = "bindings", derive(TS))]
7507pub struct Declare {
7508 #[serde(default)]
7509 pub expressions: Vec<Expression>,
7510}
7511
7512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7514#[cfg_attr(feature = "bindings", derive(TS))]
7515pub struct DeclareItem {
7516 pub this: Box<Expression>,
7517 #[serde(default)]
7518 pub kind: Option<String>,
7519 #[serde(default)]
7520 pub default: Option<Box<Expression>>,
7521 #[serde(default)]
7522 pub has_as: bool,
7523 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7525 pub additional_names: Vec<Expression>,
7526}
7527
7528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7530#[cfg_attr(feature = "bindings", derive(TS))]
7531pub struct Set {
7532 #[serde(default)]
7533 pub expressions: Vec<Expression>,
7534 #[serde(default)]
7535 pub unset: Option<Box<Expression>>,
7536 #[serde(default)]
7537 pub tag: Option<Box<Expression>>,
7538}
7539
7540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7542#[cfg_attr(feature = "bindings", derive(TS))]
7543pub struct Heredoc {
7544 pub this: Box<Expression>,
7545 #[serde(default)]
7546 pub tag: Option<Box<Expression>>,
7547}
7548
7549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7551#[cfg_attr(feature = "bindings", derive(TS))]
7552pub struct QueryBand {
7553 pub this: Box<Expression>,
7554 #[serde(default)]
7555 pub scope: Option<Box<Expression>>,
7556 #[serde(default)]
7557 pub update: Option<Box<Expression>>,
7558}
7559
7560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7562#[cfg_attr(feature = "bindings", derive(TS))]
7563pub struct UserDefinedFunction {
7564 pub this: Box<Expression>,
7565 #[serde(default)]
7566 pub expressions: Vec<Expression>,
7567 #[serde(default)]
7568 pub wrapped: Option<Box<Expression>>,
7569}
7570
7571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7573#[cfg_attr(feature = "bindings", derive(TS))]
7574pub struct RecursiveWithSearch {
7575 pub kind: String,
7576 pub this: Box<Expression>,
7577 pub expression: Box<Expression>,
7578 #[serde(default)]
7579 pub using: Option<Box<Expression>>,
7580}
7581
7582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7584#[cfg_attr(feature = "bindings", derive(TS))]
7585pub struct ProjectionDef {
7586 pub this: Box<Expression>,
7587 pub expression: Box<Expression>,
7588}
7589
7590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7592#[cfg_attr(feature = "bindings", derive(TS))]
7593pub struct TableAlias {
7594 #[serde(default)]
7595 pub this: Option<Box<Expression>>,
7596 #[serde(default)]
7597 pub columns: Vec<Expression>,
7598}
7599
7600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7602#[cfg_attr(feature = "bindings", derive(TS))]
7603pub struct ByteString {
7604 pub this: Box<Expression>,
7605 #[serde(default)]
7606 pub is_bytes: Option<Box<Expression>>,
7607}
7608
7609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7612#[cfg_attr(feature = "bindings", derive(TS))]
7613pub struct HexStringExpr {
7614 pub this: Box<Expression>,
7615 #[serde(default)]
7616 pub is_integer: Option<bool>,
7617}
7618
7619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7621#[cfg_attr(feature = "bindings", derive(TS))]
7622pub struct UnicodeString {
7623 pub this: Box<Expression>,
7624 #[serde(default)]
7625 pub escape: Option<Box<Expression>>,
7626}
7627
7628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7630#[cfg_attr(feature = "bindings", derive(TS))]
7631pub struct AlterColumn {
7632 pub this: Box<Expression>,
7633 #[serde(default)]
7634 pub dtype: Option<Box<Expression>>,
7635 #[serde(default)]
7636 pub collate: Option<Box<Expression>>,
7637 #[serde(default)]
7638 pub using: Option<Box<Expression>>,
7639 #[serde(default)]
7640 pub default: Option<Box<Expression>>,
7641 #[serde(default)]
7642 pub drop: Option<Box<Expression>>,
7643 #[serde(default)]
7644 pub comment: Option<Box<Expression>>,
7645 #[serde(default)]
7646 pub allow_null: Option<Box<Expression>>,
7647 #[serde(default)]
7648 pub visible: Option<Box<Expression>>,
7649 #[serde(default)]
7650 pub rename_to: Option<Box<Expression>>,
7651}
7652
7653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7655#[cfg_attr(feature = "bindings", derive(TS))]
7656pub struct AlterSortKey {
7657 #[serde(default)]
7658 pub this: Option<Box<Expression>>,
7659 #[serde(default)]
7660 pub expressions: Vec<Expression>,
7661 #[serde(default)]
7662 pub compound: Option<Box<Expression>>,
7663}
7664
7665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7667#[cfg_attr(feature = "bindings", derive(TS))]
7668pub struct AlterSet {
7669 #[serde(default)]
7670 pub expressions: Vec<Expression>,
7671 #[serde(default)]
7672 pub option: Option<Box<Expression>>,
7673 #[serde(default)]
7674 pub tablespace: Option<Box<Expression>>,
7675 #[serde(default)]
7676 pub access_method: Option<Box<Expression>>,
7677 #[serde(default)]
7678 pub file_format: Option<Box<Expression>>,
7679 #[serde(default)]
7680 pub copy_options: Option<Box<Expression>>,
7681 #[serde(default)]
7682 pub tag: Option<Box<Expression>>,
7683 #[serde(default)]
7684 pub location: Option<Box<Expression>>,
7685 #[serde(default)]
7686 pub serde: Option<Box<Expression>>,
7687}
7688
7689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7691#[cfg_attr(feature = "bindings", derive(TS))]
7692pub struct RenameColumn {
7693 pub this: Box<Expression>,
7694 #[serde(default)]
7695 pub to: Option<Box<Expression>>,
7696 #[serde(default)]
7697 pub exists: bool,
7698}
7699
7700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7702#[cfg_attr(feature = "bindings", derive(TS))]
7703pub struct Comprehension {
7704 pub this: Box<Expression>,
7705 pub expression: Box<Expression>,
7706 #[serde(default)]
7707 pub position: Option<Box<Expression>>,
7708 #[serde(default)]
7709 pub iterator: Option<Box<Expression>>,
7710 #[serde(default)]
7711 pub condition: Option<Box<Expression>>,
7712}
7713
7714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7716#[cfg_attr(feature = "bindings", derive(TS))]
7717pub struct MergeTreeTTLAction {
7718 pub this: Box<Expression>,
7719 #[serde(default)]
7720 pub delete: Option<Box<Expression>>,
7721 #[serde(default)]
7722 pub recompress: Option<Box<Expression>>,
7723 #[serde(default)]
7724 pub to_disk: Option<Box<Expression>>,
7725 #[serde(default)]
7726 pub to_volume: Option<Box<Expression>>,
7727}
7728
7729#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7731#[cfg_attr(feature = "bindings", derive(TS))]
7732pub struct MergeTreeTTL {
7733 #[serde(default)]
7734 pub expressions: Vec<Expression>,
7735 #[serde(default)]
7736 pub where_: Option<Box<Expression>>,
7737 #[serde(default)]
7738 pub group: Option<Box<Expression>>,
7739 #[serde(default)]
7740 pub aggregates: Option<Box<Expression>>,
7741}
7742
7743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7745#[cfg_attr(feature = "bindings", derive(TS))]
7746pub struct IndexConstraintOption {
7747 #[serde(default)]
7748 pub key_block_size: Option<Box<Expression>>,
7749 #[serde(default)]
7750 pub using: Option<Box<Expression>>,
7751 #[serde(default)]
7752 pub parser: Option<Box<Expression>>,
7753 #[serde(default)]
7754 pub comment: Option<Box<Expression>>,
7755 #[serde(default)]
7756 pub visible: Option<Box<Expression>>,
7757 #[serde(default)]
7758 pub engine_attr: Option<Box<Expression>>,
7759 #[serde(default)]
7760 pub secondary_engine_attr: Option<Box<Expression>>,
7761}
7762
7763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7765#[cfg_attr(feature = "bindings", derive(TS))]
7766pub struct PeriodForSystemTimeConstraint {
7767 pub this: Box<Expression>,
7768 pub expression: Box<Expression>,
7769}
7770
7771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7773#[cfg_attr(feature = "bindings", derive(TS))]
7774pub struct CaseSpecificColumnConstraint {
7775 #[serde(default)]
7776 pub not_: Option<Box<Expression>>,
7777}
7778
7779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7781#[cfg_attr(feature = "bindings", derive(TS))]
7782pub struct CharacterSetColumnConstraint {
7783 pub this: Box<Expression>,
7784}
7785
7786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7788#[cfg_attr(feature = "bindings", derive(TS))]
7789pub struct CheckColumnConstraint {
7790 pub this: Box<Expression>,
7791 #[serde(default)]
7792 pub enforced: Option<Box<Expression>>,
7793}
7794
7795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7797#[cfg_attr(feature = "bindings", derive(TS))]
7798pub struct CompressColumnConstraint {
7799 #[serde(default)]
7800 pub this: Option<Box<Expression>>,
7801}
7802
7803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7805#[cfg_attr(feature = "bindings", derive(TS))]
7806pub struct DateFormatColumnConstraint {
7807 pub this: Box<Expression>,
7808}
7809
7810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7812#[cfg_attr(feature = "bindings", derive(TS))]
7813pub struct EphemeralColumnConstraint {
7814 #[serde(default)]
7815 pub this: Option<Box<Expression>>,
7816}
7817
7818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7820#[cfg_attr(feature = "bindings", derive(TS))]
7821pub struct WithOperator {
7822 pub this: Box<Expression>,
7823 pub op: String,
7824}
7825
7826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7828#[cfg_attr(feature = "bindings", derive(TS))]
7829pub struct GeneratedAsIdentityColumnConstraint {
7830 #[serde(default)]
7831 pub this: Option<Box<Expression>>,
7832 #[serde(default)]
7833 pub expression: Option<Box<Expression>>,
7834 #[serde(default)]
7835 pub on_null: Option<Box<Expression>>,
7836 #[serde(default)]
7837 pub start: Option<Box<Expression>>,
7838 #[serde(default)]
7839 pub increment: Option<Box<Expression>>,
7840 #[serde(default)]
7841 pub minvalue: Option<Box<Expression>>,
7842 #[serde(default)]
7843 pub maxvalue: Option<Box<Expression>>,
7844 #[serde(default)]
7845 pub cycle: Option<Box<Expression>>,
7846 #[serde(default)]
7847 pub order: Option<Box<Expression>>,
7848}
7849
7850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7853#[cfg_attr(feature = "bindings", derive(TS))]
7854pub struct AutoIncrementColumnConstraint;
7855
7856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7858#[cfg_attr(feature = "bindings", derive(TS))]
7859pub struct CommentColumnConstraint;
7860
7861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7863#[cfg_attr(feature = "bindings", derive(TS))]
7864pub struct GeneratedAsRowColumnConstraint {
7865 #[serde(default)]
7866 pub start: Option<Box<Expression>>,
7867 #[serde(default)]
7868 pub hidden: Option<Box<Expression>>,
7869}
7870
7871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7873#[cfg_attr(feature = "bindings", derive(TS))]
7874pub struct IndexColumnConstraint {
7875 #[serde(default)]
7876 pub this: Option<Box<Expression>>,
7877 #[serde(default)]
7878 pub expressions: Vec<Expression>,
7879 #[serde(default)]
7880 pub kind: Option<String>,
7881 #[serde(default)]
7882 pub index_type: Option<Box<Expression>>,
7883 #[serde(default)]
7884 pub options: Vec<Expression>,
7885 #[serde(default)]
7886 pub expression: Option<Box<Expression>>,
7887 #[serde(default)]
7888 pub granularity: Option<Box<Expression>>,
7889}
7890
7891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7893#[cfg_attr(feature = "bindings", derive(TS))]
7894pub struct MaskingPolicyColumnConstraint {
7895 pub this: Box<Expression>,
7896 #[serde(default)]
7897 pub expressions: Vec<Expression>,
7898}
7899
7900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7902#[cfg_attr(feature = "bindings", derive(TS))]
7903pub struct NotNullColumnConstraint {
7904 #[serde(default)]
7905 pub allow_null: Option<Box<Expression>>,
7906}
7907
7908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7910#[cfg_attr(feature = "bindings", derive(TS))]
7911pub struct DefaultColumnConstraint {
7912 pub this: Box<Expression>,
7913}
7914
7915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7917#[cfg_attr(feature = "bindings", derive(TS))]
7918pub struct PrimaryKeyColumnConstraint {
7919 #[serde(default)]
7920 pub desc: Option<Box<Expression>>,
7921 #[serde(default)]
7922 pub options: Vec<Expression>,
7923}
7924
7925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7927#[cfg_attr(feature = "bindings", derive(TS))]
7928pub struct UniqueColumnConstraint {
7929 #[serde(default)]
7930 pub this: Option<Box<Expression>>,
7931 #[serde(default)]
7932 pub index_type: Option<Box<Expression>>,
7933 #[serde(default)]
7934 pub on_conflict: Option<Box<Expression>>,
7935 #[serde(default)]
7936 pub nulls: Option<Box<Expression>>,
7937 #[serde(default)]
7938 pub options: Vec<Expression>,
7939}
7940
7941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7943#[cfg_attr(feature = "bindings", derive(TS))]
7944pub struct WatermarkColumnConstraint {
7945 pub this: Box<Expression>,
7946 pub expression: Box<Expression>,
7947}
7948
7949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7951#[cfg_attr(feature = "bindings", derive(TS))]
7952pub struct ComputedColumnConstraint {
7953 pub this: Box<Expression>,
7954 #[serde(default)]
7955 pub persisted: Option<Box<Expression>>,
7956 #[serde(default)]
7957 pub not_null: Option<Box<Expression>>,
7958 #[serde(default)]
7959 pub data_type: Option<Box<Expression>>,
7960}
7961
7962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7964#[cfg_attr(feature = "bindings", derive(TS))]
7965pub struct InOutColumnConstraint {
7966 #[serde(default)]
7967 pub input_: Option<Box<Expression>>,
7968 #[serde(default)]
7969 pub output: Option<Box<Expression>>,
7970}
7971
7972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7974#[cfg_attr(feature = "bindings", derive(TS))]
7975pub struct PathColumnConstraint {
7976 pub this: Box<Expression>,
7977}
7978
7979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7981#[cfg_attr(feature = "bindings", derive(TS))]
7982pub struct Constraint {
7983 pub this: Box<Expression>,
7984 #[serde(default)]
7985 pub expressions: Vec<Expression>,
7986}
7987
7988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7990#[cfg_attr(feature = "bindings", derive(TS))]
7991pub struct Export {
7992 pub this: Box<Expression>,
7993 #[serde(default)]
7994 pub connection: Option<Box<Expression>>,
7995 #[serde(default)]
7996 pub options: Vec<Expression>,
7997}
7998
7999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8001#[cfg_attr(feature = "bindings", derive(TS))]
8002pub struct Filter {
8003 pub this: Box<Expression>,
8004 pub expression: Box<Expression>,
8005}
8006
8007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8009#[cfg_attr(feature = "bindings", derive(TS))]
8010pub struct Changes {
8011 #[serde(default)]
8012 pub information: Option<Box<Expression>>,
8013 #[serde(default)]
8014 pub at_before: Option<Box<Expression>>,
8015 #[serde(default)]
8016 pub end: Option<Box<Expression>>,
8017}
8018
8019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8021#[cfg_attr(feature = "bindings", derive(TS))]
8022pub struct Directory {
8023 pub this: Box<Expression>,
8024 #[serde(default)]
8025 pub local: Option<Box<Expression>>,
8026 #[serde(default)]
8027 pub row_format: Option<Box<Expression>>,
8028}
8029
8030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8032#[cfg_attr(feature = "bindings", derive(TS))]
8033pub struct ForeignKey {
8034 #[serde(default)]
8035 pub expressions: Vec<Expression>,
8036 #[serde(default)]
8037 pub reference: Option<Box<Expression>>,
8038 #[serde(default)]
8039 pub delete: Option<Box<Expression>>,
8040 #[serde(default)]
8041 pub update: Option<Box<Expression>>,
8042 #[serde(default)]
8043 pub options: Vec<Expression>,
8044}
8045
8046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8048#[cfg_attr(feature = "bindings", derive(TS))]
8049pub struct ColumnPrefix {
8050 pub this: Box<Expression>,
8051 pub expression: Box<Expression>,
8052}
8053
8054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8056#[cfg_attr(feature = "bindings", derive(TS))]
8057pub struct PrimaryKey {
8058 #[serde(default)]
8059 pub this: Option<Box<Expression>>,
8060 #[serde(default)]
8061 pub expressions: Vec<Expression>,
8062 #[serde(default)]
8063 pub options: Vec<Expression>,
8064 #[serde(default)]
8065 pub include: Option<Box<Expression>>,
8066}
8067
8068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8070#[cfg_attr(feature = "bindings", derive(TS))]
8071pub struct IntoClause {
8072 #[serde(default)]
8073 pub this: Option<Box<Expression>>,
8074 #[serde(default)]
8075 pub temporary: bool,
8076 #[serde(default)]
8077 pub unlogged: Option<Box<Expression>>,
8078 #[serde(default)]
8079 pub bulk_collect: Option<Box<Expression>>,
8080 #[serde(default)]
8081 pub expressions: Vec<Expression>,
8082}
8083
8084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8086#[cfg_attr(feature = "bindings", derive(TS))]
8087pub struct JoinHint {
8088 pub this: Box<Expression>,
8089 #[serde(default)]
8090 pub expressions: Vec<Expression>,
8091}
8092
8093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8095#[cfg_attr(feature = "bindings", derive(TS))]
8096pub struct Opclass {
8097 pub this: Box<Expression>,
8098 pub expression: Box<Expression>,
8099}
8100
8101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8103#[cfg_attr(feature = "bindings", derive(TS))]
8104pub struct Index {
8105 #[serde(default)]
8106 pub this: Option<Box<Expression>>,
8107 #[serde(default)]
8108 pub table: Option<Box<Expression>>,
8109 #[serde(default)]
8110 pub unique: bool,
8111 #[serde(default)]
8112 pub primary: Option<Box<Expression>>,
8113 #[serde(default)]
8114 pub amp: Option<Box<Expression>>,
8115 #[serde(default)]
8116 pub params: Vec<Expression>,
8117}
8118
8119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8121#[cfg_attr(feature = "bindings", derive(TS))]
8122pub struct IndexParameters {
8123 #[serde(default)]
8124 pub using: Option<Box<Expression>>,
8125 #[serde(default)]
8126 pub include: Option<Box<Expression>>,
8127 #[serde(default)]
8128 pub columns: Vec<Expression>,
8129 #[serde(default)]
8130 pub with_storage: Option<Box<Expression>>,
8131 #[serde(default)]
8132 pub partition_by: Option<Box<Expression>>,
8133 #[serde(default)]
8134 pub tablespace: Option<Box<Expression>>,
8135 #[serde(default)]
8136 pub where_: Option<Box<Expression>>,
8137 #[serde(default)]
8138 pub on: Option<Box<Expression>>,
8139}
8140
8141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8143#[cfg_attr(feature = "bindings", derive(TS))]
8144pub struct ConditionalInsert {
8145 pub this: Box<Expression>,
8146 #[serde(default)]
8147 pub expression: Option<Box<Expression>>,
8148 #[serde(default)]
8149 pub else_: Option<Box<Expression>>,
8150}
8151
8152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8154#[cfg_attr(feature = "bindings", derive(TS))]
8155pub struct MultitableInserts {
8156 #[serde(default)]
8157 pub expressions: Vec<Expression>,
8158 pub kind: String,
8159 #[serde(default)]
8160 pub source: Option<Box<Expression>>,
8161 #[serde(default)]
8163 pub leading_comments: Vec<String>,
8164}
8165
8166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8168#[cfg_attr(feature = "bindings", derive(TS))]
8169pub struct OnConflict {
8170 #[serde(default)]
8171 pub duplicate: Option<Box<Expression>>,
8172 #[serde(default)]
8173 pub expressions: Vec<Expression>,
8174 #[serde(default)]
8175 pub action: Option<Box<Expression>>,
8176 #[serde(default)]
8177 pub conflict_keys: Option<Box<Expression>>,
8178 #[serde(default)]
8179 pub index_predicate: Option<Box<Expression>>,
8180 #[serde(default)]
8181 pub constraint: Option<Box<Expression>>,
8182 #[serde(default)]
8183 pub where_: Option<Box<Expression>>,
8184}
8185
8186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8188#[cfg_attr(feature = "bindings", derive(TS))]
8189pub struct OnCondition {
8190 #[serde(default)]
8191 pub error: Option<Box<Expression>>,
8192 #[serde(default)]
8193 pub empty: Option<Box<Expression>>,
8194 #[serde(default)]
8195 pub null: Option<Box<Expression>>,
8196}
8197
8198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8200#[cfg_attr(feature = "bindings", derive(TS))]
8201pub struct Returning {
8202 #[serde(default)]
8203 pub expressions: Vec<Expression>,
8204 #[serde(default)]
8205 pub into: Option<Box<Expression>>,
8206}
8207
8208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8210#[cfg_attr(feature = "bindings", derive(TS))]
8211pub struct Introducer {
8212 pub this: Box<Expression>,
8213 pub expression: Box<Expression>,
8214}
8215
8216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8218#[cfg_attr(feature = "bindings", derive(TS))]
8219pub struct PartitionRange {
8220 pub this: Box<Expression>,
8221 #[serde(default)]
8222 pub expression: Option<Box<Expression>>,
8223 #[serde(default)]
8224 pub expressions: Vec<Expression>,
8225}
8226
8227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8229#[cfg_attr(feature = "bindings", derive(TS))]
8230pub struct Group {
8231 #[serde(default)]
8232 pub expressions: Vec<Expression>,
8233 #[serde(default)]
8234 pub grouping_sets: Option<Box<Expression>>,
8235 #[serde(default)]
8236 pub cube: Option<Box<Expression>>,
8237 #[serde(default)]
8238 pub rollup: Option<Box<Expression>>,
8239 #[serde(default)]
8240 pub totals: Option<Box<Expression>>,
8241 #[serde(default)]
8243 pub all: Option<bool>,
8244}
8245
8246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8248#[cfg_attr(feature = "bindings", derive(TS))]
8249pub struct Cube {
8250 #[serde(default)]
8251 pub expressions: Vec<Expression>,
8252}
8253
8254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8256#[cfg_attr(feature = "bindings", derive(TS))]
8257pub struct Rollup {
8258 #[serde(default)]
8259 pub expressions: Vec<Expression>,
8260}
8261
8262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8264#[cfg_attr(feature = "bindings", derive(TS))]
8265pub struct GroupingSets {
8266 #[serde(default)]
8267 pub expressions: Vec<Expression>,
8268}
8269
8270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8272#[cfg_attr(feature = "bindings", derive(TS))]
8273pub struct LimitOptions {
8274 #[serde(default)]
8275 pub percent: Option<Box<Expression>>,
8276 #[serde(default)]
8277 pub rows: Option<Box<Expression>>,
8278 #[serde(default)]
8279 pub with_ties: Option<Box<Expression>>,
8280}
8281
8282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8284#[cfg_attr(feature = "bindings", derive(TS))]
8285pub struct Lateral {
8286 pub this: Box<Expression>,
8287 #[serde(default)]
8288 pub view: Option<Box<Expression>>,
8289 #[serde(default)]
8290 pub outer: Option<Box<Expression>>,
8291 #[serde(default)]
8292 pub alias: Option<String>,
8293 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8295 pub alias_quoted: bool,
8296 #[serde(default)]
8297 pub cross_apply: Option<Box<Expression>>,
8298 #[serde(default)]
8299 pub ordinality: Option<Box<Expression>>,
8300 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8302 pub column_aliases: Vec<String>,
8303}
8304
8305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8307#[cfg_attr(feature = "bindings", derive(TS))]
8308pub struct TableFromRows {
8309 pub this: Box<Expression>,
8310 #[serde(default)]
8311 pub alias: Option<String>,
8312 #[serde(default)]
8313 pub joins: Vec<Expression>,
8314 #[serde(default)]
8315 pub pivots: Option<Box<Expression>>,
8316 #[serde(default)]
8317 pub sample: Option<Box<Expression>>,
8318}
8319
8320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8323#[cfg_attr(feature = "bindings", derive(TS))]
8324pub struct RowsFrom {
8325 pub expressions: Vec<Expression>,
8327 #[serde(default)]
8329 pub ordinality: bool,
8330 #[serde(default)]
8332 pub alias: Option<Box<Expression>>,
8333}
8334
8335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8337#[cfg_attr(feature = "bindings", derive(TS))]
8338pub struct WithFill {
8339 #[serde(default)]
8340 pub from_: Option<Box<Expression>>,
8341 #[serde(default)]
8342 pub to: Option<Box<Expression>>,
8343 #[serde(default)]
8344 pub step: Option<Box<Expression>>,
8345 #[serde(default)]
8346 pub interpolate: Option<Box<Expression>>,
8347}
8348
8349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8351#[cfg_attr(feature = "bindings", derive(TS))]
8352pub struct Property {
8353 pub this: Box<Expression>,
8354 #[serde(default)]
8355 pub value: Option<Box<Expression>>,
8356}
8357
8358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8360#[cfg_attr(feature = "bindings", derive(TS))]
8361pub struct GrantPrivilege {
8362 pub this: Box<Expression>,
8363 #[serde(default)]
8364 pub expressions: Vec<Expression>,
8365}
8366
8367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8369#[cfg_attr(feature = "bindings", derive(TS))]
8370pub struct AllowedValuesProperty {
8371 #[serde(default)]
8372 pub expressions: Vec<Expression>,
8373}
8374
8375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8377#[cfg_attr(feature = "bindings", derive(TS))]
8378pub struct AlgorithmProperty {
8379 pub this: Box<Expression>,
8380}
8381
8382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8384#[cfg_attr(feature = "bindings", derive(TS))]
8385pub struct AutoIncrementProperty {
8386 pub this: Box<Expression>,
8387}
8388
8389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8391#[cfg_attr(feature = "bindings", derive(TS))]
8392pub struct AutoRefreshProperty {
8393 pub this: Box<Expression>,
8394}
8395
8396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8398#[cfg_attr(feature = "bindings", derive(TS))]
8399pub struct BackupProperty {
8400 pub this: Box<Expression>,
8401}
8402
8403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8405#[cfg_attr(feature = "bindings", derive(TS))]
8406pub struct BuildProperty {
8407 pub this: Box<Expression>,
8408}
8409
8410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8412#[cfg_attr(feature = "bindings", derive(TS))]
8413pub struct BlockCompressionProperty {
8414 #[serde(default)]
8415 pub autotemp: Option<Box<Expression>>,
8416 #[serde(default)]
8417 pub always: Option<Box<Expression>>,
8418 #[serde(default)]
8419 pub default: Option<Box<Expression>>,
8420 #[serde(default)]
8421 pub manual: Option<Box<Expression>>,
8422 #[serde(default)]
8423 pub never: Option<Box<Expression>>,
8424}
8425
8426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8428#[cfg_attr(feature = "bindings", derive(TS))]
8429pub struct CharacterSetProperty {
8430 pub this: Box<Expression>,
8431 #[serde(default)]
8432 pub default: Option<Box<Expression>>,
8433}
8434
8435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8437#[cfg_attr(feature = "bindings", derive(TS))]
8438pub struct ChecksumProperty {
8439 #[serde(default)]
8440 pub on: Option<Box<Expression>>,
8441 #[serde(default)]
8442 pub default: Option<Box<Expression>>,
8443}
8444
8445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8447#[cfg_attr(feature = "bindings", derive(TS))]
8448pub struct CollateProperty {
8449 pub this: Box<Expression>,
8450 #[serde(default)]
8451 pub default: Option<Box<Expression>>,
8452}
8453
8454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8456#[cfg_attr(feature = "bindings", derive(TS))]
8457pub struct DataBlocksizeProperty {
8458 #[serde(default)]
8459 pub size: Option<i64>,
8460 #[serde(default)]
8461 pub units: Option<Box<Expression>>,
8462 #[serde(default)]
8463 pub minimum: Option<Box<Expression>>,
8464 #[serde(default)]
8465 pub maximum: Option<Box<Expression>>,
8466 #[serde(default)]
8467 pub default: Option<Box<Expression>>,
8468}
8469
8470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8472#[cfg_attr(feature = "bindings", derive(TS))]
8473pub struct DataDeletionProperty {
8474 pub on: Box<Expression>,
8475 #[serde(default)]
8476 pub filter_column: Option<Box<Expression>>,
8477 #[serde(default)]
8478 pub retention_period: Option<Box<Expression>>,
8479}
8480
8481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8483#[cfg_attr(feature = "bindings", derive(TS))]
8484pub struct DefinerProperty {
8485 pub this: Box<Expression>,
8486}
8487
8488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8490#[cfg_attr(feature = "bindings", derive(TS))]
8491pub struct DistKeyProperty {
8492 pub this: Box<Expression>,
8493}
8494
8495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8497#[cfg_attr(feature = "bindings", derive(TS))]
8498pub struct DistributedByProperty {
8499 #[serde(default)]
8500 pub expressions: Vec<Expression>,
8501 pub kind: String,
8502 #[serde(default)]
8503 pub buckets: Option<Box<Expression>>,
8504 #[serde(default)]
8505 pub order: Option<Box<Expression>>,
8506}
8507
8508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8510#[cfg_attr(feature = "bindings", derive(TS))]
8511pub struct DistStyleProperty {
8512 pub this: Box<Expression>,
8513}
8514
8515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8517#[cfg_attr(feature = "bindings", derive(TS))]
8518pub struct DuplicateKeyProperty {
8519 #[serde(default)]
8520 pub expressions: Vec<Expression>,
8521}
8522
8523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8525#[cfg_attr(feature = "bindings", derive(TS))]
8526pub struct EngineProperty {
8527 pub this: Box<Expression>,
8528}
8529
8530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8532#[cfg_attr(feature = "bindings", derive(TS))]
8533pub struct ToTableProperty {
8534 pub this: Box<Expression>,
8535}
8536
8537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8539#[cfg_attr(feature = "bindings", derive(TS))]
8540pub struct ExecuteAsProperty {
8541 pub this: Box<Expression>,
8542}
8543
8544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8546#[cfg_attr(feature = "bindings", derive(TS))]
8547pub struct ExternalProperty {
8548 #[serde(default)]
8549 pub this: Option<Box<Expression>>,
8550}
8551
8552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8554#[cfg_attr(feature = "bindings", derive(TS))]
8555pub struct FallbackProperty {
8556 #[serde(default)]
8557 pub no: Option<Box<Expression>>,
8558 #[serde(default)]
8559 pub protection: Option<Box<Expression>>,
8560}
8561
8562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8564#[cfg_attr(feature = "bindings", derive(TS))]
8565pub struct FileFormatProperty {
8566 #[serde(default)]
8567 pub this: Option<Box<Expression>>,
8568 #[serde(default)]
8569 pub expressions: Vec<Expression>,
8570 #[serde(default)]
8571 pub hive_format: Option<Box<Expression>>,
8572}
8573
8574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8576#[cfg_attr(feature = "bindings", derive(TS))]
8577pub struct CredentialsProperty {
8578 #[serde(default)]
8579 pub expressions: Vec<Expression>,
8580}
8581
8582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8584#[cfg_attr(feature = "bindings", derive(TS))]
8585pub struct FreespaceProperty {
8586 pub this: Box<Expression>,
8587 #[serde(default)]
8588 pub percent: Option<Box<Expression>>,
8589}
8590
8591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8593#[cfg_attr(feature = "bindings", derive(TS))]
8594pub struct InheritsProperty {
8595 #[serde(default)]
8596 pub expressions: Vec<Expression>,
8597}
8598
8599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8601#[cfg_attr(feature = "bindings", derive(TS))]
8602pub struct InputModelProperty {
8603 pub this: Box<Expression>,
8604}
8605
8606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8608#[cfg_attr(feature = "bindings", derive(TS))]
8609pub struct OutputModelProperty {
8610 pub this: Box<Expression>,
8611}
8612
8613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8615#[cfg_attr(feature = "bindings", derive(TS))]
8616pub struct IsolatedLoadingProperty {
8617 #[serde(default)]
8618 pub no: Option<Box<Expression>>,
8619 #[serde(default)]
8620 pub concurrent: Option<Box<Expression>>,
8621 #[serde(default)]
8622 pub target: Option<Box<Expression>>,
8623}
8624
8625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8627#[cfg_attr(feature = "bindings", derive(TS))]
8628pub struct JournalProperty {
8629 #[serde(default)]
8630 pub no: Option<Box<Expression>>,
8631 #[serde(default)]
8632 pub dual: Option<Box<Expression>>,
8633 #[serde(default)]
8634 pub before: Option<Box<Expression>>,
8635 #[serde(default)]
8636 pub local: Option<Box<Expression>>,
8637 #[serde(default)]
8638 pub after: Option<Box<Expression>>,
8639}
8640
8641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8643#[cfg_attr(feature = "bindings", derive(TS))]
8644pub struct LanguageProperty {
8645 pub this: Box<Expression>,
8646}
8647
8648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8650#[cfg_attr(feature = "bindings", derive(TS))]
8651pub struct EnviromentProperty {
8652 #[serde(default)]
8653 pub expressions: Vec<Expression>,
8654}
8655
8656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8658#[cfg_attr(feature = "bindings", derive(TS))]
8659pub struct ClusteredByProperty {
8660 #[serde(default)]
8661 pub expressions: Vec<Expression>,
8662 #[serde(default)]
8663 pub sorted_by: Option<Box<Expression>>,
8664 #[serde(default)]
8665 pub buckets: Option<Box<Expression>>,
8666}
8667
8668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8670#[cfg_attr(feature = "bindings", derive(TS))]
8671pub struct DictProperty {
8672 pub this: Box<Expression>,
8673 pub kind: String,
8674 #[serde(default)]
8675 pub settings: Option<Box<Expression>>,
8676}
8677
8678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8680#[cfg_attr(feature = "bindings", derive(TS))]
8681pub struct DictRange {
8682 pub this: Box<Expression>,
8683 #[serde(default)]
8684 pub min: Option<Box<Expression>>,
8685 #[serde(default)]
8686 pub max: Option<Box<Expression>>,
8687}
8688
8689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8691#[cfg_attr(feature = "bindings", derive(TS))]
8692pub struct OnCluster {
8693 pub this: Box<Expression>,
8694}
8695
8696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8698#[cfg_attr(feature = "bindings", derive(TS))]
8699pub struct LikeProperty {
8700 pub this: Box<Expression>,
8701 #[serde(default)]
8702 pub expressions: Vec<Expression>,
8703}
8704
8705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8707#[cfg_attr(feature = "bindings", derive(TS))]
8708pub struct LocationProperty {
8709 pub this: Box<Expression>,
8710}
8711
8712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8714#[cfg_attr(feature = "bindings", derive(TS))]
8715pub struct LockProperty {
8716 pub this: Box<Expression>,
8717}
8718
8719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8721#[cfg_attr(feature = "bindings", derive(TS))]
8722pub struct LockingProperty {
8723 #[serde(default)]
8724 pub this: Option<Box<Expression>>,
8725 pub kind: String,
8726 #[serde(default)]
8727 pub for_or_in: Option<Box<Expression>>,
8728 #[serde(default)]
8729 pub lock_type: Option<Box<Expression>>,
8730 #[serde(default)]
8731 pub override_: Option<Box<Expression>>,
8732}
8733
8734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8736#[cfg_attr(feature = "bindings", derive(TS))]
8737pub struct LogProperty {
8738 #[serde(default)]
8739 pub no: Option<Box<Expression>>,
8740}
8741
8742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8744#[cfg_attr(feature = "bindings", derive(TS))]
8745pub struct MaterializedProperty {
8746 #[serde(default)]
8747 pub this: Option<Box<Expression>>,
8748}
8749
8750#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8752#[cfg_attr(feature = "bindings", derive(TS))]
8753pub struct MergeBlockRatioProperty {
8754 #[serde(default)]
8755 pub this: Option<Box<Expression>>,
8756 #[serde(default)]
8757 pub no: Option<Box<Expression>>,
8758 #[serde(default)]
8759 pub default: Option<Box<Expression>>,
8760 #[serde(default)]
8761 pub percent: Option<Box<Expression>>,
8762}
8763
8764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8766#[cfg_attr(feature = "bindings", derive(TS))]
8767pub struct OnProperty {
8768 pub this: Box<Expression>,
8769}
8770
8771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8773#[cfg_attr(feature = "bindings", derive(TS))]
8774pub struct OnCommitProperty {
8775 #[serde(default)]
8776 pub delete: Option<Box<Expression>>,
8777}
8778
8779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8781#[cfg_attr(feature = "bindings", derive(TS))]
8782pub struct PartitionedByProperty {
8783 pub this: Box<Expression>,
8784}
8785
8786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8788#[cfg_attr(feature = "bindings", derive(TS))]
8789pub struct PartitionedByBucket {
8790 pub this: Box<Expression>,
8791 pub expression: Box<Expression>,
8792}
8793
8794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8796#[cfg_attr(feature = "bindings", derive(TS))]
8797pub struct PartitionByTruncate {
8798 pub this: Box<Expression>,
8799 pub expression: Box<Expression>,
8800}
8801
8802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8804#[cfg_attr(feature = "bindings", derive(TS))]
8805pub struct PartitionByRangeProperty {
8806 #[serde(default)]
8807 pub partition_expressions: Option<Box<Expression>>,
8808 #[serde(default)]
8809 pub create_expressions: Option<Box<Expression>>,
8810}
8811
8812#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8814#[cfg_attr(feature = "bindings", derive(TS))]
8815pub struct PartitionByRangePropertyDynamic {
8816 #[serde(default)]
8817 pub this: Option<Box<Expression>>,
8818 #[serde(default)]
8819 pub start: Option<Box<Expression>>,
8820 #[serde(default)]
8821 pub end: Option<Box<Expression>>,
8822 #[serde(default)]
8823 pub every: Option<Box<Expression>>,
8824}
8825
8826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8828#[cfg_attr(feature = "bindings", derive(TS))]
8829pub struct PartitionByListProperty {
8830 #[serde(default)]
8831 pub partition_expressions: Option<Box<Expression>>,
8832 #[serde(default)]
8833 pub create_expressions: Option<Box<Expression>>,
8834}
8835
8836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8838#[cfg_attr(feature = "bindings", derive(TS))]
8839pub struct PartitionList {
8840 pub this: Box<Expression>,
8841 #[serde(default)]
8842 pub expressions: Vec<Expression>,
8843}
8844
8845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8847#[cfg_attr(feature = "bindings", derive(TS))]
8848pub struct Partition {
8849 pub expressions: Vec<Expression>,
8850 #[serde(default)]
8851 pub subpartition: bool,
8852}
8853
8854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8857#[cfg_attr(feature = "bindings", derive(TS))]
8858pub struct RefreshTriggerProperty {
8859 pub method: String,
8861 #[serde(default)]
8863 pub kind: Option<String>,
8864 #[serde(default)]
8866 pub every: Option<Box<Expression>>,
8867 #[serde(default)]
8869 pub unit: Option<String>,
8870 #[serde(default)]
8872 pub starts: Option<Box<Expression>>,
8873}
8874
8875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8877#[cfg_attr(feature = "bindings", derive(TS))]
8878pub struct UniqueKeyProperty {
8879 #[serde(default)]
8880 pub expressions: Vec<Expression>,
8881}
8882
8883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8885#[cfg_attr(feature = "bindings", derive(TS))]
8886pub struct RollupProperty {
8887 pub expressions: Vec<RollupIndex>,
8888}
8889
8890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8892#[cfg_attr(feature = "bindings", derive(TS))]
8893pub struct RollupIndex {
8894 pub name: Identifier,
8895 pub expressions: Vec<Identifier>,
8896}
8897
8898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8900#[cfg_attr(feature = "bindings", derive(TS))]
8901pub struct PartitionBoundSpec {
8902 #[serde(default)]
8903 pub this: Option<Box<Expression>>,
8904 #[serde(default)]
8905 pub expression: Option<Box<Expression>>,
8906 #[serde(default)]
8907 pub from_expressions: Option<Box<Expression>>,
8908 #[serde(default)]
8909 pub to_expressions: Option<Box<Expression>>,
8910}
8911
8912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8914#[cfg_attr(feature = "bindings", derive(TS))]
8915pub struct PartitionedOfProperty {
8916 pub this: Box<Expression>,
8917 pub expression: Box<Expression>,
8918}
8919
8920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8922#[cfg_attr(feature = "bindings", derive(TS))]
8923pub struct RemoteWithConnectionModelProperty {
8924 pub this: Box<Expression>,
8925}
8926
8927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8929#[cfg_attr(feature = "bindings", derive(TS))]
8930pub struct ReturnsProperty {
8931 #[serde(default)]
8932 pub this: Option<Box<Expression>>,
8933 #[serde(default)]
8934 pub is_table: Option<Box<Expression>>,
8935 #[serde(default)]
8936 pub table: Option<Box<Expression>>,
8937 #[serde(default)]
8938 pub null: Option<Box<Expression>>,
8939}
8940
8941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8943#[cfg_attr(feature = "bindings", derive(TS))]
8944pub struct RowFormatProperty {
8945 pub this: Box<Expression>,
8946}
8947
8948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8950#[cfg_attr(feature = "bindings", derive(TS))]
8951pub struct RowFormatDelimitedProperty {
8952 #[serde(default)]
8953 pub fields: Option<Box<Expression>>,
8954 #[serde(default)]
8955 pub escaped: Option<Box<Expression>>,
8956 #[serde(default)]
8957 pub collection_items: Option<Box<Expression>>,
8958 #[serde(default)]
8959 pub map_keys: Option<Box<Expression>>,
8960 #[serde(default)]
8961 pub lines: Option<Box<Expression>>,
8962 #[serde(default)]
8963 pub null: Option<Box<Expression>>,
8964 #[serde(default)]
8965 pub serde: Option<Box<Expression>>,
8966}
8967
8968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8970#[cfg_attr(feature = "bindings", derive(TS))]
8971pub struct RowFormatSerdeProperty {
8972 pub this: Box<Expression>,
8973 #[serde(default)]
8974 pub serde_properties: Option<Box<Expression>>,
8975}
8976
8977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8979#[cfg_attr(feature = "bindings", derive(TS))]
8980pub struct QueryTransform {
8981 #[serde(default)]
8982 pub expressions: Vec<Expression>,
8983 #[serde(default)]
8984 pub command_script: Option<Box<Expression>>,
8985 #[serde(default)]
8986 pub schema: Option<Box<Expression>>,
8987 #[serde(default)]
8988 pub row_format_before: Option<Box<Expression>>,
8989 #[serde(default)]
8990 pub record_writer: Option<Box<Expression>>,
8991 #[serde(default)]
8992 pub row_format_after: Option<Box<Expression>>,
8993 #[serde(default)]
8994 pub record_reader: Option<Box<Expression>>,
8995}
8996
8997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8999#[cfg_attr(feature = "bindings", derive(TS))]
9000pub struct SampleProperty {
9001 pub this: Box<Expression>,
9002}
9003
9004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9006#[cfg_attr(feature = "bindings", derive(TS))]
9007pub struct SecurityProperty {
9008 pub this: Box<Expression>,
9009}
9010
9011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9013#[cfg_attr(feature = "bindings", derive(TS))]
9014pub struct SchemaCommentProperty {
9015 pub this: Box<Expression>,
9016}
9017
9018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9020#[cfg_attr(feature = "bindings", derive(TS))]
9021pub struct SemanticView {
9022 pub this: Box<Expression>,
9023 #[serde(default)]
9024 pub metrics: Option<Box<Expression>>,
9025 #[serde(default)]
9026 pub dimensions: Option<Box<Expression>>,
9027 #[serde(default)]
9028 pub facts: Option<Box<Expression>>,
9029 #[serde(default)]
9030 pub where_: Option<Box<Expression>>,
9031}
9032
9033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9035#[cfg_attr(feature = "bindings", derive(TS))]
9036pub struct SerdeProperties {
9037 #[serde(default)]
9038 pub expressions: Vec<Expression>,
9039 #[serde(default)]
9040 pub with_: Option<Box<Expression>>,
9041}
9042
9043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9045#[cfg_attr(feature = "bindings", derive(TS))]
9046pub struct SetProperty {
9047 #[serde(default)]
9048 pub multi: Option<Box<Expression>>,
9049}
9050
9051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9053#[cfg_attr(feature = "bindings", derive(TS))]
9054pub struct SharingProperty {
9055 #[serde(default)]
9056 pub this: Option<Box<Expression>>,
9057}
9058
9059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9061#[cfg_attr(feature = "bindings", derive(TS))]
9062pub struct SetConfigProperty {
9063 pub this: Box<Expression>,
9064}
9065
9066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9068#[cfg_attr(feature = "bindings", derive(TS))]
9069pub struct SettingsProperty {
9070 #[serde(default)]
9071 pub expressions: Vec<Expression>,
9072}
9073
9074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9076#[cfg_attr(feature = "bindings", derive(TS))]
9077pub struct SortKeyProperty {
9078 pub this: Box<Expression>,
9079 #[serde(default)]
9080 pub compound: Option<Box<Expression>>,
9081}
9082
9083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9085#[cfg_attr(feature = "bindings", derive(TS))]
9086pub struct SqlReadWriteProperty {
9087 pub this: Box<Expression>,
9088}
9089
9090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9092#[cfg_attr(feature = "bindings", derive(TS))]
9093pub struct SqlSecurityProperty {
9094 pub this: Box<Expression>,
9095}
9096
9097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9099#[cfg_attr(feature = "bindings", derive(TS))]
9100pub struct StabilityProperty {
9101 pub this: Box<Expression>,
9102}
9103
9104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9106#[cfg_attr(feature = "bindings", derive(TS))]
9107pub struct StorageHandlerProperty {
9108 pub this: Box<Expression>,
9109}
9110
9111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9113#[cfg_attr(feature = "bindings", derive(TS))]
9114pub struct TemporaryProperty {
9115 #[serde(default)]
9116 pub this: Option<Box<Expression>>,
9117}
9118
9119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9121#[cfg_attr(feature = "bindings", derive(TS))]
9122pub struct Tags {
9123 #[serde(default)]
9124 pub expressions: Vec<Expression>,
9125}
9126
9127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9129#[cfg_attr(feature = "bindings", derive(TS))]
9130pub struct TransformModelProperty {
9131 #[serde(default)]
9132 pub expressions: Vec<Expression>,
9133}
9134
9135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9137#[cfg_attr(feature = "bindings", derive(TS))]
9138pub struct TransientProperty {
9139 #[serde(default)]
9140 pub this: Option<Box<Expression>>,
9141}
9142
9143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9145#[cfg_attr(feature = "bindings", derive(TS))]
9146pub struct UsingTemplateProperty {
9147 pub this: Box<Expression>,
9148}
9149
9150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9152#[cfg_attr(feature = "bindings", derive(TS))]
9153pub struct ViewAttributeProperty {
9154 pub this: Box<Expression>,
9155}
9156
9157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9159#[cfg_attr(feature = "bindings", derive(TS))]
9160pub struct VolatileProperty {
9161 #[serde(default)]
9162 pub this: Option<Box<Expression>>,
9163}
9164
9165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9167#[cfg_attr(feature = "bindings", derive(TS))]
9168pub struct WithDataProperty {
9169 #[serde(default)]
9170 pub no: Option<Box<Expression>>,
9171 #[serde(default)]
9172 pub statistics: Option<Box<Expression>>,
9173}
9174
9175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9177#[cfg_attr(feature = "bindings", derive(TS))]
9178pub struct WithJournalTableProperty {
9179 pub this: Box<Expression>,
9180}
9181
9182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9184#[cfg_attr(feature = "bindings", derive(TS))]
9185pub struct WithSchemaBindingProperty {
9186 pub this: Box<Expression>,
9187}
9188
9189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9191#[cfg_attr(feature = "bindings", derive(TS))]
9192pub struct WithSystemVersioningProperty {
9193 #[serde(default)]
9194 pub on: Option<Box<Expression>>,
9195 #[serde(default)]
9196 pub this: Option<Box<Expression>>,
9197 #[serde(default)]
9198 pub data_consistency: Option<Box<Expression>>,
9199 #[serde(default)]
9200 pub retention_period: Option<Box<Expression>>,
9201 #[serde(default)]
9202 pub with_: Option<Box<Expression>>,
9203}
9204
9205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9207#[cfg_attr(feature = "bindings", derive(TS))]
9208pub struct WithProcedureOptions {
9209 #[serde(default)]
9210 pub expressions: Vec<Expression>,
9211}
9212
9213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9215#[cfg_attr(feature = "bindings", derive(TS))]
9216pub struct EncodeProperty {
9217 pub this: Box<Expression>,
9218 #[serde(default)]
9219 pub properties: Vec<Expression>,
9220 #[serde(default)]
9221 pub key: Option<Box<Expression>>,
9222}
9223
9224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9226#[cfg_attr(feature = "bindings", derive(TS))]
9227pub struct IncludeProperty {
9228 pub this: Box<Expression>,
9229 #[serde(default)]
9230 pub alias: Option<String>,
9231 #[serde(default)]
9232 pub column_def: Option<Box<Expression>>,
9233}
9234
9235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9237#[cfg_attr(feature = "bindings", derive(TS))]
9238pub struct Properties {
9239 #[serde(default)]
9240 pub expressions: Vec<Expression>,
9241}
9242
9243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9245#[cfg_attr(feature = "bindings", derive(TS))]
9246pub struct InputOutputFormat {
9247 #[serde(default)]
9248 pub input_format: Option<Box<Expression>>,
9249 #[serde(default)]
9250 pub output_format: Option<Box<Expression>>,
9251}
9252
9253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9255#[cfg_attr(feature = "bindings", derive(TS))]
9256pub struct Reference {
9257 pub this: Box<Expression>,
9258 #[serde(default)]
9259 pub expressions: Vec<Expression>,
9260 #[serde(default)]
9261 pub options: Vec<Expression>,
9262}
9263
9264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9266#[cfg_attr(feature = "bindings", derive(TS))]
9267pub struct QueryOption {
9268 pub this: Box<Expression>,
9269 #[serde(default)]
9270 pub expression: Option<Box<Expression>>,
9271}
9272
9273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9275#[cfg_attr(feature = "bindings", derive(TS))]
9276pub struct WithTableHint {
9277 #[serde(default)]
9278 pub expressions: Vec<Expression>,
9279}
9280
9281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9283#[cfg_attr(feature = "bindings", derive(TS))]
9284pub struct IndexTableHint {
9285 pub this: Box<Expression>,
9286 #[serde(default)]
9287 pub expressions: Vec<Expression>,
9288 #[serde(default)]
9289 pub target: Option<Box<Expression>>,
9290}
9291
9292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9294#[cfg_attr(feature = "bindings", derive(TS))]
9295pub struct Get {
9296 pub this: Box<Expression>,
9297 #[serde(default)]
9298 pub target: Option<Box<Expression>>,
9299 #[serde(default)]
9300 pub properties: Vec<Expression>,
9301}
9302
9303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9305#[cfg_attr(feature = "bindings", derive(TS))]
9306pub struct SetOperation {
9307 #[serde(default)]
9308 pub with_: Option<Box<Expression>>,
9309 pub this: Box<Expression>,
9310 pub expression: Box<Expression>,
9311 #[serde(default)]
9312 pub distinct: bool,
9313 #[serde(default)]
9314 pub by_name: Option<Box<Expression>>,
9315 #[serde(default)]
9316 pub side: Option<Box<Expression>>,
9317 #[serde(default)]
9318 pub kind: Option<String>,
9319 #[serde(default)]
9320 pub on: Option<Box<Expression>>,
9321}
9322
9323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9325#[cfg_attr(feature = "bindings", derive(TS))]
9326pub struct Var {
9327 pub this: String,
9328}
9329
9330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9332#[cfg_attr(feature = "bindings", derive(TS))]
9333pub struct Version {
9334 pub this: Box<Expression>,
9335 pub kind: String,
9336 #[serde(default)]
9337 pub expression: Option<Box<Expression>>,
9338}
9339
9340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9342#[cfg_attr(feature = "bindings", derive(TS))]
9343pub struct Schema {
9344 #[serde(default)]
9345 pub this: Option<Box<Expression>>,
9346 #[serde(default)]
9347 pub expressions: Vec<Expression>,
9348}
9349
9350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9352#[cfg_attr(feature = "bindings", derive(TS))]
9353pub struct Lock {
9354 #[serde(default)]
9355 pub update: Option<Box<Expression>>,
9356 #[serde(default)]
9357 pub expressions: Vec<Expression>,
9358 #[serde(default)]
9359 pub wait: Option<Box<Expression>>,
9360 #[serde(default)]
9361 pub key: Option<Box<Expression>>,
9362}
9363
9364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9367#[cfg_attr(feature = "bindings", derive(TS))]
9368pub struct TableSample {
9369 #[serde(default, skip_serializing_if = "Option::is_none")]
9371 pub this: Option<Box<Expression>>,
9372 #[serde(default, skip_serializing_if = "Option::is_none")]
9374 pub sample: Option<Box<Sample>>,
9375 #[serde(default)]
9376 pub expressions: Vec<Expression>,
9377 #[serde(default)]
9378 pub method: Option<String>,
9379 #[serde(default)]
9380 pub bucket_numerator: Option<Box<Expression>>,
9381 #[serde(default)]
9382 pub bucket_denominator: Option<Box<Expression>>,
9383 #[serde(default)]
9384 pub bucket_field: Option<Box<Expression>>,
9385 #[serde(default)]
9386 pub percent: Option<Box<Expression>>,
9387 #[serde(default)]
9388 pub rows: Option<Box<Expression>>,
9389 #[serde(default)]
9390 pub size: Option<i64>,
9391 #[serde(default)]
9392 pub seed: Option<Box<Expression>>,
9393}
9394
9395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9397#[cfg_attr(feature = "bindings", derive(TS))]
9398pub struct Tag {
9399 #[serde(default)]
9400 pub this: Option<Box<Expression>>,
9401 #[serde(default)]
9402 pub prefix: Option<Box<Expression>>,
9403 #[serde(default)]
9404 pub postfix: Option<Box<Expression>>,
9405}
9406
9407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9409#[cfg_attr(feature = "bindings", derive(TS))]
9410pub struct UnpivotColumns {
9411 pub this: Box<Expression>,
9412 #[serde(default)]
9413 pub expressions: Vec<Expression>,
9414}
9415
9416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9418#[cfg_attr(feature = "bindings", derive(TS))]
9419pub struct SessionParameter {
9420 pub this: Box<Expression>,
9421 #[serde(default)]
9422 pub kind: Option<String>,
9423}
9424
9425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9427#[cfg_attr(feature = "bindings", derive(TS))]
9428pub struct PseudoType {
9429 pub this: Box<Expression>,
9430}
9431
9432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9434#[cfg_attr(feature = "bindings", derive(TS))]
9435pub struct ObjectIdentifier {
9436 pub this: Box<Expression>,
9437}
9438
9439#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9441#[cfg_attr(feature = "bindings", derive(TS))]
9442pub struct Transaction {
9443 #[serde(default)]
9444 pub this: Option<Box<Expression>>,
9445 #[serde(default)]
9446 pub modes: Option<Box<Expression>>,
9447 #[serde(default)]
9448 pub mark: Option<Box<Expression>>,
9449}
9450
9451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9453#[cfg_attr(feature = "bindings", derive(TS))]
9454pub struct Commit {
9455 #[serde(default)]
9456 pub chain: Option<Box<Expression>>,
9457 #[serde(default)]
9458 pub this: Option<Box<Expression>>,
9459 #[serde(default)]
9460 pub durability: Option<Box<Expression>>,
9461}
9462
9463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9465#[cfg_attr(feature = "bindings", derive(TS))]
9466pub struct Rollback {
9467 #[serde(default)]
9468 pub savepoint: Option<Box<Expression>>,
9469 #[serde(default)]
9470 pub this: Option<Box<Expression>>,
9471}
9472
9473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9475#[cfg_attr(feature = "bindings", derive(TS))]
9476pub struct AlterSession {
9477 #[serde(default)]
9478 pub expressions: Vec<Expression>,
9479 #[serde(default)]
9480 pub unset: Option<Box<Expression>>,
9481}
9482
9483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9485#[cfg_attr(feature = "bindings", derive(TS))]
9486pub struct Analyze {
9487 #[serde(default)]
9488 pub kind: Option<String>,
9489 #[serde(default)]
9490 pub this: Option<Box<Expression>>,
9491 #[serde(default)]
9492 pub options: Vec<Expression>,
9493 #[serde(default)]
9494 pub mode: Option<Box<Expression>>,
9495 #[serde(default)]
9496 pub partition: Option<Box<Expression>>,
9497 #[serde(default)]
9498 pub expression: Option<Box<Expression>>,
9499 #[serde(default)]
9500 pub properties: Vec<Expression>,
9501 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9503 pub columns: Vec<String>,
9504}
9505
9506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9508#[cfg_attr(feature = "bindings", derive(TS))]
9509pub struct AnalyzeStatistics {
9510 pub kind: String,
9511 #[serde(default)]
9512 pub option: Option<Box<Expression>>,
9513 #[serde(default)]
9514 pub this: Option<Box<Expression>>,
9515 #[serde(default)]
9516 pub expressions: Vec<Expression>,
9517}
9518
9519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9521#[cfg_attr(feature = "bindings", derive(TS))]
9522pub struct AnalyzeHistogram {
9523 pub this: Box<Expression>,
9524 #[serde(default)]
9525 pub expressions: Vec<Expression>,
9526 #[serde(default)]
9527 pub expression: Option<Box<Expression>>,
9528 #[serde(default)]
9529 pub update_options: Option<Box<Expression>>,
9530}
9531
9532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9534#[cfg_attr(feature = "bindings", derive(TS))]
9535pub struct AnalyzeSample {
9536 pub kind: String,
9537 #[serde(default)]
9538 pub sample: Option<Box<Expression>>,
9539}
9540
9541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9543#[cfg_attr(feature = "bindings", derive(TS))]
9544pub struct AnalyzeListChainedRows {
9545 #[serde(default)]
9546 pub expression: Option<Box<Expression>>,
9547}
9548
9549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9551#[cfg_attr(feature = "bindings", derive(TS))]
9552pub struct AnalyzeDelete {
9553 #[serde(default)]
9554 pub kind: Option<String>,
9555}
9556
9557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9559#[cfg_attr(feature = "bindings", derive(TS))]
9560pub struct AnalyzeWith {
9561 #[serde(default)]
9562 pub expressions: Vec<Expression>,
9563}
9564
9565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9567#[cfg_attr(feature = "bindings", derive(TS))]
9568pub struct AnalyzeValidate {
9569 pub kind: String,
9570 #[serde(default)]
9571 pub this: Option<Box<Expression>>,
9572 #[serde(default)]
9573 pub expression: Option<Box<Expression>>,
9574}
9575
9576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9578#[cfg_attr(feature = "bindings", derive(TS))]
9579pub struct AddPartition {
9580 pub this: Box<Expression>,
9581 #[serde(default)]
9582 pub exists: bool,
9583 #[serde(default)]
9584 pub location: Option<Box<Expression>>,
9585}
9586
9587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9589#[cfg_attr(feature = "bindings", derive(TS))]
9590pub struct AttachOption {
9591 pub this: Box<Expression>,
9592 #[serde(default)]
9593 pub expression: Option<Box<Expression>>,
9594}
9595
9596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9598#[cfg_attr(feature = "bindings", derive(TS))]
9599pub struct DropPartition {
9600 #[serde(default)]
9601 pub expressions: Vec<Expression>,
9602 #[serde(default)]
9603 pub exists: bool,
9604}
9605
9606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9608#[cfg_attr(feature = "bindings", derive(TS))]
9609pub struct ReplacePartition {
9610 pub expression: Box<Expression>,
9611 #[serde(default)]
9612 pub source: Option<Box<Expression>>,
9613}
9614
9615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9617#[cfg_attr(feature = "bindings", derive(TS))]
9618pub struct DPipe {
9619 pub this: Box<Expression>,
9620 pub expression: Box<Expression>,
9621 #[serde(default)]
9622 pub safe: Option<Box<Expression>>,
9623}
9624
9625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9627#[cfg_attr(feature = "bindings", derive(TS))]
9628pub struct Operator {
9629 pub this: Box<Expression>,
9630 #[serde(default)]
9631 pub operator: Option<Box<Expression>>,
9632 pub expression: Box<Expression>,
9633}
9634
9635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9637#[cfg_attr(feature = "bindings", derive(TS))]
9638pub struct PivotAny {
9639 #[serde(default)]
9640 pub this: Option<Box<Expression>>,
9641}
9642
9643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9645#[cfg_attr(feature = "bindings", derive(TS))]
9646pub struct Aliases {
9647 pub this: Box<Expression>,
9648 #[serde(default)]
9649 pub expressions: Vec<Expression>,
9650}
9651
9652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9654#[cfg_attr(feature = "bindings", derive(TS))]
9655pub struct AtIndex {
9656 pub this: Box<Expression>,
9657 pub expression: Box<Expression>,
9658}
9659
9660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9662#[cfg_attr(feature = "bindings", derive(TS))]
9663pub struct FromTimeZone {
9664 pub this: Box<Expression>,
9665 #[serde(default)]
9666 pub zone: Option<Box<Expression>>,
9667}
9668
9669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9671#[cfg_attr(feature = "bindings", derive(TS))]
9672pub struct FormatPhrase {
9673 pub this: Box<Expression>,
9674 pub format: String,
9675}
9676
9677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9679#[cfg_attr(feature = "bindings", derive(TS))]
9680pub struct ForIn {
9681 pub this: Box<Expression>,
9682 pub expression: Box<Expression>,
9683}
9684
9685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9687#[cfg_attr(feature = "bindings", derive(TS))]
9688pub struct TimeUnit {
9689 #[serde(default)]
9690 pub unit: Option<String>,
9691}
9692
9693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9695#[cfg_attr(feature = "bindings", derive(TS))]
9696pub struct IntervalOp {
9697 #[serde(default)]
9698 pub unit: Option<String>,
9699 pub expression: Box<Expression>,
9700}
9701
9702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9704#[cfg_attr(feature = "bindings", derive(TS))]
9705pub struct HavingMax {
9706 pub this: Box<Expression>,
9707 pub expression: Box<Expression>,
9708 #[serde(default)]
9709 pub max: Option<Box<Expression>>,
9710}
9711
9712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9714#[cfg_attr(feature = "bindings", derive(TS))]
9715pub struct CosineDistance {
9716 pub this: Box<Expression>,
9717 pub expression: Box<Expression>,
9718}
9719
9720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9722#[cfg_attr(feature = "bindings", derive(TS))]
9723pub struct DotProduct {
9724 pub this: Box<Expression>,
9725 pub expression: Box<Expression>,
9726}
9727
9728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9730#[cfg_attr(feature = "bindings", derive(TS))]
9731pub struct EuclideanDistance {
9732 pub this: Box<Expression>,
9733 pub expression: Box<Expression>,
9734}
9735
9736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9738#[cfg_attr(feature = "bindings", derive(TS))]
9739pub struct ManhattanDistance {
9740 pub this: Box<Expression>,
9741 pub expression: Box<Expression>,
9742}
9743
9744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9746#[cfg_attr(feature = "bindings", derive(TS))]
9747pub struct JarowinklerSimilarity {
9748 pub this: Box<Expression>,
9749 pub expression: Box<Expression>,
9750}
9751
9752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9754#[cfg_attr(feature = "bindings", derive(TS))]
9755pub struct Booland {
9756 pub this: Box<Expression>,
9757 pub expression: Box<Expression>,
9758}
9759
9760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9762#[cfg_attr(feature = "bindings", derive(TS))]
9763pub struct Boolor {
9764 pub this: Box<Expression>,
9765 pub expression: Box<Expression>,
9766}
9767
9768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9770#[cfg_attr(feature = "bindings", derive(TS))]
9771pub struct ParameterizedAgg {
9772 pub this: Box<Expression>,
9773 #[serde(default)]
9774 pub expressions: Vec<Expression>,
9775 #[serde(default)]
9776 pub params: Vec<Expression>,
9777}
9778
9779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9781#[cfg_attr(feature = "bindings", derive(TS))]
9782pub struct ArgMax {
9783 pub this: Box<Expression>,
9784 pub expression: Box<Expression>,
9785 #[serde(default)]
9786 pub count: Option<Box<Expression>>,
9787}
9788
9789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9791#[cfg_attr(feature = "bindings", derive(TS))]
9792pub struct ArgMin {
9793 pub this: Box<Expression>,
9794 pub expression: Box<Expression>,
9795 #[serde(default)]
9796 pub count: Option<Box<Expression>>,
9797}
9798
9799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9801#[cfg_attr(feature = "bindings", derive(TS))]
9802pub struct ApproxTopK {
9803 pub this: Box<Expression>,
9804 #[serde(default)]
9805 pub expression: Option<Box<Expression>>,
9806 #[serde(default)]
9807 pub counters: Option<Box<Expression>>,
9808}
9809
9810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9812#[cfg_attr(feature = "bindings", derive(TS))]
9813pub struct ApproxTopKAccumulate {
9814 pub this: Box<Expression>,
9815 #[serde(default)]
9816 pub expression: Option<Box<Expression>>,
9817}
9818
9819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9821#[cfg_attr(feature = "bindings", derive(TS))]
9822pub struct ApproxTopKCombine {
9823 pub this: Box<Expression>,
9824 #[serde(default)]
9825 pub expression: Option<Box<Expression>>,
9826}
9827
9828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9830#[cfg_attr(feature = "bindings", derive(TS))]
9831pub struct ApproxTopKEstimate {
9832 pub this: Box<Expression>,
9833 #[serde(default)]
9834 pub expression: Option<Box<Expression>>,
9835}
9836
9837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9839#[cfg_attr(feature = "bindings", derive(TS))]
9840pub struct ApproxTopSum {
9841 pub this: Box<Expression>,
9842 pub expression: Box<Expression>,
9843 #[serde(default)]
9844 pub count: Option<Box<Expression>>,
9845}
9846
9847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9849#[cfg_attr(feature = "bindings", derive(TS))]
9850pub struct ApproxQuantiles {
9851 pub this: Box<Expression>,
9852 #[serde(default)]
9853 pub expression: Option<Box<Expression>>,
9854}
9855
9856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9858#[cfg_attr(feature = "bindings", derive(TS))]
9859pub struct Minhash {
9860 pub this: Box<Expression>,
9861 #[serde(default)]
9862 pub expressions: Vec<Expression>,
9863}
9864
9865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9867#[cfg_attr(feature = "bindings", derive(TS))]
9868pub struct FarmFingerprint {
9869 #[serde(default)]
9870 pub expressions: Vec<Expression>,
9871}
9872
9873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9875#[cfg_attr(feature = "bindings", derive(TS))]
9876pub struct Float64 {
9877 pub this: Box<Expression>,
9878 #[serde(default)]
9879 pub expression: Option<Box<Expression>>,
9880}
9881
9882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9884#[cfg_attr(feature = "bindings", derive(TS))]
9885pub struct Transform {
9886 pub this: Box<Expression>,
9887 pub expression: Box<Expression>,
9888}
9889
9890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9892#[cfg_attr(feature = "bindings", derive(TS))]
9893pub struct Translate {
9894 pub this: Box<Expression>,
9895 #[serde(default)]
9896 pub from_: Option<Box<Expression>>,
9897 #[serde(default)]
9898 pub to: Option<Box<Expression>>,
9899}
9900
9901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9903#[cfg_attr(feature = "bindings", derive(TS))]
9904pub struct Grouping {
9905 #[serde(default)]
9906 pub expressions: Vec<Expression>,
9907}
9908
9909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9911#[cfg_attr(feature = "bindings", derive(TS))]
9912pub struct GroupingId {
9913 #[serde(default)]
9914 pub expressions: Vec<Expression>,
9915}
9916
9917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9919#[cfg_attr(feature = "bindings", derive(TS))]
9920pub struct Anonymous {
9921 pub this: Box<Expression>,
9922 #[serde(default)]
9923 pub expressions: Vec<Expression>,
9924}
9925
9926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9928#[cfg_attr(feature = "bindings", derive(TS))]
9929pub struct AnonymousAggFunc {
9930 pub this: Box<Expression>,
9931 #[serde(default)]
9932 pub expressions: Vec<Expression>,
9933}
9934
9935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9937#[cfg_attr(feature = "bindings", derive(TS))]
9938pub struct CombinedAggFunc {
9939 pub this: Box<Expression>,
9940 #[serde(default)]
9941 pub expressions: Vec<Expression>,
9942}
9943
9944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9946#[cfg_attr(feature = "bindings", derive(TS))]
9947pub struct CombinedParameterizedAgg {
9948 pub this: Box<Expression>,
9949 #[serde(default)]
9950 pub expressions: Vec<Expression>,
9951 #[serde(default)]
9952 pub params: Vec<Expression>,
9953}
9954
9955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9957#[cfg_attr(feature = "bindings", derive(TS))]
9958pub struct HashAgg {
9959 pub this: Box<Expression>,
9960 #[serde(default)]
9961 pub expressions: Vec<Expression>,
9962}
9963
9964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9966#[cfg_attr(feature = "bindings", derive(TS))]
9967pub struct Hll {
9968 pub this: Box<Expression>,
9969 #[serde(default)]
9970 pub expressions: Vec<Expression>,
9971}
9972
9973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9975#[cfg_attr(feature = "bindings", derive(TS))]
9976pub struct Apply {
9977 pub this: Box<Expression>,
9978 pub expression: Box<Expression>,
9979}
9980
9981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9983#[cfg_attr(feature = "bindings", derive(TS))]
9984pub struct ToBoolean {
9985 pub this: Box<Expression>,
9986 #[serde(default)]
9987 pub safe: Option<Box<Expression>>,
9988}
9989
9990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9992#[cfg_attr(feature = "bindings", derive(TS))]
9993pub struct List {
9994 #[serde(default)]
9995 pub expressions: Vec<Expression>,
9996}
9997
9998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10003#[cfg_attr(feature = "bindings", derive(TS))]
10004pub struct ToMap {
10005 pub this: Box<Expression>,
10007}
10008
10009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10011#[cfg_attr(feature = "bindings", derive(TS))]
10012pub struct Pad {
10013 pub this: Box<Expression>,
10014 pub expression: Box<Expression>,
10015 #[serde(default)]
10016 pub fill_pattern: Option<Box<Expression>>,
10017 #[serde(default)]
10018 pub is_left: Option<Box<Expression>>,
10019}
10020
10021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10023#[cfg_attr(feature = "bindings", derive(TS))]
10024pub struct ToChar {
10025 pub this: Box<Expression>,
10026 #[serde(default)]
10027 pub format: Option<String>,
10028 #[serde(default)]
10029 pub nlsparam: Option<Box<Expression>>,
10030 #[serde(default)]
10031 pub is_numeric: Option<Box<Expression>>,
10032}
10033
10034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10036#[cfg_attr(feature = "bindings", derive(TS))]
10037pub struct StringFunc {
10038 pub this: Box<Expression>,
10039 #[serde(default)]
10040 pub zone: Option<Box<Expression>>,
10041}
10042
10043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10045#[cfg_attr(feature = "bindings", derive(TS))]
10046pub struct ToNumber {
10047 pub this: Box<Expression>,
10048 #[serde(default)]
10049 pub format: Option<Box<Expression>>,
10050 #[serde(default)]
10051 pub nlsparam: Option<Box<Expression>>,
10052 #[serde(default)]
10053 pub precision: Option<Box<Expression>>,
10054 #[serde(default)]
10055 pub scale: Option<Box<Expression>>,
10056 #[serde(default)]
10057 pub safe: Option<Box<Expression>>,
10058 #[serde(default)]
10059 pub safe_name: Option<Box<Expression>>,
10060}
10061
10062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10064#[cfg_attr(feature = "bindings", derive(TS))]
10065pub struct ToDouble {
10066 pub this: Box<Expression>,
10067 #[serde(default)]
10068 pub format: Option<String>,
10069 #[serde(default)]
10070 pub safe: Option<Box<Expression>>,
10071}
10072
10073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10075#[cfg_attr(feature = "bindings", derive(TS))]
10076pub struct ToDecfloat {
10077 pub this: Box<Expression>,
10078 #[serde(default)]
10079 pub format: Option<String>,
10080}
10081
10082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10084#[cfg_attr(feature = "bindings", derive(TS))]
10085pub struct TryToDecfloat {
10086 pub this: Box<Expression>,
10087 #[serde(default)]
10088 pub format: Option<String>,
10089}
10090
10091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10093#[cfg_attr(feature = "bindings", derive(TS))]
10094pub struct ToFile {
10095 pub this: Box<Expression>,
10096 #[serde(default)]
10097 pub path: Option<Box<Expression>>,
10098 #[serde(default)]
10099 pub safe: Option<Box<Expression>>,
10100}
10101
10102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10104#[cfg_attr(feature = "bindings", derive(TS))]
10105pub struct Columns {
10106 pub this: Box<Expression>,
10107 #[serde(default)]
10108 pub unpack: Option<Box<Expression>>,
10109}
10110
10111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10113#[cfg_attr(feature = "bindings", derive(TS))]
10114pub struct ConvertToCharset {
10115 pub this: Box<Expression>,
10116 #[serde(default)]
10117 pub dest: Option<Box<Expression>>,
10118 #[serde(default)]
10119 pub source: Option<Box<Expression>>,
10120}
10121
10122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10124#[cfg_attr(feature = "bindings", derive(TS))]
10125pub struct ConvertTimezone {
10126 #[serde(default)]
10127 pub source_tz: Option<Box<Expression>>,
10128 #[serde(default)]
10129 pub target_tz: Option<Box<Expression>>,
10130 #[serde(default)]
10131 pub timestamp: Option<Box<Expression>>,
10132 #[serde(default)]
10133 pub options: Vec<Expression>,
10134}
10135
10136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10138#[cfg_attr(feature = "bindings", derive(TS))]
10139pub struct GenerateSeries {
10140 #[serde(default)]
10141 pub start: Option<Box<Expression>>,
10142 #[serde(default)]
10143 pub end: Option<Box<Expression>>,
10144 #[serde(default)]
10145 pub step: Option<Box<Expression>>,
10146 #[serde(default)]
10147 pub is_end_exclusive: Option<Box<Expression>>,
10148}
10149
10150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10152#[cfg_attr(feature = "bindings", derive(TS))]
10153pub struct AIAgg {
10154 pub this: Box<Expression>,
10155 pub expression: Box<Expression>,
10156}
10157
10158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10160#[cfg_attr(feature = "bindings", derive(TS))]
10161pub struct AIClassify {
10162 pub this: Box<Expression>,
10163 #[serde(default)]
10164 pub categories: Option<Box<Expression>>,
10165 #[serde(default)]
10166 pub config: Option<Box<Expression>>,
10167}
10168
10169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10171#[cfg_attr(feature = "bindings", derive(TS))]
10172pub struct ArrayAll {
10173 pub this: Box<Expression>,
10174 pub expression: Box<Expression>,
10175}
10176
10177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10179#[cfg_attr(feature = "bindings", derive(TS))]
10180pub struct ArrayAny {
10181 pub this: Box<Expression>,
10182 pub expression: Box<Expression>,
10183}
10184
10185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10187#[cfg_attr(feature = "bindings", derive(TS))]
10188pub struct ArrayConstructCompact {
10189 #[serde(default)]
10190 pub expressions: Vec<Expression>,
10191}
10192
10193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10195#[cfg_attr(feature = "bindings", derive(TS))]
10196pub struct StPoint {
10197 pub this: Box<Expression>,
10198 pub expression: Box<Expression>,
10199 #[serde(default)]
10200 pub null: Option<Box<Expression>>,
10201}
10202
10203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10205#[cfg_attr(feature = "bindings", derive(TS))]
10206pub struct StDistance {
10207 pub this: Box<Expression>,
10208 pub expression: Box<Expression>,
10209 #[serde(default)]
10210 pub use_spheroid: Option<Box<Expression>>,
10211}
10212
10213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10215#[cfg_attr(feature = "bindings", derive(TS))]
10216pub struct StringToArray {
10217 pub this: Box<Expression>,
10218 #[serde(default)]
10219 pub expression: Option<Box<Expression>>,
10220 #[serde(default)]
10221 pub null: Option<Box<Expression>>,
10222}
10223
10224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10226#[cfg_attr(feature = "bindings", derive(TS))]
10227pub struct ArraySum {
10228 pub this: Box<Expression>,
10229 #[serde(default)]
10230 pub expression: Option<Box<Expression>>,
10231}
10232
10233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10235#[cfg_attr(feature = "bindings", derive(TS))]
10236pub struct ObjectAgg {
10237 pub this: Box<Expression>,
10238 pub expression: Box<Expression>,
10239}
10240
10241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10243#[cfg_attr(feature = "bindings", derive(TS))]
10244pub struct CastToStrType {
10245 pub this: Box<Expression>,
10246 #[serde(default)]
10247 pub to: Option<Box<Expression>>,
10248}
10249
10250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10252#[cfg_attr(feature = "bindings", derive(TS))]
10253pub struct CheckJson {
10254 pub this: Box<Expression>,
10255}
10256
10257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10259#[cfg_attr(feature = "bindings", derive(TS))]
10260pub struct CheckXml {
10261 pub this: Box<Expression>,
10262 #[serde(default)]
10263 pub disable_auto_convert: Option<Box<Expression>>,
10264}
10265
10266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10268#[cfg_attr(feature = "bindings", derive(TS))]
10269pub struct TranslateCharacters {
10270 pub this: Box<Expression>,
10271 pub expression: Box<Expression>,
10272 #[serde(default)]
10273 pub with_error: Option<Box<Expression>>,
10274}
10275
10276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10278#[cfg_attr(feature = "bindings", derive(TS))]
10279pub struct CurrentSchemas {
10280 #[serde(default)]
10281 pub this: Option<Box<Expression>>,
10282}
10283
10284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10286#[cfg_attr(feature = "bindings", derive(TS))]
10287pub struct CurrentDatetime {
10288 #[serde(default)]
10289 pub this: Option<Box<Expression>>,
10290}
10291
10292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10294#[cfg_attr(feature = "bindings", derive(TS))]
10295pub struct Localtime {
10296 #[serde(default)]
10297 pub this: Option<Box<Expression>>,
10298}
10299
10300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10302#[cfg_attr(feature = "bindings", derive(TS))]
10303pub struct Localtimestamp {
10304 #[serde(default)]
10305 pub this: Option<Box<Expression>>,
10306}
10307
10308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10310#[cfg_attr(feature = "bindings", derive(TS))]
10311pub struct Systimestamp {
10312 #[serde(default)]
10313 pub this: Option<Box<Expression>>,
10314}
10315
10316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10318#[cfg_attr(feature = "bindings", derive(TS))]
10319pub struct CurrentSchema {
10320 #[serde(default)]
10321 pub this: Option<Box<Expression>>,
10322}
10323
10324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10326#[cfg_attr(feature = "bindings", derive(TS))]
10327pub struct CurrentUser {
10328 #[serde(default)]
10329 pub this: Option<Box<Expression>>,
10330}
10331
10332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10334#[cfg_attr(feature = "bindings", derive(TS))]
10335pub struct SessionUser;
10336
10337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10339#[cfg_attr(feature = "bindings", derive(TS))]
10340pub struct JSONPathRoot;
10341
10342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10344#[cfg_attr(feature = "bindings", derive(TS))]
10345pub struct UtcTime {
10346 #[serde(default)]
10347 pub this: Option<Box<Expression>>,
10348}
10349
10350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10352#[cfg_attr(feature = "bindings", derive(TS))]
10353pub struct UtcTimestamp {
10354 #[serde(default)]
10355 pub this: Option<Box<Expression>>,
10356}
10357
10358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10360#[cfg_attr(feature = "bindings", derive(TS))]
10361pub struct TimestampFunc {
10362 #[serde(default)]
10363 pub this: Option<Box<Expression>>,
10364 #[serde(default)]
10365 pub zone: Option<Box<Expression>>,
10366 #[serde(default)]
10367 pub with_tz: Option<bool>,
10368 #[serde(default)]
10369 pub safe: Option<bool>,
10370}
10371
10372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10374#[cfg_attr(feature = "bindings", derive(TS))]
10375pub struct DateBin {
10376 pub this: Box<Expression>,
10377 pub expression: Box<Expression>,
10378 #[serde(default)]
10379 pub unit: Option<String>,
10380 #[serde(default)]
10381 pub zone: Option<Box<Expression>>,
10382 #[serde(default)]
10383 pub origin: Option<Box<Expression>>,
10384}
10385
10386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10388#[cfg_attr(feature = "bindings", derive(TS))]
10389pub struct Datetime {
10390 pub this: Box<Expression>,
10391 #[serde(default)]
10392 pub expression: Option<Box<Expression>>,
10393}
10394
10395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10397#[cfg_attr(feature = "bindings", derive(TS))]
10398pub struct DatetimeAdd {
10399 pub this: Box<Expression>,
10400 pub expression: Box<Expression>,
10401 #[serde(default)]
10402 pub unit: Option<String>,
10403}
10404
10405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10407#[cfg_attr(feature = "bindings", derive(TS))]
10408pub struct DatetimeSub {
10409 pub this: Box<Expression>,
10410 pub expression: Box<Expression>,
10411 #[serde(default)]
10412 pub unit: Option<String>,
10413}
10414
10415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10417#[cfg_attr(feature = "bindings", derive(TS))]
10418pub struct DatetimeDiff {
10419 pub this: Box<Expression>,
10420 pub expression: Box<Expression>,
10421 #[serde(default)]
10422 pub unit: Option<String>,
10423}
10424
10425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10427#[cfg_attr(feature = "bindings", derive(TS))]
10428pub struct DatetimeTrunc {
10429 pub this: Box<Expression>,
10430 pub unit: String,
10431 #[serde(default)]
10432 pub zone: Option<Box<Expression>>,
10433}
10434
10435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10437#[cfg_attr(feature = "bindings", derive(TS))]
10438pub struct Dayname {
10439 pub this: Box<Expression>,
10440 #[serde(default)]
10441 pub abbreviated: Option<Box<Expression>>,
10442}
10443
10444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10446#[cfg_attr(feature = "bindings", derive(TS))]
10447pub struct MakeInterval {
10448 #[serde(default)]
10449 pub year: Option<Box<Expression>>,
10450 #[serde(default)]
10451 pub month: Option<Box<Expression>>,
10452 #[serde(default)]
10453 pub week: Option<Box<Expression>>,
10454 #[serde(default)]
10455 pub day: Option<Box<Expression>>,
10456 #[serde(default)]
10457 pub hour: Option<Box<Expression>>,
10458 #[serde(default)]
10459 pub minute: Option<Box<Expression>>,
10460 #[serde(default)]
10461 pub second: Option<Box<Expression>>,
10462}
10463
10464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10466#[cfg_attr(feature = "bindings", derive(TS))]
10467pub struct PreviousDay {
10468 pub this: Box<Expression>,
10469 pub expression: Box<Expression>,
10470}
10471
10472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10474#[cfg_attr(feature = "bindings", derive(TS))]
10475pub struct Elt {
10476 pub this: Box<Expression>,
10477 #[serde(default)]
10478 pub expressions: Vec<Expression>,
10479}
10480
10481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10483#[cfg_attr(feature = "bindings", derive(TS))]
10484pub struct TimestampAdd {
10485 pub this: Box<Expression>,
10486 pub expression: Box<Expression>,
10487 #[serde(default)]
10488 pub unit: Option<String>,
10489}
10490
10491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10493#[cfg_attr(feature = "bindings", derive(TS))]
10494pub struct TimestampSub {
10495 pub this: Box<Expression>,
10496 pub expression: Box<Expression>,
10497 #[serde(default)]
10498 pub unit: Option<String>,
10499}
10500
10501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10503#[cfg_attr(feature = "bindings", derive(TS))]
10504pub struct TimestampDiff {
10505 pub this: Box<Expression>,
10506 pub expression: Box<Expression>,
10507 #[serde(default)]
10508 pub unit: Option<String>,
10509}
10510
10511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10513#[cfg_attr(feature = "bindings", derive(TS))]
10514pub struct TimeSlice {
10515 pub this: Box<Expression>,
10516 pub expression: Box<Expression>,
10517 pub unit: String,
10518 #[serde(default)]
10519 pub kind: Option<String>,
10520}
10521
10522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10524#[cfg_attr(feature = "bindings", derive(TS))]
10525pub struct TimeAdd {
10526 pub this: Box<Expression>,
10527 pub expression: Box<Expression>,
10528 #[serde(default)]
10529 pub unit: Option<String>,
10530}
10531
10532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10534#[cfg_attr(feature = "bindings", derive(TS))]
10535pub struct TimeSub {
10536 pub this: Box<Expression>,
10537 pub expression: Box<Expression>,
10538 #[serde(default)]
10539 pub unit: Option<String>,
10540}
10541
10542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10544#[cfg_attr(feature = "bindings", derive(TS))]
10545pub struct TimeDiff {
10546 pub this: Box<Expression>,
10547 pub expression: Box<Expression>,
10548 #[serde(default)]
10549 pub unit: Option<String>,
10550}
10551
10552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10554#[cfg_attr(feature = "bindings", derive(TS))]
10555pub struct TimeTrunc {
10556 pub this: Box<Expression>,
10557 pub unit: String,
10558 #[serde(default)]
10559 pub zone: Option<Box<Expression>>,
10560}
10561
10562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10564#[cfg_attr(feature = "bindings", derive(TS))]
10565pub struct DateFromParts {
10566 #[serde(default)]
10567 pub year: Option<Box<Expression>>,
10568 #[serde(default)]
10569 pub month: Option<Box<Expression>>,
10570 #[serde(default)]
10571 pub day: Option<Box<Expression>>,
10572 #[serde(default)]
10573 pub allow_overflow: Option<Box<Expression>>,
10574}
10575
10576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10578#[cfg_attr(feature = "bindings", derive(TS))]
10579pub struct TimeFromParts {
10580 #[serde(default)]
10581 pub hour: Option<Box<Expression>>,
10582 #[serde(default)]
10583 pub min: Option<Box<Expression>>,
10584 #[serde(default)]
10585 pub sec: Option<Box<Expression>>,
10586 #[serde(default)]
10587 pub nano: Option<Box<Expression>>,
10588 #[serde(default)]
10589 pub fractions: Option<Box<Expression>>,
10590 #[serde(default)]
10591 pub precision: Option<i64>,
10592}
10593
10594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10596#[cfg_attr(feature = "bindings", derive(TS))]
10597pub struct DecodeCase {
10598 #[serde(default)]
10599 pub expressions: Vec<Expression>,
10600}
10601
10602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10604#[cfg_attr(feature = "bindings", derive(TS))]
10605pub struct Decrypt {
10606 pub this: Box<Expression>,
10607 #[serde(default)]
10608 pub passphrase: Option<Box<Expression>>,
10609 #[serde(default)]
10610 pub aad: Option<Box<Expression>>,
10611 #[serde(default)]
10612 pub encryption_method: Option<Box<Expression>>,
10613 #[serde(default)]
10614 pub safe: Option<Box<Expression>>,
10615}
10616
10617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10619#[cfg_attr(feature = "bindings", derive(TS))]
10620pub struct DecryptRaw {
10621 pub this: Box<Expression>,
10622 #[serde(default)]
10623 pub key: Option<Box<Expression>>,
10624 #[serde(default)]
10625 pub iv: Option<Box<Expression>>,
10626 #[serde(default)]
10627 pub aad: Option<Box<Expression>>,
10628 #[serde(default)]
10629 pub encryption_method: Option<Box<Expression>>,
10630 #[serde(default)]
10631 pub aead: Option<Box<Expression>>,
10632 #[serde(default)]
10633 pub safe: Option<Box<Expression>>,
10634}
10635
10636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10638#[cfg_attr(feature = "bindings", derive(TS))]
10639pub struct Encode {
10640 pub this: Box<Expression>,
10641 #[serde(default)]
10642 pub charset: Option<Box<Expression>>,
10643}
10644
10645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10647#[cfg_attr(feature = "bindings", derive(TS))]
10648pub struct Encrypt {
10649 pub this: Box<Expression>,
10650 #[serde(default)]
10651 pub passphrase: Option<Box<Expression>>,
10652 #[serde(default)]
10653 pub aad: Option<Box<Expression>>,
10654 #[serde(default)]
10655 pub encryption_method: Option<Box<Expression>>,
10656}
10657
10658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10660#[cfg_attr(feature = "bindings", derive(TS))]
10661pub struct EncryptRaw {
10662 pub this: Box<Expression>,
10663 #[serde(default)]
10664 pub key: Option<Box<Expression>>,
10665 #[serde(default)]
10666 pub iv: Option<Box<Expression>>,
10667 #[serde(default)]
10668 pub aad: Option<Box<Expression>>,
10669 #[serde(default)]
10670 pub encryption_method: Option<Box<Expression>>,
10671}
10672
10673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10675#[cfg_attr(feature = "bindings", derive(TS))]
10676pub struct EqualNull {
10677 pub this: Box<Expression>,
10678 pub expression: Box<Expression>,
10679}
10680
10681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10683#[cfg_attr(feature = "bindings", derive(TS))]
10684pub struct ToBinary {
10685 pub this: Box<Expression>,
10686 #[serde(default)]
10687 pub format: Option<String>,
10688 #[serde(default)]
10689 pub safe: Option<Box<Expression>>,
10690}
10691
10692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10694#[cfg_attr(feature = "bindings", derive(TS))]
10695pub struct Base64DecodeBinary {
10696 pub this: Box<Expression>,
10697 #[serde(default)]
10698 pub alphabet: Option<Box<Expression>>,
10699}
10700
10701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10703#[cfg_attr(feature = "bindings", derive(TS))]
10704pub struct Base64DecodeString {
10705 pub this: Box<Expression>,
10706 #[serde(default)]
10707 pub alphabet: Option<Box<Expression>>,
10708}
10709
10710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10712#[cfg_attr(feature = "bindings", derive(TS))]
10713pub struct Base64Encode {
10714 pub this: Box<Expression>,
10715 #[serde(default)]
10716 pub max_line_length: Option<Box<Expression>>,
10717 #[serde(default)]
10718 pub alphabet: Option<Box<Expression>>,
10719}
10720
10721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10723#[cfg_attr(feature = "bindings", derive(TS))]
10724pub struct TryBase64DecodeBinary {
10725 pub this: Box<Expression>,
10726 #[serde(default)]
10727 pub alphabet: Option<Box<Expression>>,
10728}
10729
10730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10732#[cfg_attr(feature = "bindings", derive(TS))]
10733pub struct TryBase64DecodeString {
10734 pub this: Box<Expression>,
10735 #[serde(default)]
10736 pub alphabet: Option<Box<Expression>>,
10737}
10738
10739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10741#[cfg_attr(feature = "bindings", derive(TS))]
10742pub struct GapFill {
10743 pub this: Box<Expression>,
10744 #[serde(default)]
10745 pub ts_column: Option<Box<Expression>>,
10746 #[serde(default)]
10747 pub bucket_width: Option<Box<Expression>>,
10748 #[serde(default)]
10749 pub partitioning_columns: Option<Box<Expression>>,
10750 #[serde(default)]
10751 pub value_columns: Option<Box<Expression>>,
10752 #[serde(default)]
10753 pub origin: Option<Box<Expression>>,
10754 #[serde(default)]
10755 pub ignore_nulls: Option<Box<Expression>>,
10756}
10757
10758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10760#[cfg_attr(feature = "bindings", derive(TS))]
10761pub struct GenerateDateArray {
10762 #[serde(default)]
10763 pub start: Option<Box<Expression>>,
10764 #[serde(default)]
10765 pub end: Option<Box<Expression>>,
10766 #[serde(default)]
10767 pub step: Option<Box<Expression>>,
10768}
10769
10770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10772#[cfg_attr(feature = "bindings", derive(TS))]
10773pub struct GenerateTimestampArray {
10774 #[serde(default)]
10775 pub start: Option<Box<Expression>>,
10776 #[serde(default)]
10777 pub end: Option<Box<Expression>>,
10778 #[serde(default)]
10779 pub step: Option<Box<Expression>>,
10780}
10781
10782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10784#[cfg_attr(feature = "bindings", derive(TS))]
10785pub struct GetExtract {
10786 pub this: Box<Expression>,
10787 pub expression: Box<Expression>,
10788}
10789
10790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10792#[cfg_attr(feature = "bindings", derive(TS))]
10793pub struct Getbit {
10794 pub this: Box<Expression>,
10795 pub expression: Box<Expression>,
10796 #[serde(default)]
10797 pub zero_is_msb: Option<Box<Expression>>,
10798}
10799
10800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10802#[cfg_attr(feature = "bindings", derive(TS))]
10803pub struct OverflowTruncateBehavior {
10804 #[serde(default)]
10805 pub this: Option<Box<Expression>>,
10806 #[serde(default)]
10807 pub with_count: Option<Box<Expression>>,
10808}
10809
10810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10812#[cfg_attr(feature = "bindings", derive(TS))]
10813pub struct HexEncode {
10814 pub this: Box<Expression>,
10815 #[serde(default)]
10816 pub case: Option<Box<Expression>>,
10817}
10818
10819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10821#[cfg_attr(feature = "bindings", derive(TS))]
10822pub struct Compress {
10823 pub this: Box<Expression>,
10824 #[serde(default)]
10825 pub method: Option<String>,
10826}
10827
10828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10830#[cfg_attr(feature = "bindings", derive(TS))]
10831pub struct DecompressBinary {
10832 pub this: Box<Expression>,
10833 pub method: String,
10834}
10835
10836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10838#[cfg_attr(feature = "bindings", derive(TS))]
10839pub struct DecompressString {
10840 pub this: Box<Expression>,
10841 pub method: String,
10842}
10843
10844#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10846#[cfg_attr(feature = "bindings", derive(TS))]
10847pub struct Xor {
10848 #[serde(default)]
10849 pub this: Option<Box<Expression>>,
10850 #[serde(default)]
10851 pub expression: Option<Box<Expression>>,
10852 #[serde(default)]
10853 pub expressions: Vec<Expression>,
10854}
10855
10856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10858#[cfg_attr(feature = "bindings", derive(TS))]
10859pub struct Nullif {
10860 pub this: Box<Expression>,
10861 pub expression: Box<Expression>,
10862}
10863
10864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10866#[cfg_attr(feature = "bindings", derive(TS))]
10867pub struct JSON {
10868 #[serde(default)]
10869 pub this: Option<Box<Expression>>,
10870 #[serde(default)]
10871 pub with_: Option<Box<Expression>>,
10872 #[serde(default)]
10873 pub unique: bool,
10874}
10875
10876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10878#[cfg_attr(feature = "bindings", derive(TS))]
10879pub struct JSONPath {
10880 #[serde(default)]
10881 pub expressions: Vec<Expression>,
10882 #[serde(default)]
10883 pub escape: Option<Box<Expression>>,
10884}
10885
10886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10888#[cfg_attr(feature = "bindings", derive(TS))]
10889pub struct JSONPathFilter {
10890 pub this: Box<Expression>,
10891}
10892
10893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10895#[cfg_attr(feature = "bindings", derive(TS))]
10896pub struct JSONPathKey {
10897 pub this: Box<Expression>,
10898}
10899
10900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10902#[cfg_attr(feature = "bindings", derive(TS))]
10903pub struct JSONPathRecursive {
10904 #[serde(default)]
10905 pub this: Option<Box<Expression>>,
10906}
10907
10908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10910#[cfg_attr(feature = "bindings", derive(TS))]
10911pub struct JSONPathScript {
10912 pub this: Box<Expression>,
10913}
10914
10915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10917#[cfg_attr(feature = "bindings", derive(TS))]
10918pub struct JSONPathSlice {
10919 #[serde(default)]
10920 pub start: Option<Box<Expression>>,
10921 #[serde(default)]
10922 pub end: Option<Box<Expression>>,
10923 #[serde(default)]
10924 pub step: Option<Box<Expression>>,
10925}
10926
10927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10929#[cfg_attr(feature = "bindings", derive(TS))]
10930pub struct JSONPathSelector {
10931 pub this: Box<Expression>,
10932}
10933
10934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10936#[cfg_attr(feature = "bindings", derive(TS))]
10937pub struct JSONPathSubscript {
10938 pub this: Box<Expression>,
10939}
10940
10941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10943#[cfg_attr(feature = "bindings", derive(TS))]
10944pub struct JSONPathUnion {
10945 #[serde(default)]
10946 pub expressions: Vec<Expression>,
10947}
10948
10949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10951#[cfg_attr(feature = "bindings", derive(TS))]
10952pub struct Format {
10953 pub this: Box<Expression>,
10954 #[serde(default)]
10955 pub expressions: Vec<Expression>,
10956}
10957
10958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10960#[cfg_attr(feature = "bindings", derive(TS))]
10961pub struct JSONKeys {
10962 pub this: Box<Expression>,
10963 #[serde(default)]
10964 pub expression: Option<Box<Expression>>,
10965 #[serde(default)]
10966 pub expressions: Vec<Expression>,
10967}
10968
10969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10971#[cfg_attr(feature = "bindings", derive(TS))]
10972pub struct JSONKeyValue {
10973 pub this: Box<Expression>,
10974 pub expression: Box<Expression>,
10975}
10976
10977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10979#[cfg_attr(feature = "bindings", derive(TS))]
10980pub struct JSONKeysAtDepth {
10981 pub this: Box<Expression>,
10982 #[serde(default)]
10983 pub expression: Option<Box<Expression>>,
10984 #[serde(default)]
10985 pub mode: Option<Box<Expression>>,
10986}
10987
10988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10990#[cfg_attr(feature = "bindings", derive(TS))]
10991pub struct JSONObject {
10992 #[serde(default)]
10993 pub expressions: Vec<Expression>,
10994 #[serde(default)]
10995 pub null_handling: Option<Box<Expression>>,
10996 #[serde(default)]
10997 pub unique_keys: Option<Box<Expression>>,
10998 #[serde(default)]
10999 pub return_type: Option<Box<Expression>>,
11000 #[serde(default)]
11001 pub encoding: Option<Box<Expression>>,
11002}
11003
11004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11006#[cfg_attr(feature = "bindings", derive(TS))]
11007pub struct JSONObjectAgg {
11008 #[serde(default)]
11009 pub expressions: Vec<Expression>,
11010 #[serde(default)]
11011 pub null_handling: Option<Box<Expression>>,
11012 #[serde(default)]
11013 pub unique_keys: Option<Box<Expression>>,
11014 #[serde(default)]
11015 pub return_type: Option<Box<Expression>>,
11016 #[serde(default)]
11017 pub encoding: Option<Box<Expression>>,
11018}
11019
11020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11022#[cfg_attr(feature = "bindings", derive(TS))]
11023pub struct JSONBObjectAgg {
11024 pub this: Box<Expression>,
11025 pub expression: Box<Expression>,
11026}
11027
11028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11030#[cfg_attr(feature = "bindings", derive(TS))]
11031pub struct JSONArray {
11032 #[serde(default)]
11033 pub expressions: Vec<Expression>,
11034 #[serde(default)]
11035 pub null_handling: Option<Box<Expression>>,
11036 #[serde(default)]
11037 pub return_type: Option<Box<Expression>>,
11038 #[serde(default)]
11039 pub strict: Option<Box<Expression>>,
11040}
11041
11042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11044#[cfg_attr(feature = "bindings", derive(TS))]
11045pub struct JSONArrayAgg {
11046 pub this: Box<Expression>,
11047 #[serde(default)]
11048 pub order: Option<Box<Expression>>,
11049 #[serde(default)]
11050 pub null_handling: Option<Box<Expression>>,
11051 #[serde(default)]
11052 pub return_type: Option<Box<Expression>>,
11053 #[serde(default)]
11054 pub strict: Option<Box<Expression>>,
11055}
11056
11057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11059#[cfg_attr(feature = "bindings", derive(TS))]
11060pub struct JSONExists {
11061 pub this: Box<Expression>,
11062 #[serde(default)]
11063 pub path: Option<Box<Expression>>,
11064 #[serde(default)]
11065 pub passing: Option<Box<Expression>>,
11066 #[serde(default)]
11067 pub on_condition: Option<Box<Expression>>,
11068 #[serde(default)]
11069 pub from_dcolonqmark: Option<Box<Expression>>,
11070}
11071
11072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11074#[cfg_attr(feature = "bindings", derive(TS))]
11075pub struct JSONColumnDef {
11076 #[serde(default)]
11077 pub this: Option<Box<Expression>>,
11078 #[serde(default)]
11079 pub kind: Option<String>,
11080 #[serde(default)]
11081 pub path: Option<Box<Expression>>,
11082 #[serde(default)]
11083 pub nested_schema: Option<Box<Expression>>,
11084 #[serde(default)]
11085 pub ordinality: Option<Box<Expression>>,
11086}
11087
11088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11090#[cfg_attr(feature = "bindings", derive(TS))]
11091pub struct JSONSchema {
11092 #[serde(default)]
11093 pub expressions: Vec<Expression>,
11094}
11095
11096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11098#[cfg_attr(feature = "bindings", derive(TS))]
11099pub struct JSONSet {
11100 pub this: Box<Expression>,
11101 #[serde(default)]
11102 pub expressions: Vec<Expression>,
11103}
11104
11105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11107#[cfg_attr(feature = "bindings", derive(TS))]
11108pub struct JSONStripNulls {
11109 pub this: Box<Expression>,
11110 #[serde(default)]
11111 pub expression: Option<Box<Expression>>,
11112 #[serde(default)]
11113 pub include_arrays: Option<Box<Expression>>,
11114 #[serde(default)]
11115 pub remove_empty: Option<Box<Expression>>,
11116}
11117
11118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11120#[cfg_attr(feature = "bindings", derive(TS))]
11121pub struct JSONValue {
11122 pub this: Box<Expression>,
11123 #[serde(default)]
11124 pub path: Option<Box<Expression>>,
11125 #[serde(default)]
11126 pub returning: Option<Box<Expression>>,
11127 #[serde(default)]
11128 pub on_condition: Option<Box<Expression>>,
11129}
11130
11131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11133#[cfg_attr(feature = "bindings", derive(TS))]
11134pub struct JSONValueArray {
11135 pub this: Box<Expression>,
11136 #[serde(default)]
11137 pub expression: Option<Box<Expression>>,
11138}
11139
11140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11142#[cfg_attr(feature = "bindings", derive(TS))]
11143pub struct JSONRemove {
11144 pub this: Box<Expression>,
11145 #[serde(default)]
11146 pub expressions: Vec<Expression>,
11147}
11148
11149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11151#[cfg_attr(feature = "bindings", derive(TS))]
11152pub struct JSONTable {
11153 pub this: Box<Expression>,
11154 #[serde(default)]
11155 pub schema: Option<Box<Expression>>,
11156 #[serde(default)]
11157 pub path: Option<Box<Expression>>,
11158 #[serde(default)]
11159 pub error_handling: Option<Box<Expression>>,
11160 #[serde(default)]
11161 pub empty_handling: Option<Box<Expression>>,
11162}
11163
11164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11166#[cfg_attr(feature = "bindings", derive(TS))]
11167pub struct JSONType {
11168 pub this: Box<Expression>,
11169 #[serde(default)]
11170 pub expression: Option<Box<Expression>>,
11171}
11172
11173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11175#[cfg_attr(feature = "bindings", derive(TS))]
11176pub struct ObjectInsert {
11177 pub this: Box<Expression>,
11178 #[serde(default)]
11179 pub key: Option<Box<Expression>>,
11180 #[serde(default)]
11181 pub value: Option<Box<Expression>>,
11182 #[serde(default)]
11183 pub update_flag: Option<Box<Expression>>,
11184}
11185
11186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11188#[cfg_attr(feature = "bindings", derive(TS))]
11189pub struct OpenJSONColumnDef {
11190 pub this: Box<Expression>,
11191 pub kind: String,
11192 #[serde(default)]
11193 pub path: Option<Box<Expression>>,
11194 #[serde(default)]
11195 pub as_json: Option<Box<Expression>>,
11196 #[serde(default, skip_serializing_if = "Option::is_none")]
11198 pub data_type: Option<DataType>,
11199}
11200
11201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11203#[cfg_attr(feature = "bindings", derive(TS))]
11204pub struct OpenJSON {
11205 pub this: Box<Expression>,
11206 #[serde(default)]
11207 pub path: Option<Box<Expression>>,
11208 #[serde(default)]
11209 pub expressions: Vec<Expression>,
11210}
11211
11212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11214#[cfg_attr(feature = "bindings", derive(TS))]
11215pub struct JSONBExists {
11216 pub this: Box<Expression>,
11217 #[serde(default)]
11218 pub path: Option<Box<Expression>>,
11219}
11220
11221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11223#[cfg_attr(feature = "bindings", derive(TS))]
11224pub struct JSONCast {
11225 pub this: Box<Expression>,
11226 pub to: DataType,
11227}
11228
11229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11231#[cfg_attr(feature = "bindings", derive(TS))]
11232pub struct JSONExtract {
11233 pub this: Box<Expression>,
11234 pub expression: Box<Expression>,
11235 #[serde(default)]
11236 pub only_json_types: Option<Box<Expression>>,
11237 #[serde(default)]
11238 pub expressions: Vec<Expression>,
11239 #[serde(default)]
11240 pub variant_extract: Option<Box<Expression>>,
11241 #[serde(default)]
11242 pub json_query: Option<Box<Expression>>,
11243 #[serde(default)]
11244 pub option: Option<Box<Expression>>,
11245 #[serde(default)]
11246 pub quote: Option<Box<Expression>>,
11247 #[serde(default)]
11248 pub on_condition: Option<Box<Expression>>,
11249 #[serde(default)]
11250 pub requires_json: Option<Box<Expression>>,
11251}
11252
11253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11255#[cfg_attr(feature = "bindings", derive(TS))]
11256pub struct JSONExtractQuote {
11257 #[serde(default)]
11258 pub option: Option<Box<Expression>>,
11259 #[serde(default)]
11260 pub scalar: Option<Box<Expression>>,
11261}
11262
11263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11265#[cfg_attr(feature = "bindings", derive(TS))]
11266pub struct JSONExtractArray {
11267 pub this: Box<Expression>,
11268 #[serde(default)]
11269 pub expression: Option<Box<Expression>>,
11270}
11271
11272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11274#[cfg_attr(feature = "bindings", derive(TS))]
11275pub struct JSONExtractScalar {
11276 pub this: Box<Expression>,
11277 pub expression: Box<Expression>,
11278 #[serde(default)]
11279 pub only_json_types: Option<Box<Expression>>,
11280 #[serde(default)]
11281 pub expressions: Vec<Expression>,
11282 #[serde(default)]
11283 pub json_type: Option<Box<Expression>>,
11284 #[serde(default)]
11285 pub scalar_only: Option<Box<Expression>>,
11286}
11287
11288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11290#[cfg_attr(feature = "bindings", derive(TS))]
11291pub struct JSONBExtractScalar {
11292 pub this: Box<Expression>,
11293 pub expression: Box<Expression>,
11294 #[serde(default)]
11295 pub json_type: Option<Box<Expression>>,
11296}
11297
11298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11300#[cfg_attr(feature = "bindings", derive(TS))]
11301pub struct JSONFormat {
11302 #[serde(default)]
11303 pub this: Option<Box<Expression>>,
11304 #[serde(default)]
11305 pub options: Vec<Expression>,
11306 #[serde(default)]
11307 pub is_json: Option<Box<Expression>>,
11308 #[serde(default)]
11309 pub to_json: Option<Box<Expression>>,
11310}
11311
11312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11314#[cfg_attr(feature = "bindings", derive(TS))]
11315pub struct JSONArrayAppend {
11316 pub this: Box<Expression>,
11317 #[serde(default)]
11318 pub expressions: Vec<Expression>,
11319}
11320
11321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11323#[cfg_attr(feature = "bindings", derive(TS))]
11324pub struct JSONArrayContains {
11325 pub this: Box<Expression>,
11326 pub expression: Box<Expression>,
11327 #[serde(default)]
11328 pub json_type: Option<Box<Expression>>,
11329}
11330
11331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11333#[cfg_attr(feature = "bindings", derive(TS))]
11334pub struct JSONArrayInsert {
11335 pub this: Box<Expression>,
11336 #[serde(default)]
11337 pub expressions: Vec<Expression>,
11338}
11339
11340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11342#[cfg_attr(feature = "bindings", derive(TS))]
11343pub struct ParseJSON {
11344 pub this: Box<Expression>,
11345 #[serde(default)]
11346 pub expression: Option<Box<Expression>>,
11347 #[serde(default)]
11348 pub safe: Option<Box<Expression>>,
11349}
11350
11351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11353#[cfg_attr(feature = "bindings", derive(TS))]
11354pub struct ParseUrl {
11355 pub this: Box<Expression>,
11356 #[serde(default)]
11357 pub part_to_extract: Option<Box<Expression>>,
11358 #[serde(default)]
11359 pub key: Option<Box<Expression>>,
11360 #[serde(default)]
11361 pub permissive: Option<Box<Expression>>,
11362}
11363
11364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11366#[cfg_attr(feature = "bindings", derive(TS))]
11367pub struct ParseIp {
11368 pub this: Box<Expression>,
11369 #[serde(default)]
11370 pub type_: Option<Box<Expression>>,
11371 #[serde(default)]
11372 pub permissive: Option<Box<Expression>>,
11373}
11374
11375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11377#[cfg_attr(feature = "bindings", derive(TS))]
11378pub struct ParseTime {
11379 pub this: Box<Expression>,
11380 pub format: String,
11381}
11382
11383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11385#[cfg_attr(feature = "bindings", derive(TS))]
11386pub struct ParseDatetime {
11387 pub this: Box<Expression>,
11388 #[serde(default)]
11389 pub format: Option<String>,
11390 #[serde(default)]
11391 pub zone: Option<Box<Expression>>,
11392}
11393
11394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11396#[cfg_attr(feature = "bindings", derive(TS))]
11397pub struct Map {
11398 #[serde(default)]
11399 pub keys: Vec<Expression>,
11400 #[serde(default)]
11401 pub values: Vec<Expression>,
11402}
11403
11404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11406#[cfg_attr(feature = "bindings", derive(TS))]
11407pub struct MapCat {
11408 pub this: Box<Expression>,
11409 pub expression: Box<Expression>,
11410}
11411
11412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11414#[cfg_attr(feature = "bindings", derive(TS))]
11415pub struct MapDelete {
11416 pub this: Box<Expression>,
11417 #[serde(default)]
11418 pub expressions: Vec<Expression>,
11419}
11420
11421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11423#[cfg_attr(feature = "bindings", derive(TS))]
11424pub struct MapInsert {
11425 pub this: Box<Expression>,
11426 #[serde(default)]
11427 pub key: Option<Box<Expression>>,
11428 #[serde(default)]
11429 pub value: Option<Box<Expression>>,
11430 #[serde(default)]
11431 pub update_flag: Option<Box<Expression>>,
11432}
11433
11434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11436#[cfg_attr(feature = "bindings", derive(TS))]
11437pub struct MapPick {
11438 pub this: Box<Expression>,
11439 #[serde(default)]
11440 pub expressions: Vec<Expression>,
11441}
11442
11443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11445#[cfg_attr(feature = "bindings", derive(TS))]
11446pub struct ScopeResolution {
11447 #[serde(default)]
11448 pub this: Option<Box<Expression>>,
11449 pub expression: Box<Expression>,
11450}
11451
11452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11454#[cfg_attr(feature = "bindings", derive(TS))]
11455pub struct Slice {
11456 #[serde(default)]
11457 pub this: Option<Box<Expression>>,
11458 #[serde(default)]
11459 pub expression: Option<Box<Expression>>,
11460 #[serde(default)]
11461 pub step: Option<Box<Expression>>,
11462}
11463
11464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11466#[cfg_attr(feature = "bindings", derive(TS))]
11467pub struct VarMap {
11468 #[serde(default)]
11469 pub keys: Vec<Expression>,
11470 #[serde(default)]
11471 pub values: Vec<Expression>,
11472}
11473
11474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11476#[cfg_attr(feature = "bindings", derive(TS))]
11477pub struct MatchAgainst {
11478 pub this: Box<Expression>,
11479 #[serde(default)]
11480 pub expressions: Vec<Expression>,
11481 #[serde(default)]
11482 pub modifier: Option<Box<Expression>>,
11483}
11484
11485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11487#[cfg_attr(feature = "bindings", derive(TS))]
11488pub struct MD5Digest {
11489 pub this: Box<Expression>,
11490 #[serde(default)]
11491 pub expressions: Vec<Expression>,
11492}
11493
11494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11496#[cfg_attr(feature = "bindings", derive(TS))]
11497pub struct Monthname {
11498 pub this: Box<Expression>,
11499 #[serde(default)]
11500 pub abbreviated: Option<Box<Expression>>,
11501}
11502
11503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11505#[cfg_attr(feature = "bindings", derive(TS))]
11506pub struct Ntile {
11507 #[serde(default)]
11508 pub this: Option<Box<Expression>>,
11509}
11510
11511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11513#[cfg_attr(feature = "bindings", derive(TS))]
11514pub struct Normalize {
11515 pub this: Box<Expression>,
11516 #[serde(default)]
11517 pub form: Option<Box<Expression>>,
11518 #[serde(default)]
11519 pub is_casefold: Option<Box<Expression>>,
11520}
11521
11522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11524#[cfg_attr(feature = "bindings", derive(TS))]
11525pub struct Normal {
11526 pub this: Box<Expression>,
11527 #[serde(default)]
11528 pub stddev: Option<Box<Expression>>,
11529 #[serde(default)]
11530 pub gen: Option<Box<Expression>>,
11531}
11532
11533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11535#[cfg_attr(feature = "bindings", derive(TS))]
11536pub struct Predict {
11537 pub this: Box<Expression>,
11538 pub expression: Box<Expression>,
11539 #[serde(default)]
11540 pub params_struct: Option<Box<Expression>>,
11541}
11542
11543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11545#[cfg_attr(feature = "bindings", derive(TS))]
11546pub struct MLTranslate {
11547 pub this: Box<Expression>,
11548 pub expression: Box<Expression>,
11549 #[serde(default)]
11550 pub params_struct: Option<Box<Expression>>,
11551}
11552
11553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11555#[cfg_attr(feature = "bindings", derive(TS))]
11556pub struct FeaturesAtTime {
11557 pub this: Box<Expression>,
11558 #[serde(default)]
11559 pub time: Option<Box<Expression>>,
11560 #[serde(default)]
11561 pub num_rows: Option<Box<Expression>>,
11562 #[serde(default)]
11563 pub ignore_feature_nulls: Option<Box<Expression>>,
11564}
11565
11566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11568#[cfg_attr(feature = "bindings", derive(TS))]
11569pub struct GenerateEmbedding {
11570 pub this: Box<Expression>,
11571 pub expression: Box<Expression>,
11572 #[serde(default)]
11573 pub params_struct: Option<Box<Expression>>,
11574 #[serde(default)]
11575 pub is_text: Option<Box<Expression>>,
11576}
11577
11578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11580#[cfg_attr(feature = "bindings", derive(TS))]
11581pub struct MLForecast {
11582 pub this: Box<Expression>,
11583 #[serde(default)]
11584 pub expression: Option<Box<Expression>>,
11585 #[serde(default)]
11586 pub params_struct: Option<Box<Expression>>,
11587}
11588
11589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11591#[cfg_attr(feature = "bindings", derive(TS))]
11592pub struct ModelAttribute {
11593 pub this: Box<Expression>,
11594 pub expression: Box<Expression>,
11595}
11596
11597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11599#[cfg_attr(feature = "bindings", derive(TS))]
11600pub struct VectorSearch {
11601 pub this: Box<Expression>,
11602 #[serde(default)]
11603 pub column_to_search: Option<Box<Expression>>,
11604 #[serde(default)]
11605 pub query_table: Option<Box<Expression>>,
11606 #[serde(default)]
11607 pub query_column_to_search: Option<Box<Expression>>,
11608 #[serde(default)]
11609 pub top_k: Option<Box<Expression>>,
11610 #[serde(default)]
11611 pub distance_type: Option<Box<Expression>>,
11612 #[serde(default)]
11613 pub options: Vec<Expression>,
11614}
11615
11616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11618#[cfg_attr(feature = "bindings", derive(TS))]
11619pub struct Quantile {
11620 pub this: Box<Expression>,
11621 #[serde(default)]
11622 pub quantile: Option<Box<Expression>>,
11623}
11624
11625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11627#[cfg_attr(feature = "bindings", derive(TS))]
11628pub struct ApproxQuantile {
11629 pub this: Box<Expression>,
11630 #[serde(default)]
11631 pub quantile: Option<Box<Expression>>,
11632 #[serde(default)]
11633 pub accuracy: Option<Box<Expression>>,
11634 #[serde(default)]
11635 pub weight: Option<Box<Expression>>,
11636 #[serde(default)]
11637 pub error_tolerance: Option<Box<Expression>>,
11638}
11639
11640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11642#[cfg_attr(feature = "bindings", derive(TS))]
11643pub struct ApproxPercentileEstimate {
11644 pub this: Box<Expression>,
11645 #[serde(default)]
11646 pub percentile: Option<Box<Expression>>,
11647}
11648
11649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11651#[cfg_attr(feature = "bindings", derive(TS))]
11652pub struct Randn {
11653 #[serde(default)]
11654 pub this: Option<Box<Expression>>,
11655}
11656
11657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11659#[cfg_attr(feature = "bindings", derive(TS))]
11660pub struct Randstr {
11661 pub this: Box<Expression>,
11662 #[serde(default)]
11663 pub generator: Option<Box<Expression>>,
11664}
11665
11666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11668#[cfg_attr(feature = "bindings", derive(TS))]
11669pub struct RangeN {
11670 pub this: Box<Expression>,
11671 #[serde(default)]
11672 pub expressions: Vec<Expression>,
11673 #[serde(default)]
11674 pub each: Option<Box<Expression>>,
11675}
11676
11677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11679#[cfg_attr(feature = "bindings", derive(TS))]
11680pub struct RangeBucket {
11681 pub this: Box<Expression>,
11682 pub expression: Box<Expression>,
11683}
11684
11685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11687#[cfg_attr(feature = "bindings", derive(TS))]
11688pub struct ReadCSV {
11689 pub this: Box<Expression>,
11690 #[serde(default)]
11691 pub expressions: Vec<Expression>,
11692}
11693
11694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11696#[cfg_attr(feature = "bindings", derive(TS))]
11697pub struct ReadParquet {
11698 #[serde(default)]
11699 pub expressions: Vec<Expression>,
11700}
11701
11702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11704#[cfg_attr(feature = "bindings", derive(TS))]
11705pub struct Reduce {
11706 pub this: Box<Expression>,
11707 #[serde(default)]
11708 pub initial: Option<Box<Expression>>,
11709 #[serde(default)]
11710 pub merge: Option<Box<Expression>>,
11711 #[serde(default)]
11712 pub finish: Option<Box<Expression>>,
11713}
11714
11715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11717#[cfg_attr(feature = "bindings", derive(TS))]
11718pub struct RegexpExtractAll {
11719 pub this: Box<Expression>,
11720 pub expression: Box<Expression>,
11721 #[serde(default)]
11722 pub group: Option<Box<Expression>>,
11723 #[serde(default)]
11724 pub parameters: Option<Box<Expression>>,
11725 #[serde(default)]
11726 pub position: Option<Box<Expression>>,
11727 #[serde(default)]
11728 pub occurrence: Option<Box<Expression>>,
11729}
11730
11731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11733#[cfg_attr(feature = "bindings", derive(TS))]
11734pub struct RegexpILike {
11735 pub this: Box<Expression>,
11736 pub expression: Box<Expression>,
11737 #[serde(default)]
11738 pub flag: Option<Box<Expression>>,
11739}
11740
11741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11743#[cfg_attr(feature = "bindings", derive(TS))]
11744pub struct RegexpFullMatch {
11745 pub this: Box<Expression>,
11746 pub expression: Box<Expression>,
11747 #[serde(default)]
11748 pub options: Vec<Expression>,
11749}
11750
11751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11753#[cfg_attr(feature = "bindings", derive(TS))]
11754pub struct RegexpInstr {
11755 pub this: Box<Expression>,
11756 pub expression: Box<Expression>,
11757 #[serde(default)]
11758 pub position: Option<Box<Expression>>,
11759 #[serde(default)]
11760 pub occurrence: Option<Box<Expression>>,
11761 #[serde(default)]
11762 pub option: Option<Box<Expression>>,
11763 #[serde(default)]
11764 pub parameters: Option<Box<Expression>>,
11765 #[serde(default)]
11766 pub group: Option<Box<Expression>>,
11767}
11768
11769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11771#[cfg_attr(feature = "bindings", derive(TS))]
11772pub struct RegexpSplit {
11773 pub this: Box<Expression>,
11774 pub expression: Box<Expression>,
11775 #[serde(default)]
11776 pub limit: Option<Box<Expression>>,
11777}
11778
11779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11781#[cfg_attr(feature = "bindings", derive(TS))]
11782pub struct RegexpCount {
11783 pub this: Box<Expression>,
11784 pub expression: Box<Expression>,
11785 #[serde(default)]
11786 pub position: Option<Box<Expression>>,
11787 #[serde(default)]
11788 pub parameters: Option<Box<Expression>>,
11789}
11790
11791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11793#[cfg_attr(feature = "bindings", derive(TS))]
11794pub struct RegrValx {
11795 pub this: Box<Expression>,
11796 pub expression: Box<Expression>,
11797}
11798
11799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11801#[cfg_attr(feature = "bindings", derive(TS))]
11802pub struct RegrValy {
11803 pub this: Box<Expression>,
11804 pub expression: Box<Expression>,
11805}
11806
11807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11809#[cfg_attr(feature = "bindings", derive(TS))]
11810pub struct RegrAvgy {
11811 pub this: Box<Expression>,
11812 pub expression: Box<Expression>,
11813}
11814
11815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11817#[cfg_attr(feature = "bindings", derive(TS))]
11818pub struct RegrAvgx {
11819 pub this: Box<Expression>,
11820 pub expression: Box<Expression>,
11821}
11822
11823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11825#[cfg_attr(feature = "bindings", derive(TS))]
11826pub struct RegrCount {
11827 pub this: Box<Expression>,
11828 pub expression: Box<Expression>,
11829}
11830
11831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11833#[cfg_attr(feature = "bindings", derive(TS))]
11834pub struct RegrIntercept {
11835 pub this: Box<Expression>,
11836 pub expression: Box<Expression>,
11837}
11838
11839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11841#[cfg_attr(feature = "bindings", derive(TS))]
11842pub struct RegrR2 {
11843 pub this: Box<Expression>,
11844 pub expression: Box<Expression>,
11845}
11846
11847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11849#[cfg_attr(feature = "bindings", derive(TS))]
11850pub struct RegrSxx {
11851 pub this: Box<Expression>,
11852 pub expression: Box<Expression>,
11853}
11854
11855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11857#[cfg_attr(feature = "bindings", derive(TS))]
11858pub struct RegrSxy {
11859 pub this: Box<Expression>,
11860 pub expression: Box<Expression>,
11861}
11862
11863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11865#[cfg_attr(feature = "bindings", derive(TS))]
11866pub struct RegrSyy {
11867 pub this: Box<Expression>,
11868 pub expression: Box<Expression>,
11869}
11870
11871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11873#[cfg_attr(feature = "bindings", derive(TS))]
11874pub struct RegrSlope {
11875 pub this: Box<Expression>,
11876 pub expression: Box<Expression>,
11877}
11878
11879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11881#[cfg_attr(feature = "bindings", derive(TS))]
11882pub struct SafeAdd {
11883 pub this: Box<Expression>,
11884 pub expression: Box<Expression>,
11885}
11886
11887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11889#[cfg_attr(feature = "bindings", derive(TS))]
11890pub struct SafeDivide {
11891 pub this: Box<Expression>,
11892 pub expression: Box<Expression>,
11893}
11894
11895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11897#[cfg_attr(feature = "bindings", derive(TS))]
11898pub struct SafeMultiply {
11899 pub this: Box<Expression>,
11900 pub expression: Box<Expression>,
11901}
11902
11903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11905#[cfg_attr(feature = "bindings", derive(TS))]
11906pub struct SafeSubtract {
11907 pub this: Box<Expression>,
11908 pub expression: Box<Expression>,
11909}
11910
11911#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11913#[cfg_attr(feature = "bindings", derive(TS))]
11914pub struct SHA2 {
11915 pub this: Box<Expression>,
11916 #[serde(default)]
11917 pub length: Option<i64>,
11918}
11919
11920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11922#[cfg_attr(feature = "bindings", derive(TS))]
11923pub struct SHA2Digest {
11924 pub this: Box<Expression>,
11925 #[serde(default)]
11926 pub length: Option<i64>,
11927}
11928
11929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11931#[cfg_attr(feature = "bindings", derive(TS))]
11932pub struct SortArray {
11933 pub this: Box<Expression>,
11934 #[serde(default)]
11935 pub asc: Option<Box<Expression>>,
11936 #[serde(default)]
11937 pub nulls_first: Option<Box<Expression>>,
11938}
11939
11940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11942#[cfg_attr(feature = "bindings", derive(TS))]
11943pub struct SplitPart {
11944 pub this: Box<Expression>,
11945 #[serde(default)]
11946 pub delimiter: Option<Box<Expression>>,
11947 #[serde(default)]
11948 pub part_index: Option<Box<Expression>>,
11949}
11950
11951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11953#[cfg_attr(feature = "bindings", derive(TS))]
11954pub struct SubstringIndex {
11955 pub this: Box<Expression>,
11956 #[serde(default)]
11957 pub delimiter: Option<Box<Expression>>,
11958 #[serde(default)]
11959 pub count: Option<Box<Expression>>,
11960}
11961
11962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11964#[cfg_attr(feature = "bindings", derive(TS))]
11965pub struct StandardHash {
11966 pub this: Box<Expression>,
11967 #[serde(default)]
11968 pub expression: Option<Box<Expression>>,
11969}
11970
11971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11973#[cfg_attr(feature = "bindings", derive(TS))]
11974pub struct StrPosition {
11975 pub this: Box<Expression>,
11976 #[serde(default)]
11977 pub substr: Option<Box<Expression>>,
11978 #[serde(default)]
11979 pub position: Option<Box<Expression>>,
11980 #[serde(default)]
11981 pub occurrence: Option<Box<Expression>>,
11982}
11983
11984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11986#[cfg_attr(feature = "bindings", derive(TS))]
11987pub struct Search {
11988 pub this: Box<Expression>,
11989 pub expression: Box<Expression>,
11990 #[serde(default)]
11991 pub json_scope: Option<Box<Expression>>,
11992 #[serde(default)]
11993 pub analyzer: Option<Box<Expression>>,
11994 #[serde(default)]
11995 pub analyzer_options: Option<Box<Expression>>,
11996 #[serde(default)]
11997 pub search_mode: Option<Box<Expression>>,
11998}
11999
12000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12002#[cfg_attr(feature = "bindings", derive(TS))]
12003pub struct SearchIp {
12004 pub this: Box<Expression>,
12005 pub expression: Box<Expression>,
12006}
12007
12008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12010#[cfg_attr(feature = "bindings", derive(TS))]
12011pub struct StrToDate {
12012 pub this: Box<Expression>,
12013 #[serde(default)]
12014 pub format: Option<String>,
12015 #[serde(default)]
12016 pub safe: Option<Box<Expression>>,
12017}
12018
12019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12021#[cfg_attr(feature = "bindings", derive(TS))]
12022pub struct StrToTime {
12023 pub this: Box<Expression>,
12024 pub format: String,
12025 #[serde(default)]
12026 pub zone: Option<Box<Expression>>,
12027 #[serde(default)]
12028 pub safe: Option<Box<Expression>>,
12029 #[serde(default)]
12030 pub target_type: Option<Box<Expression>>,
12031}
12032
12033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12035#[cfg_attr(feature = "bindings", derive(TS))]
12036pub struct StrToUnix {
12037 #[serde(default)]
12038 pub this: Option<Box<Expression>>,
12039 #[serde(default)]
12040 pub format: Option<String>,
12041}
12042
12043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12045#[cfg_attr(feature = "bindings", derive(TS))]
12046pub struct StrToMap {
12047 pub this: Box<Expression>,
12048 #[serde(default)]
12049 pub pair_delim: Option<Box<Expression>>,
12050 #[serde(default)]
12051 pub key_value_delim: Option<Box<Expression>>,
12052 #[serde(default)]
12053 pub duplicate_resolution_callback: Option<Box<Expression>>,
12054}
12055
12056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12058#[cfg_attr(feature = "bindings", derive(TS))]
12059pub struct NumberToStr {
12060 pub this: Box<Expression>,
12061 pub format: String,
12062 #[serde(default)]
12063 pub culture: Option<Box<Expression>>,
12064}
12065
12066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12068#[cfg_attr(feature = "bindings", derive(TS))]
12069pub struct FromBase {
12070 pub this: Box<Expression>,
12071 pub expression: Box<Expression>,
12072}
12073
12074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12076#[cfg_attr(feature = "bindings", derive(TS))]
12077pub struct Stuff {
12078 pub this: Box<Expression>,
12079 #[serde(default)]
12080 pub start: Option<Box<Expression>>,
12081 #[serde(default)]
12082 pub length: Option<i64>,
12083 pub expression: Box<Expression>,
12084}
12085
12086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12088#[cfg_attr(feature = "bindings", derive(TS))]
12089pub struct TimeToStr {
12090 pub this: Box<Expression>,
12091 pub format: String,
12092 #[serde(default)]
12093 pub culture: Option<Box<Expression>>,
12094 #[serde(default)]
12095 pub zone: Option<Box<Expression>>,
12096}
12097
12098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12100#[cfg_attr(feature = "bindings", derive(TS))]
12101pub struct TimeStrToTime {
12102 pub this: Box<Expression>,
12103 #[serde(default)]
12104 pub zone: Option<Box<Expression>>,
12105}
12106
12107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12109#[cfg_attr(feature = "bindings", derive(TS))]
12110pub struct TsOrDsAdd {
12111 pub this: Box<Expression>,
12112 pub expression: Box<Expression>,
12113 #[serde(default)]
12114 pub unit: Option<String>,
12115 #[serde(default)]
12116 pub return_type: Option<Box<Expression>>,
12117}
12118
12119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12121#[cfg_attr(feature = "bindings", derive(TS))]
12122pub struct TsOrDsDiff {
12123 pub this: Box<Expression>,
12124 pub expression: Box<Expression>,
12125 #[serde(default)]
12126 pub unit: Option<String>,
12127}
12128
12129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12131#[cfg_attr(feature = "bindings", derive(TS))]
12132pub struct TsOrDsToDate {
12133 pub this: Box<Expression>,
12134 #[serde(default)]
12135 pub format: Option<String>,
12136 #[serde(default)]
12137 pub safe: Option<Box<Expression>>,
12138}
12139
12140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12142#[cfg_attr(feature = "bindings", derive(TS))]
12143pub struct TsOrDsToTime {
12144 pub this: Box<Expression>,
12145 #[serde(default)]
12146 pub format: Option<String>,
12147 #[serde(default)]
12148 pub safe: Option<Box<Expression>>,
12149}
12150
12151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12153#[cfg_attr(feature = "bindings", derive(TS))]
12154pub struct Unhex {
12155 pub this: Box<Expression>,
12156 #[serde(default)]
12157 pub expression: Option<Box<Expression>>,
12158}
12159
12160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12162#[cfg_attr(feature = "bindings", derive(TS))]
12163pub struct Uniform {
12164 pub this: Box<Expression>,
12165 pub expression: Box<Expression>,
12166 #[serde(default)]
12167 pub gen: Option<Box<Expression>>,
12168 #[serde(default)]
12169 pub seed: Option<Box<Expression>>,
12170}
12171
12172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12174#[cfg_attr(feature = "bindings", derive(TS))]
12175pub struct UnixToStr {
12176 pub this: Box<Expression>,
12177 #[serde(default)]
12178 pub format: Option<String>,
12179}
12180
12181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12183#[cfg_attr(feature = "bindings", derive(TS))]
12184pub struct UnixToTime {
12185 pub this: Box<Expression>,
12186 #[serde(default)]
12187 pub scale: Option<i64>,
12188 #[serde(default)]
12189 pub zone: Option<Box<Expression>>,
12190 #[serde(default)]
12191 pub hours: Option<Box<Expression>>,
12192 #[serde(default)]
12193 pub minutes: Option<Box<Expression>>,
12194 #[serde(default)]
12195 pub format: Option<String>,
12196 #[serde(default)]
12197 pub target_type: Option<Box<Expression>>,
12198}
12199
12200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12202#[cfg_attr(feature = "bindings", derive(TS))]
12203pub struct Uuid {
12204 #[serde(default)]
12205 pub this: Option<Box<Expression>>,
12206 #[serde(default)]
12207 pub name: Option<String>,
12208 #[serde(default)]
12209 pub is_string: Option<Box<Expression>>,
12210}
12211
12212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12214#[cfg_attr(feature = "bindings", derive(TS))]
12215pub struct TimestampFromParts {
12216 #[serde(default)]
12217 pub zone: Option<Box<Expression>>,
12218 #[serde(default)]
12219 pub milli: Option<Box<Expression>>,
12220 #[serde(default)]
12221 pub this: Option<Box<Expression>>,
12222 #[serde(default)]
12223 pub expression: Option<Box<Expression>>,
12224}
12225
12226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12228#[cfg_attr(feature = "bindings", derive(TS))]
12229pub struct TimestampTzFromParts {
12230 #[serde(default)]
12231 pub zone: Option<Box<Expression>>,
12232}
12233
12234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12236#[cfg_attr(feature = "bindings", derive(TS))]
12237pub struct Corr {
12238 pub this: Box<Expression>,
12239 pub expression: Box<Expression>,
12240 #[serde(default)]
12241 pub null_on_zero_variance: Option<Box<Expression>>,
12242}
12243
12244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12246#[cfg_attr(feature = "bindings", derive(TS))]
12247pub struct WidthBucket {
12248 pub this: Box<Expression>,
12249 #[serde(default)]
12250 pub min_value: Option<Box<Expression>>,
12251 #[serde(default)]
12252 pub max_value: Option<Box<Expression>>,
12253 #[serde(default)]
12254 pub num_buckets: Option<Box<Expression>>,
12255 #[serde(default)]
12256 pub threshold: Option<Box<Expression>>,
12257}
12258
12259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12261#[cfg_attr(feature = "bindings", derive(TS))]
12262pub struct CovarSamp {
12263 pub this: Box<Expression>,
12264 pub expression: Box<Expression>,
12265}
12266
12267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12269#[cfg_attr(feature = "bindings", derive(TS))]
12270pub struct CovarPop {
12271 pub this: Box<Expression>,
12272 pub expression: Box<Expression>,
12273}
12274
12275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12277#[cfg_attr(feature = "bindings", derive(TS))]
12278pub struct Week {
12279 pub this: Box<Expression>,
12280 #[serde(default)]
12281 pub mode: Option<Box<Expression>>,
12282}
12283
12284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12286#[cfg_attr(feature = "bindings", derive(TS))]
12287pub struct XMLElement {
12288 pub this: Box<Expression>,
12289 #[serde(default)]
12290 pub expressions: Vec<Expression>,
12291 #[serde(default)]
12292 pub evalname: Option<Box<Expression>>,
12293}
12294
12295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12297#[cfg_attr(feature = "bindings", derive(TS))]
12298pub struct XMLGet {
12299 pub this: Box<Expression>,
12300 pub expression: Box<Expression>,
12301 #[serde(default)]
12302 pub instance: Option<Box<Expression>>,
12303}
12304
12305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12307#[cfg_attr(feature = "bindings", derive(TS))]
12308pub struct XMLTable {
12309 pub this: Box<Expression>,
12310 #[serde(default)]
12311 pub namespaces: Option<Box<Expression>>,
12312 #[serde(default)]
12313 pub passing: Option<Box<Expression>>,
12314 #[serde(default)]
12315 pub columns: Vec<Expression>,
12316 #[serde(default)]
12317 pub by_ref: Option<Box<Expression>>,
12318}
12319
12320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12322#[cfg_attr(feature = "bindings", derive(TS))]
12323pub struct XMLKeyValueOption {
12324 pub this: Box<Expression>,
12325 #[serde(default)]
12326 pub expression: Option<Box<Expression>>,
12327}
12328
12329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12331#[cfg_attr(feature = "bindings", derive(TS))]
12332pub struct Zipf {
12333 pub this: Box<Expression>,
12334 #[serde(default)]
12335 pub elementcount: Option<Box<Expression>>,
12336 #[serde(default)]
12337 pub gen: Option<Box<Expression>>,
12338}
12339
12340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12342#[cfg_attr(feature = "bindings", derive(TS))]
12343pub struct Merge {
12344 pub this: Box<Expression>,
12345 pub using: Box<Expression>,
12346 #[serde(default)]
12347 pub on: Option<Box<Expression>>,
12348 #[serde(default)]
12349 pub using_cond: Option<Box<Expression>>,
12350 #[serde(default)]
12351 pub whens: Option<Box<Expression>>,
12352 #[serde(default)]
12353 pub with_: Option<Box<Expression>>,
12354 #[serde(default)]
12355 pub returning: Option<Box<Expression>>,
12356}
12357
12358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12360#[cfg_attr(feature = "bindings", derive(TS))]
12361pub struct When {
12362 #[serde(default)]
12363 pub matched: Option<Box<Expression>>,
12364 #[serde(default)]
12365 pub source: Option<Box<Expression>>,
12366 #[serde(default)]
12367 pub condition: Option<Box<Expression>>,
12368 pub then: Box<Expression>,
12369}
12370
12371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12373#[cfg_attr(feature = "bindings", derive(TS))]
12374pub struct Whens {
12375 #[serde(default)]
12376 pub expressions: Vec<Expression>,
12377}
12378
12379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12381#[cfg_attr(feature = "bindings", derive(TS))]
12382pub struct NextValueFor {
12383 pub this: Box<Expression>,
12384 #[serde(default)]
12385 pub order: Option<Box<Expression>>,
12386}
12387
12388
12389#[cfg(test)]
12390mod tests {
12391 use super::*;
12392
12393 #[test]
12394 #[cfg(feature = "bindings")]
12395 fn export_typescript_types() {
12396 Expression::export_all(&ts_rs::Config::default()).expect("Failed to export Expression types");
12399 }
12400
12401 #[test]
12402 fn test_simple_select_builder() {
12403 let select = Select::new()
12404 .column(Expression::star())
12405 .from(Expression::Table(TableRef::new("users")));
12406
12407 assert_eq!(select.expressions.len(), 1);
12408 assert!(select.from.is_some());
12409 }
12410
12411 #[test]
12412 fn test_expression_alias() {
12413 let expr = Expression::column("id").alias("user_id");
12414
12415 match expr {
12416 Expression::Alias(a) => {
12417 assert_eq!(a.alias.name, "user_id");
12418 }
12419 _ => panic!("Expected Alias"),
12420 }
12421 }
12422
12423 #[test]
12424 fn test_literal_creation() {
12425 let num = Expression::number(42);
12426 let str = Expression::string("hello");
12427
12428 match num {
12429 Expression::Literal(Literal::Number(n)) => assert_eq!(n, "42"),
12430 _ => panic!("Expected Number"),
12431 }
12432
12433 match str {
12434 Expression::Literal(Literal::String(s)) => assert_eq!(s, "hello"),
12435 _ => panic!("Expected String"),
12436 }
12437 }
12438
12439 #[test]
12440 fn test_expression_sql() {
12441 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
12442 assert_eq!(expr.sql(), "SELECT 1 + 2");
12443 }
12444
12445 #[test]
12446 fn test_expression_sql_for() {
12447 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
12448 let sql = expr.sql_for(crate::DialectType::Generic);
12449 assert!(sql.contains("IF"));
12450 }
12451}