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<VarArgFunc>),
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 Variadic(Box<Variadic>),
791 Version(Box<Version>),
792 Schema(Box<Schema>),
793 Lock(Box<Lock>),
794 TableSample(Box<TableSample>),
795 Tag(Box<Tag>),
796 UnpivotColumns(Box<UnpivotColumns>),
797 WindowSpec(Box<WindowSpec>),
798 SessionParameter(Box<SessionParameter>),
799 PseudoType(Box<PseudoType>),
800 ObjectIdentifier(Box<ObjectIdentifier>),
801 Transaction(Box<Transaction>),
802 Commit(Box<Commit>),
803 Rollback(Box<Rollback>),
804 AlterSession(Box<AlterSession>),
805 Analyze(Box<Analyze>),
806 AnalyzeStatistics(Box<AnalyzeStatistics>),
807 AnalyzeHistogram(Box<AnalyzeHistogram>),
808 AnalyzeSample(Box<AnalyzeSample>),
809 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
810 AnalyzeDelete(Box<AnalyzeDelete>),
811 AnalyzeWith(Box<AnalyzeWith>),
812 AnalyzeValidate(Box<AnalyzeValidate>),
813 AddPartition(Box<AddPartition>),
814 AttachOption(Box<AttachOption>),
815 DropPartition(Box<DropPartition>),
816 ReplacePartition(Box<ReplacePartition>),
817 DPipe(Box<DPipe>),
818 Operator(Box<Operator>),
819 PivotAny(Box<PivotAny>),
820 Aliases(Box<Aliases>),
821 AtIndex(Box<AtIndex>),
822 FromTimeZone(Box<FromTimeZone>),
823 FormatPhrase(Box<FormatPhrase>),
824 ForIn(Box<ForIn>),
825 TimeUnit(Box<TimeUnit>),
826 IntervalOp(Box<IntervalOp>),
827 IntervalSpan(Box<IntervalSpan>),
828 HavingMax(Box<HavingMax>),
829 CosineDistance(Box<CosineDistance>),
830 DotProduct(Box<DotProduct>),
831 EuclideanDistance(Box<EuclideanDistance>),
832 ManhattanDistance(Box<ManhattanDistance>),
833 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
834 Booland(Box<Booland>),
835 Boolor(Box<Boolor>),
836 ParameterizedAgg(Box<ParameterizedAgg>),
837 ArgMax(Box<ArgMax>),
838 ArgMin(Box<ArgMin>),
839 ApproxTopK(Box<ApproxTopK>),
840 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
841 ApproxTopKCombine(Box<ApproxTopKCombine>),
842 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
843 ApproxTopSum(Box<ApproxTopSum>),
844 ApproxQuantiles(Box<ApproxQuantiles>),
845 Minhash(Box<Minhash>),
846 FarmFingerprint(Box<FarmFingerprint>),
847 Float64(Box<Float64>),
848 Transform(Box<Transform>),
849 Translate(Box<Translate>),
850 Grouping(Box<Grouping>),
851 GroupingId(Box<GroupingId>),
852 Anonymous(Box<Anonymous>),
853 AnonymousAggFunc(Box<AnonymousAggFunc>),
854 CombinedAggFunc(Box<CombinedAggFunc>),
855 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
856 HashAgg(Box<HashAgg>),
857 Hll(Box<Hll>),
858 Apply(Box<Apply>),
859 ToBoolean(Box<ToBoolean>),
860 List(Box<List>),
861 ToMap(Box<ToMap>),
862 Pad(Box<Pad>),
863 ToChar(Box<ToChar>),
864 ToNumber(Box<ToNumber>),
865 ToDouble(Box<ToDouble>),
866 Int64(Box<UnaryFunc>),
867 StringFunc(Box<StringFunc>),
868 ToDecfloat(Box<ToDecfloat>),
869 TryToDecfloat(Box<TryToDecfloat>),
870 ToFile(Box<ToFile>),
871 Columns(Box<Columns>),
872 ConvertToCharset(Box<ConvertToCharset>),
873 ConvertTimezone(Box<ConvertTimezone>),
874 GenerateSeries(Box<GenerateSeries>),
875 AIAgg(Box<AIAgg>),
876 AIClassify(Box<AIClassify>),
877 ArrayAll(Box<ArrayAll>),
878 ArrayAny(Box<ArrayAny>),
879 ArrayConstructCompact(Box<ArrayConstructCompact>),
880 StPoint(Box<StPoint>),
881 StDistance(Box<StDistance>),
882 StringToArray(Box<StringToArray>),
883 ArraySum(Box<ArraySum>),
884 ObjectAgg(Box<ObjectAgg>),
885 CastToStrType(Box<CastToStrType>),
886 CheckJson(Box<CheckJson>),
887 CheckXml(Box<CheckXml>),
888 TranslateCharacters(Box<TranslateCharacters>),
889 CurrentSchemas(Box<CurrentSchemas>),
890 CurrentDatetime(Box<CurrentDatetime>),
891 Localtime(Box<Localtime>),
892 Localtimestamp(Box<Localtimestamp>),
893 Systimestamp(Box<Systimestamp>),
894 CurrentSchema(Box<CurrentSchema>),
895 CurrentUser(Box<CurrentUser>),
896 UtcTime(Box<UtcTime>),
897 UtcTimestamp(Box<UtcTimestamp>),
898 Timestamp(Box<TimestampFunc>),
899 DateBin(Box<DateBin>),
900 Datetime(Box<Datetime>),
901 DatetimeAdd(Box<DatetimeAdd>),
902 DatetimeSub(Box<DatetimeSub>),
903 DatetimeDiff(Box<DatetimeDiff>),
904 DatetimeTrunc(Box<DatetimeTrunc>),
905 Dayname(Box<Dayname>),
906 MakeInterval(Box<MakeInterval>),
907 PreviousDay(Box<PreviousDay>),
908 Elt(Box<Elt>),
909 TimestampAdd(Box<TimestampAdd>),
910 TimestampSub(Box<TimestampSub>),
911 TimestampDiff(Box<TimestampDiff>),
912 TimeSlice(Box<TimeSlice>),
913 TimeAdd(Box<TimeAdd>),
914 TimeSub(Box<TimeSub>),
915 TimeDiff(Box<TimeDiff>),
916 TimeTrunc(Box<TimeTrunc>),
917 DateFromParts(Box<DateFromParts>),
918 TimeFromParts(Box<TimeFromParts>),
919 DecodeCase(Box<DecodeCase>),
920 Decrypt(Box<Decrypt>),
921 DecryptRaw(Box<DecryptRaw>),
922 Encode(Box<Encode>),
923 Encrypt(Box<Encrypt>),
924 EncryptRaw(Box<EncryptRaw>),
925 EqualNull(Box<EqualNull>),
926 ToBinary(Box<ToBinary>),
927 Base64DecodeBinary(Box<Base64DecodeBinary>),
928 Base64DecodeString(Box<Base64DecodeString>),
929 Base64Encode(Box<Base64Encode>),
930 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
931 TryBase64DecodeString(Box<TryBase64DecodeString>),
932 GapFill(Box<GapFill>),
933 GenerateDateArray(Box<GenerateDateArray>),
934 GenerateTimestampArray(Box<GenerateTimestampArray>),
935 GetExtract(Box<GetExtract>),
936 Getbit(Box<Getbit>),
937 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
938 HexEncode(Box<HexEncode>),
939 Compress(Box<Compress>),
940 DecompressBinary(Box<DecompressBinary>),
941 DecompressString(Box<DecompressString>),
942 Xor(Box<Xor>),
943 Nullif(Box<Nullif>),
944 JSON(Box<JSON>),
945 JSONPath(Box<JSONPath>),
946 JSONPathFilter(Box<JSONPathFilter>),
947 JSONPathKey(Box<JSONPathKey>),
948 JSONPathRecursive(Box<JSONPathRecursive>),
949 JSONPathScript(Box<JSONPathScript>),
950 JSONPathSlice(Box<JSONPathSlice>),
951 JSONPathSelector(Box<JSONPathSelector>),
952 JSONPathSubscript(Box<JSONPathSubscript>),
953 JSONPathUnion(Box<JSONPathUnion>),
954 Format(Box<Format>),
955 JSONKeys(Box<JSONKeys>),
956 JSONKeyValue(Box<JSONKeyValue>),
957 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
958 JSONObject(Box<JSONObject>),
959 JSONObjectAgg(Box<JSONObjectAgg>),
960 JSONBObjectAgg(Box<JSONBObjectAgg>),
961 JSONArray(Box<JSONArray>),
962 JSONArrayAgg(Box<JSONArrayAgg>),
963 JSONExists(Box<JSONExists>),
964 JSONColumnDef(Box<JSONColumnDef>),
965 JSONSchema(Box<JSONSchema>),
966 JSONSet(Box<JSONSet>),
967 JSONStripNulls(Box<JSONStripNulls>),
968 JSONValue(Box<JSONValue>),
969 JSONValueArray(Box<JSONValueArray>),
970 JSONRemove(Box<JSONRemove>),
971 JSONTable(Box<JSONTable>),
972 JSONType(Box<JSONType>),
973 ObjectInsert(Box<ObjectInsert>),
974 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
975 OpenJSON(Box<OpenJSON>),
976 JSONBExists(Box<JSONBExists>),
977 JSONBContains(Box<BinaryFunc>),
978 JSONBExtract(Box<BinaryFunc>),
979 JSONCast(Box<JSONCast>),
980 JSONExtract(Box<JSONExtract>),
981 JSONExtractQuote(Box<JSONExtractQuote>),
982 JSONExtractArray(Box<JSONExtractArray>),
983 JSONExtractScalar(Box<JSONExtractScalar>),
984 JSONBExtractScalar(Box<JSONBExtractScalar>),
985 JSONFormat(Box<JSONFormat>),
986 JSONBool(Box<UnaryFunc>),
987 JSONPathRoot(JSONPathRoot),
988 JSONArrayAppend(Box<JSONArrayAppend>),
989 JSONArrayContains(Box<JSONArrayContains>),
990 JSONArrayInsert(Box<JSONArrayInsert>),
991 ParseJSON(Box<ParseJSON>),
992 ParseUrl(Box<ParseUrl>),
993 ParseIp(Box<ParseIp>),
994 ParseTime(Box<ParseTime>),
995 ParseDatetime(Box<ParseDatetime>),
996 Map(Box<Map>),
997 MapCat(Box<MapCat>),
998 MapDelete(Box<MapDelete>),
999 MapInsert(Box<MapInsert>),
1000 MapPick(Box<MapPick>),
1001 ScopeResolution(Box<ScopeResolution>),
1002 Slice(Box<Slice>),
1003 VarMap(Box<VarMap>),
1004 MatchAgainst(Box<MatchAgainst>),
1005 MD5Digest(Box<MD5Digest>),
1006 MD5NumberLower64(Box<UnaryFunc>),
1007 MD5NumberUpper64(Box<UnaryFunc>),
1008 Monthname(Box<Monthname>),
1009 Ntile(Box<Ntile>),
1010 Normalize(Box<Normalize>),
1011 Normal(Box<Normal>),
1012 Predict(Box<Predict>),
1013 MLTranslate(Box<MLTranslate>),
1014 FeaturesAtTime(Box<FeaturesAtTime>),
1015 GenerateEmbedding(Box<GenerateEmbedding>),
1016 MLForecast(Box<MLForecast>),
1017 ModelAttribute(Box<ModelAttribute>),
1018 VectorSearch(Box<VectorSearch>),
1019 Quantile(Box<Quantile>),
1020 ApproxQuantile(Box<ApproxQuantile>),
1021 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1022 Randn(Box<Randn>),
1023 Randstr(Box<Randstr>),
1024 RangeN(Box<RangeN>),
1025 RangeBucket(Box<RangeBucket>),
1026 ReadCSV(Box<ReadCSV>),
1027 ReadParquet(Box<ReadParquet>),
1028 Reduce(Box<Reduce>),
1029 RegexpExtractAll(Box<RegexpExtractAll>),
1030 RegexpILike(Box<RegexpILike>),
1031 RegexpFullMatch(Box<RegexpFullMatch>),
1032 RegexpInstr(Box<RegexpInstr>),
1033 RegexpSplit(Box<RegexpSplit>),
1034 RegexpCount(Box<RegexpCount>),
1035 RegrValx(Box<RegrValx>),
1036 RegrValy(Box<RegrValy>),
1037 RegrAvgy(Box<RegrAvgy>),
1038 RegrAvgx(Box<RegrAvgx>),
1039 RegrCount(Box<RegrCount>),
1040 RegrIntercept(Box<RegrIntercept>),
1041 RegrR2(Box<RegrR2>),
1042 RegrSxx(Box<RegrSxx>),
1043 RegrSxy(Box<RegrSxy>),
1044 RegrSyy(Box<RegrSyy>),
1045 RegrSlope(Box<RegrSlope>),
1046 SafeAdd(Box<SafeAdd>),
1047 SafeDivide(Box<SafeDivide>),
1048 SafeMultiply(Box<SafeMultiply>),
1049 SafeSubtract(Box<SafeSubtract>),
1050 SHA2(Box<SHA2>),
1051 SHA2Digest(Box<SHA2Digest>),
1052 SortArray(Box<SortArray>),
1053 SplitPart(Box<SplitPart>),
1054 SubstringIndex(Box<SubstringIndex>),
1055 StandardHash(Box<StandardHash>),
1056 StrPosition(Box<StrPosition>),
1057 Search(Box<Search>),
1058 SearchIp(Box<SearchIp>),
1059 StrToDate(Box<StrToDate>),
1060 DateStrToDate(Box<UnaryFunc>),
1061 DateToDateStr(Box<UnaryFunc>),
1062 StrToTime(Box<StrToTime>),
1063 StrToUnix(Box<StrToUnix>),
1064 StrToMap(Box<StrToMap>),
1065 NumberToStr(Box<NumberToStr>),
1066 FromBase(Box<FromBase>),
1067 Stuff(Box<Stuff>),
1068 TimeToStr(Box<TimeToStr>),
1069 TimeStrToTime(Box<TimeStrToTime>),
1070 TsOrDsAdd(Box<TsOrDsAdd>),
1071 TsOrDsDiff(Box<TsOrDsDiff>),
1072 TsOrDsToDate(Box<TsOrDsToDate>),
1073 TsOrDsToTime(Box<TsOrDsToTime>),
1074 Unhex(Box<Unhex>),
1075 Uniform(Box<Uniform>),
1076 UnixToStr(Box<UnixToStr>),
1077 UnixToTime(Box<UnixToTime>),
1078 Uuid(Box<Uuid>),
1079 TimestampFromParts(Box<TimestampFromParts>),
1080 TimestampTzFromParts(Box<TimestampTzFromParts>),
1081 Corr(Box<Corr>),
1082 WidthBucket(Box<WidthBucket>),
1083 CovarSamp(Box<CovarSamp>),
1084 CovarPop(Box<CovarPop>),
1085 Week(Box<Week>),
1086 XMLElement(Box<XMLElement>),
1087 XMLGet(Box<XMLGet>),
1088 XMLTable(Box<XMLTable>),
1089 XMLKeyValueOption(Box<XMLKeyValueOption>),
1090 Zipf(Box<Zipf>),
1091 Merge(Box<Merge>),
1092 When(Box<When>),
1093 Whens(Box<Whens>),
1094 NextValueFor(Box<NextValueFor>),
1095 ReturnStmt(Box<Expression>),
1097}
1098
1099impl Expression {
1100 pub fn is_statement(&self) -> bool {
1107 match self {
1108 Expression::Select(_)
1110 | Expression::Union(_)
1111 | Expression::Intersect(_)
1112 | Expression::Except(_)
1113 | Expression::Subquery(_)
1114 | Expression::Values(_)
1115 | Expression::PipeOperator(_)
1116
1117 | Expression::Insert(_)
1119 | Expression::Update(_)
1120 | Expression::Delete(_)
1121 | Expression::Copy(_)
1122 | Expression::Put(_)
1123 | Expression::Merge(_)
1124
1125 | Expression::CreateTable(_)
1127 | Expression::DropTable(_)
1128 | Expression::AlterTable(_)
1129 | Expression::CreateIndex(_)
1130 | Expression::DropIndex(_)
1131 | Expression::CreateView(_)
1132 | Expression::DropView(_)
1133 | Expression::AlterView(_)
1134 | Expression::AlterIndex(_)
1135 | Expression::Truncate(_)
1136 | Expression::TruncateTable(_)
1137 | Expression::CreateSchema(_)
1138 | Expression::DropSchema(_)
1139 | Expression::DropNamespace(_)
1140 | Expression::CreateDatabase(_)
1141 | Expression::DropDatabase(_)
1142 | Expression::CreateFunction(_)
1143 | Expression::DropFunction(_)
1144 | Expression::CreateProcedure(_)
1145 | Expression::DropProcedure(_)
1146 | Expression::CreateSequence(_)
1147 | Expression::DropSequence(_)
1148 | Expression::AlterSequence(_)
1149 | Expression::CreateTrigger(_)
1150 | Expression::DropTrigger(_)
1151 | Expression::CreateType(_)
1152 | Expression::DropType(_)
1153 | Expression::Comment(_)
1154
1155 | Expression::Use(_)
1157 | Expression::Set(_)
1158 | Expression::SetStatement(_)
1159 | Expression::Transaction(_)
1160 | Expression::Commit(_)
1161 | Expression::Rollback(_)
1162 | Expression::Grant(_)
1163 | Expression::Revoke(_)
1164 | Expression::Cache(_)
1165 | Expression::Uncache(_)
1166 | Expression::LoadData(_)
1167 | Expression::Pragma(_)
1168 | Expression::Describe(_)
1169 | Expression::Show(_)
1170 | Expression::Kill(_)
1171 | Expression::Execute(_)
1172 | Expression::Declare(_)
1173 | Expression::Refresh(_)
1174 | Expression::AlterSession(_)
1175 | Expression::LockingStatement(_)
1176
1177 | Expression::Analyze(_)
1179 | Expression::AnalyzeStatistics(_)
1180 | Expression::AnalyzeHistogram(_)
1181 | Expression::AnalyzeSample(_)
1182 | Expression::AnalyzeListChainedRows(_)
1183 | Expression::AnalyzeDelete(_)
1184
1185 | Expression::Attach(_)
1187 | Expression::Detach(_)
1188 | Expression::Install(_)
1189 | Expression::Summarize(_)
1190
1191 | Expression::Pivot(_)
1193 | Expression::Unpivot(_)
1194
1195 | Expression::Command(_)
1197 | Expression::Raw(_)
1198
1199 | Expression::ReturnStmt(_) => true,
1201
1202 Expression::Annotated(a) => a.this.is_statement(),
1204
1205 Expression::Alias(a) => a.this.is_statement(),
1207
1208 _ => false,
1210 }
1211 }
1212
1213 pub fn number(n: i64) -> Self {
1215 Expression::Literal(Literal::Number(n.to_string()))
1216 }
1217
1218 pub fn string(s: impl Into<String>) -> Self {
1220 Expression::Literal(Literal::String(s.into()))
1221 }
1222
1223 pub fn float(f: f64) -> Self {
1225 Expression::Literal(Literal::Number(f.to_string()))
1226 }
1227
1228 pub fn column(name: impl Into<String>) -> Self {
1230 Expression::Column(Column {
1231 name: Identifier::new(name),
1232 table: None,
1233 join_mark: false,
1234 trailing_comments: Vec::new(),
1235 })
1236 }
1237
1238 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1240 Expression::Column(Column {
1241 name: Identifier::new(column),
1242 table: Some(Identifier::new(table)),
1243 join_mark: false,
1244 trailing_comments: Vec::new(),
1245 })
1246 }
1247
1248 pub fn identifier(name: impl Into<String>) -> Self {
1250 Expression::Identifier(Identifier::new(name))
1251 }
1252
1253 pub fn null() -> Self {
1255 Expression::Null(Null)
1256 }
1257
1258 pub fn true_() -> Self {
1260 Expression::Boolean(BooleanLiteral { value: true })
1261 }
1262
1263 pub fn false_() -> Self {
1265 Expression::Boolean(BooleanLiteral { value: false })
1266 }
1267
1268 pub fn star() -> Self {
1270 Expression::Star(Star {
1271 table: None,
1272 except: None,
1273 replace: None,
1274 rename: None,
1275 trailing_comments: Vec::new(),
1276 })
1277 }
1278
1279 pub fn alias(self, name: impl Into<String>) -> Self {
1281 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1282 }
1283
1284 pub fn is_select(&self) -> bool {
1286 matches!(self, Expression::Select(_))
1287 }
1288
1289 pub fn as_select(&self) -> Option<&Select> {
1291 match self {
1292 Expression::Select(s) => Some(s),
1293 _ => None,
1294 }
1295 }
1296
1297 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1299 match self {
1300 Expression::Select(s) => Some(s),
1301 _ => None,
1302 }
1303 }
1304
1305 pub fn sql(&self) -> String {
1310 crate::generator::Generator::sql(self).unwrap_or_default()
1311 }
1312
1313 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1319 crate::generate(self, dialect).unwrap_or_default()
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 {
1836 expressions,
1837 siblings: false,
1838 comments: Vec::new(),
1839 });
1840 self
1841 }
1842
1843 pub fn limit(mut self, n: Expression) -> Self {
1845 self.limit = Some(Limit {
1846 this: n,
1847 percent: false,
1848 comments: Vec::new(),
1849 });
1850 self
1851 }
1852
1853 pub fn offset(mut self, n: Expression) -> Self {
1855 self.offset = Some(Offset {
1856 this: n,
1857 rows: None,
1858 });
1859 self
1860 }
1861}
1862
1863impl Default for Select {
1864 fn default() -> Self {
1865 Self::new()
1866 }
1867}
1868
1869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1875#[cfg_attr(feature = "bindings", derive(TS))]
1876pub struct Union {
1877 pub left: Expression,
1879 pub right: Expression,
1881 pub all: bool,
1883 #[serde(default)]
1885 pub distinct: bool,
1886 pub with: Option<With>,
1888 pub order_by: Option<OrderBy>,
1890 pub limit: Option<Box<Expression>>,
1892 pub offset: Option<Box<Expression>>,
1894 #[serde(default, skip_serializing_if = "Option::is_none")]
1896 pub distribute_by: Option<DistributeBy>,
1897 #[serde(default, skip_serializing_if = "Option::is_none")]
1899 pub sort_by: Option<SortBy>,
1900 #[serde(default, skip_serializing_if = "Option::is_none")]
1902 pub cluster_by: Option<ClusterBy>,
1903 #[serde(default)]
1905 pub by_name: bool,
1906 #[serde(default, skip_serializing_if = "Option::is_none")]
1908 pub side: Option<String>,
1909 #[serde(default, skip_serializing_if = "Option::is_none")]
1911 pub kind: Option<String>,
1912 #[serde(default)]
1914 pub corresponding: bool,
1915 #[serde(default)]
1917 pub strict: bool,
1918 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1920 pub on_columns: Vec<Expression>,
1921}
1922
1923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1928#[cfg_attr(feature = "bindings", derive(TS))]
1929pub struct Intersect {
1930 pub left: Expression,
1932 pub right: Expression,
1934 pub all: bool,
1936 #[serde(default)]
1938 pub distinct: bool,
1939 pub with: Option<With>,
1941 pub order_by: Option<OrderBy>,
1943 pub limit: Option<Box<Expression>>,
1945 pub offset: Option<Box<Expression>>,
1947 #[serde(default, skip_serializing_if = "Option::is_none")]
1949 pub distribute_by: Option<DistributeBy>,
1950 #[serde(default, skip_serializing_if = "Option::is_none")]
1952 pub sort_by: Option<SortBy>,
1953 #[serde(default, skip_serializing_if = "Option::is_none")]
1955 pub cluster_by: Option<ClusterBy>,
1956 #[serde(default)]
1958 pub by_name: bool,
1959 #[serde(default, skip_serializing_if = "Option::is_none")]
1961 pub side: Option<String>,
1962 #[serde(default, skip_serializing_if = "Option::is_none")]
1964 pub kind: Option<String>,
1965 #[serde(default)]
1967 pub corresponding: bool,
1968 #[serde(default)]
1970 pub strict: bool,
1971 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1973 pub on_columns: Vec<Expression>,
1974}
1975
1976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1981#[cfg_attr(feature = "bindings", derive(TS))]
1982pub struct Except {
1983 pub left: Expression,
1985 pub right: Expression,
1987 pub all: bool,
1989 #[serde(default)]
1991 pub distinct: bool,
1992 pub with: Option<With>,
1994 pub order_by: Option<OrderBy>,
1996 pub limit: Option<Box<Expression>>,
1998 pub offset: Option<Box<Expression>>,
2000 #[serde(default, skip_serializing_if = "Option::is_none")]
2002 pub distribute_by: Option<DistributeBy>,
2003 #[serde(default, skip_serializing_if = "Option::is_none")]
2005 pub sort_by: Option<SortBy>,
2006 #[serde(default, skip_serializing_if = "Option::is_none")]
2008 pub cluster_by: Option<ClusterBy>,
2009 #[serde(default)]
2011 pub by_name: bool,
2012 #[serde(default, skip_serializing_if = "Option::is_none")]
2014 pub side: Option<String>,
2015 #[serde(default, skip_serializing_if = "Option::is_none")]
2017 pub kind: Option<String>,
2018 #[serde(default)]
2020 pub corresponding: bool,
2021 #[serde(default)]
2023 pub strict: bool,
2024 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2026 pub on_columns: Vec<Expression>,
2027}
2028
2029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2031#[cfg_attr(feature = "bindings", derive(TS))]
2032pub struct SelectInto {
2033 pub this: Expression,
2035 #[serde(default)]
2037 pub temporary: bool,
2038 #[serde(default)]
2040 pub unlogged: bool,
2041 #[serde(default)]
2043 pub bulk_collect: bool,
2044 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2046 pub expressions: Vec<Expression>,
2047}
2048
2049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2059#[cfg_attr(feature = "bindings", derive(TS))]
2060pub struct Subquery {
2061 pub this: Expression,
2063 pub alias: Option<Identifier>,
2065 pub column_aliases: Vec<Identifier>,
2067 pub order_by: Option<OrderBy>,
2069 pub limit: Option<Limit>,
2071 pub offset: Option<Offset>,
2073 #[serde(default, skip_serializing_if = "Option::is_none")]
2075 pub distribute_by: Option<DistributeBy>,
2076 #[serde(default, skip_serializing_if = "Option::is_none")]
2078 pub sort_by: Option<SortBy>,
2079 #[serde(default, skip_serializing_if = "Option::is_none")]
2081 pub cluster_by: Option<ClusterBy>,
2082 #[serde(default)]
2084 pub lateral: bool,
2085 #[serde(default)]
2089 pub modifiers_inside: bool,
2090 #[serde(default)]
2092 pub trailing_comments: Vec<String>,
2093}
2094
2095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2100#[cfg_attr(feature = "bindings", derive(TS))]
2101pub struct PipeOperator {
2102 pub this: Expression,
2104 pub expression: Expression,
2106}
2107
2108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2110#[cfg_attr(feature = "bindings", derive(TS))]
2111pub struct Values {
2112 pub expressions: Vec<Tuple>,
2114 pub alias: Option<Identifier>,
2116 pub column_aliases: Vec<Identifier>,
2118}
2119
2120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2130#[cfg_attr(feature = "bindings", derive(TS))]
2131pub struct Pivot {
2132 pub this: Expression,
2134 #[serde(default)]
2137 pub expressions: Vec<Expression>,
2138 #[serde(default)]
2140 pub fields: Vec<Expression>,
2141 #[serde(default)]
2143 pub using: Vec<Expression>,
2144 #[serde(default)]
2146 pub group: Option<Box<Expression>>,
2147 #[serde(default)]
2149 pub unpivot: bool,
2150 #[serde(default)]
2152 pub into: Option<Box<Expression>>,
2153 #[serde(default)]
2155 pub alias: Option<Identifier>,
2156 #[serde(default)]
2158 pub include_nulls: Option<bool>,
2159 #[serde(default)]
2161 pub default_on_null: Option<Box<Expression>>,
2162 #[serde(default, skip_serializing_if = "Option::is_none")]
2164 pub with: Option<With>,
2165}
2166
2167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2169#[cfg_attr(feature = "bindings", derive(TS))]
2170pub struct Unpivot {
2171 pub this: Expression,
2172 pub value_column: Identifier,
2173 pub name_column: Identifier,
2174 pub columns: Vec<Expression>,
2175 pub alias: Option<Identifier>,
2176 #[serde(default)]
2178 pub value_column_parenthesized: bool,
2179 #[serde(default)]
2181 pub include_nulls: Option<bool>,
2182 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2184 pub extra_value_columns: Vec<Identifier>,
2185}
2186
2187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2190#[cfg_attr(feature = "bindings", derive(TS))]
2191pub struct PivotAlias {
2192 pub this: Expression,
2193 pub alias: Expression,
2194}
2195
2196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2198#[cfg_attr(feature = "bindings", derive(TS))]
2199pub struct PreWhere {
2200 pub this: Expression,
2201}
2202
2203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2205#[cfg_attr(feature = "bindings", derive(TS))]
2206pub struct Stream {
2207 pub this: Expression,
2208 #[serde(skip_serializing_if = "Option::is_none")]
2209 pub on: Option<Expression>,
2210 #[serde(skip_serializing_if = "Option::is_none")]
2211 pub show_initial_rows: Option<bool>,
2212}
2213
2214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2216#[cfg_attr(feature = "bindings", derive(TS))]
2217pub struct UsingData {
2218 pub this: Expression,
2219}
2220
2221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2223#[cfg_attr(feature = "bindings", derive(TS))]
2224pub struct XmlNamespace {
2225 pub this: Expression,
2226 #[serde(skip_serializing_if = "Option::is_none")]
2227 pub alias: Option<Identifier>,
2228}
2229
2230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2232#[cfg_attr(feature = "bindings", derive(TS))]
2233pub struct RowFormat {
2234 pub delimited: bool,
2235 pub fields_terminated_by: Option<String>,
2236 pub collection_items_terminated_by: Option<String>,
2237 pub map_keys_terminated_by: Option<String>,
2238 pub lines_terminated_by: Option<String>,
2239 pub null_defined_as: Option<String>,
2240}
2241
2242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2244#[cfg_attr(feature = "bindings", derive(TS))]
2245pub struct DirectoryInsert {
2246 pub local: bool,
2247 pub path: String,
2248 pub row_format: Option<RowFormat>,
2249 #[serde(default)]
2251 pub stored_as: Option<String>,
2252}
2253
2254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2256#[cfg_attr(feature = "bindings", derive(TS))]
2257pub struct Insert {
2258 pub table: TableRef,
2259 pub columns: Vec<Identifier>,
2260 pub values: Vec<Vec<Expression>>,
2261 pub query: Option<Expression>,
2262 pub overwrite: bool,
2264 pub partition: Vec<(Identifier, Option<Expression>)>,
2266 #[serde(default)]
2268 pub directory: Option<DirectoryInsert>,
2269 #[serde(default)]
2271 pub returning: Vec<Expression>,
2272 #[serde(default)]
2274 pub output: Option<OutputClause>,
2275 #[serde(default)]
2277 pub on_conflict: Option<Box<Expression>>,
2278 #[serde(default)]
2280 pub leading_comments: Vec<String>,
2281 #[serde(default)]
2283 pub if_exists: bool,
2284 #[serde(default)]
2286 pub with: Option<With>,
2287 #[serde(default)]
2289 pub ignore: bool,
2290 #[serde(default)]
2292 pub source_alias: Option<Identifier>,
2293 #[serde(default)]
2295 pub alias: Option<Identifier>,
2296 #[serde(default)]
2298 pub alias_explicit_as: bool,
2299 #[serde(default)]
2301 pub default_values: bool,
2302 #[serde(default)]
2304 pub by_name: bool,
2305 #[serde(default, skip_serializing_if = "Option::is_none")]
2307 pub conflict_action: Option<String>,
2308 #[serde(default)]
2310 pub is_replace: bool,
2311 #[serde(default, skip_serializing_if = "Option::is_none")]
2313 pub hint: Option<Hint>,
2314 #[serde(default)]
2316 pub replace_where: Option<Box<Expression>>,
2317 #[serde(default)]
2319 pub source: Option<Box<Expression>>,
2320 #[serde(default, skip_serializing_if = "Option::is_none")]
2322 pub function_target: Option<Box<Expression>>,
2323 #[serde(default, skip_serializing_if = "Option::is_none")]
2325 pub partition_by: Option<Box<Expression>>,
2326 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2328 pub settings: Vec<Expression>,
2329}
2330
2331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2333#[cfg_attr(feature = "bindings", derive(TS))]
2334pub struct OutputClause {
2335 pub columns: Vec<Expression>,
2337 #[serde(default)]
2339 pub into_table: Option<Expression>,
2340}
2341
2342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2344#[cfg_attr(feature = "bindings", derive(TS))]
2345pub struct Update {
2346 pub table: TableRef,
2347 #[serde(default)]
2349 pub extra_tables: Vec<TableRef>,
2350 #[serde(default)]
2352 pub table_joins: Vec<Join>,
2353 pub set: Vec<(Identifier, Expression)>,
2354 pub from_clause: Option<From>,
2355 #[serde(default)]
2357 pub from_joins: Vec<Join>,
2358 pub where_clause: Option<Where>,
2359 #[serde(default)]
2361 pub returning: Vec<Expression>,
2362 #[serde(default)]
2364 pub output: Option<OutputClause>,
2365 #[serde(default)]
2367 pub with: Option<With>,
2368 #[serde(default)]
2370 pub leading_comments: Vec<String>,
2371 #[serde(default)]
2373 pub limit: Option<Expression>,
2374 #[serde(default)]
2376 pub order_by: Option<OrderBy>,
2377 #[serde(default)]
2379 pub from_before_set: bool,
2380}
2381
2382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2384#[cfg_attr(feature = "bindings", derive(TS))]
2385pub struct Delete {
2386 pub table: TableRef,
2387 #[serde(default, skip_serializing_if = "Option::is_none")]
2389 pub on_cluster: Option<OnCluster>,
2390 pub alias: Option<Identifier>,
2392 #[serde(default)]
2394 pub alias_explicit_as: bool,
2395 pub using: Vec<TableRef>,
2397 pub where_clause: Option<Where>,
2398 #[serde(default)]
2400 pub output: Option<OutputClause>,
2401 #[serde(default)]
2403 pub leading_comments: Vec<String>,
2404 #[serde(default)]
2406 pub with: Option<With>,
2407 #[serde(default)]
2409 pub limit: Option<Expression>,
2410 #[serde(default)]
2412 pub order_by: Option<OrderBy>,
2413 #[serde(default)]
2415 pub returning: Vec<Expression>,
2416 #[serde(default)]
2419 pub tables: Vec<TableRef>,
2420 #[serde(default)]
2423 pub tables_from_using: bool,
2424 #[serde(default)]
2426 pub joins: Vec<Join>,
2427 #[serde(default)]
2429 pub force_index: Option<String>,
2430 #[serde(default)]
2432 pub no_from: bool,
2433}
2434
2435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2437#[cfg_attr(feature = "bindings", derive(TS))]
2438pub struct CopyStmt {
2439 pub this: Expression,
2441 pub kind: bool,
2443 pub files: Vec<Expression>,
2445 #[serde(default)]
2447 pub params: Vec<CopyParameter>,
2448 #[serde(default)]
2450 pub credentials: Option<Box<Credentials>>,
2451 #[serde(default)]
2453 pub is_into: bool,
2454 #[serde(default)]
2456 pub with_wrapped: bool,
2457}
2458
2459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2461#[cfg_attr(feature = "bindings", derive(TS))]
2462pub struct CopyParameter {
2463 pub name: String,
2464 pub value: Option<Expression>,
2465 pub values: Vec<Expression>,
2466 #[serde(default)]
2468 pub eq: bool,
2469}
2470
2471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2473#[cfg_attr(feature = "bindings", derive(TS))]
2474pub struct Credentials {
2475 pub credentials: Vec<(String, String)>,
2476 pub encryption: Option<String>,
2477 pub storage: Option<String>,
2478}
2479
2480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2482#[cfg_attr(feature = "bindings", derive(TS))]
2483pub struct PutStmt {
2484 pub source: String,
2486 #[serde(default)]
2488 pub source_quoted: bool,
2489 pub target: Expression,
2491 #[serde(default)]
2493 pub params: Vec<CopyParameter>,
2494}
2495
2496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2498#[cfg_attr(feature = "bindings", derive(TS))]
2499pub struct StageReference {
2500 pub name: String,
2502 #[serde(default)]
2504 pub path: Option<String>,
2505 #[serde(default)]
2507 pub file_format: Option<Expression>,
2508 #[serde(default)]
2510 pub pattern: Option<String>,
2511 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2513 pub quoted: bool,
2514}
2515
2516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2518#[cfg_attr(feature = "bindings", derive(TS))]
2519pub struct HistoricalData {
2520 pub this: Box<Expression>,
2522 pub kind: String,
2524 pub expression: Box<Expression>,
2526}
2527
2528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2533#[cfg_attr(feature = "bindings", derive(TS))]
2534pub struct Alias {
2535 pub this: Expression,
2537 pub alias: Identifier,
2539 #[serde(default)]
2541 pub column_aliases: Vec<Identifier>,
2542 #[serde(default)]
2544 pub pre_alias_comments: Vec<String>,
2545 #[serde(default)]
2547 pub trailing_comments: Vec<String>,
2548}
2549
2550impl Alias {
2551 pub fn new(this: Expression, alias: Identifier) -> Self {
2553 Self {
2554 this,
2555 alias,
2556 column_aliases: Vec::new(),
2557 pre_alias_comments: Vec::new(),
2558 trailing_comments: Vec::new(),
2559 }
2560 }
2561
2562 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
2564 Self {
2565 this,
2566 alias: Identifier::empty(),
2567 column_aliases,
2568 pre_alias_comments: Vec::new(),
2569 trailing_comments: Vec::new(),
2570 }
2571 }
2572}
2573
2574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2581#[cfg_attr(feature = "bindings", derive(TS))]
2582pub struct Cast {
2583 pub this: Expression,
2585 pub to: DataType,
2587 #[serde(default)]
2588 pub trailing_comments: Vec<String>,
2589 #[serde(default)]
2591 pub double_colon_syntax: bool,
2592 #[serde(skip_serializing_if = "Option::is_none", default)]
2594 pub format: Option<Box<Expression>>,
2595 #[serde(skip_serializing_if = "Option::is_none", default)]
2597 pub default: Option<Box<Expression>>,
2598}
2599
2600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2602#[cfg_attr(feature = "bindings", derive(TS))]
2603pub struct CollationExpr {
2604 pub this: Expression,
2605 pub collation: String,
2606 #[serde(default)]
2608 pub quoted: bool,
2609 #[serde(default)]
2611 pub double_quoted: bool,
2612}
2613
2614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2620#[cfg_attr(feature = "bindings", derive(TS))]
2621pub struct Case {
2622 pub operand: Option<Expression>,
2624 pub whens: Vec<(Expression, Expression)>,
2626 pub else_: Option<Expression>,
2628 #[serde(default)]
2630 #[serde(skip_serializing_if = "Vec::is_empty")]
2631 pub comments: Vec<String>,
2632}
2633
2634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2642#[cfg_attr(feature = "bindings", derive(TS))]
2643pub struct BinaryOp {
2644 pub left: Expression,
2645 pub right: Expression,
2646 #[serde(default)]
2648 pub left_comments: Vec<String>,
2649 #[serde(default)]
2651 pub operator_comments: Vec<String>,
2652 #[serde(default)]
2654 pub trailing_comments: Vec<String>,
2655}
2656
2657impl BinaryOp {
2658 pub fn new(left: Expression, right: Expression) -> Self {
2659 Self {
2660 left,
2661 right,
2662 left_comments: Vec::new(),
2663 operator_comments: Vec::new(),
2664 trailing_comments: Vec::new(),
2665 }
2666 }
2667}
2668
2669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2671#[cfg_attr(feature = "bindings", derive(TS))]
2672pub struct LikeOp {
2673 pub left: Expression,
2674 pub right: Expression,
2675 #[serde(default)]
2677 pub escape: Option<Expression>,
2678 #[serde(default)]
2680 pub quantifier: Option<String>,
2681}
2682
2683impl LikeOp {
2684 pub fn new(left: Expression, right: Expression) -> Self {
2685 Self {
2686 left,
2687 right,
2688 escape: None,
2689 quantifier: None,
2690 }
2691 }
2692
2693 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
2694 Self {
2695 left,
2696 right,
2697 escape: Some(escape),
2698 quantifier: None,
2699 }
2700 }
2701}
2702
2703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2707#[cfg_attr(feature = "bindings", derive(TS))]
2708pub struct UnaryOp {
2709 pub this: Expression,
2711}
2712
2713impl UnaryOp {
2714 pub fn new(this: Expression) -> Self {
2715 Self { this }
2716 }
2717}
2718
2719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2724#[cfg_attr(feature = "bindings", derive(TS))]
2725pub struct In {
2726 pub this: Expression,
2728 pub expressions: Vec<Expression>,
2730 pub query: Option<Expression>,
2732 pub not: bool,
2734 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2735 pub global: bool,
2736 #[serde(default, skip_serializing_if = "Option::is_none")]
2738 pub unnest: Option<Box<Expression>>,
2739 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2743 pub is_field: bool,
2744}
2745
2746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2748#[cfg_attr(feature = "bindings", derive(TS))]
2749pub struct Between {
2750 pub this: Expression,
2752 pub low: Expression,
2754 pub high: Expression,
2756 pub not: bool,
2758 #[serde(default)]
2760 pub symmetric: Option<bool>,
2761}
2762
2763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2765#[cfg_attr(feature = "bindings", derive(TS))]
2766pub struct IsNull {
2767 pub this: Expression,
2768 pub not: bool,
2769 #[serde(default)]
2771 pub postfix_form: bool,
2772}
2773
2774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2776#[cfg_attr(feature = "bindings", derive(TS))]
2777pub struct IsTrueFalse {
2778 pub this: Expression,
2779 pub not: bool,
2780}
2781
2782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2785#[cfg_attr(feature = "bindings", derive(TS))]
2786pub struct IsJson {
2787 pub this: Expression,
2788 pub json_type: Option<String>,
2790 pub unique_keys: Option<JsonUniqueKeys>,
2792 pub negated: bool,
2794}
2795
2796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2798#[cfg_attr(feature = "bindings", derive(TS))]
2799pub enum JsonUniqueKeys {
2800 With,
2802 Without,
2804 Shorthand,
2806}
2807
2808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2810#[cfg_attr(feature = "bindings", derive(TS))]
2811pub struct Exists {
2812 pub this: Expression,
2814 pub not: bool,
2816}
2817
2818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2825#[cfg_attr(feature = "bindings", derive(TS))]
2826pub struct Function {
2827 pub name: String,
2829 pub args: Vec<Expression>,
2831 pub distinct: bool,
2833 #[serde(default)]
2834 pub trailing_comments: Vec<String>,
2835 #[serde(default)]
2837 pub use_bracket_syntax: bool,
2838 #[serde(default)]
2840 pub no_parens: bool,
2841 #[serde(default)]
2843 pub quoted: bool,
2844}
2845
2846impl Default for Function {
2847 fn default() -> Self {
2848 Self {
2849 name: String::new(),
2850 args: Vec::new(),
2851 distinct: false,
2852 trailing_comments: Vec::new(),
2853 use_bracket_syntax: false,
2854 no_parens: false,
2855 quoted: false,
2856 }
2857 }
2858}
2859
2860impl Function {
2861 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
2862 Self {
2863 name: name.into(),
2864 args,
2865 distinct: false,
2866 trailing_comments: Vec::new(),
2867 use_bracket_syntax: false,
2868 no_parens: false,
2869 quoted: false,
2870 }
2871 }
2872}
2873
2874#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
2881#[cfg_attr(feature = "bindings", derive(TS))]
2882pub struct AggregateFunction {
2883 pub name: String,
2885 pub args: Vec<Expression>,
2887 pub distinct: bool,
2889 pub filter: Option<Expression>,
2891 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2893 pub order_by: Vec<Ordered>,
2894 #[serde(default, skip_serializing_if = "Option::is_none")]
2896 pub limit: Option<Box<Expression>>,
2897 #[serde(default, skip_serializing_if = "Option::is_none")]
2899 pub ignore_nulls: Option<bool>,
2900}
2901
2902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2909#[cfg_attr(feature = "bindings", derive(TS))]
2910pub struct WindowFunction {
2911 pub this: Expression,
2913 pub over: Over,
2915 #[serde(default, skip_serializing_if = "Option::is_none")]
2917 pub keep: Option<Keep>,
2918}
2919
2920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2923#[cfg_attr(feature = "bindings", derive(TS))]
2924pub struct Keep {
2925 pub first: bool,
2927 pub order_by: Vec<Ordered>,
2929}
2930
2931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2933#[cfg_attr(feature = "bindings", derive(TS))]
2934pub struct WithinGroup {
2935 pub this: Expression,
2937 pub order_by: Vec<Ordered>,
2939}
2940
2941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2946#[cfg_attr(feature = "bindings", derive(TS))]
2947pub struct From {
2948 pub expressions: Vec<Expression>,
2950}
2951
2952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2958#[cfg_attr(feature = "bindings", derive(TS))]
2959pub struct Join {
2960 pub this: Expression,
2962 pub on: Option<Expression>,
2964 pub using: Vec<Identifier>,
2966 pub kind: JoinKind,
2968 pub use_inner_keyword: bool,
2970 pub use_outer_keyword: bool,
2972 pub deferred_condition: bool,
2974 #[serde(default, skip_serializing_if = "Option::is_none")]
2976 pub join_hint: Option<String>,
2977 #[serde(default, skip_serializing_if = "Option::is_none")]
2979 pub match_condition: Option<Expression>,
2980 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2982 pub pivots: Vec<Expression>,
2983 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2985 pub comments: Vec<String>,
2986 #[serde(default)]
2990 pub nesting_group: usize,
2991 #[serde(default)]
2993 pub directed: bool,
2994}
2995
2996#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3003#[cfg_attr(feature = "bindings", derive(TS))]
3004pub enum JoinKind {
3005 Inner,
3006 Left,
3007 Right,
3008 Full,
3009 Outer, Cross,
3011 Natural,
3012 NaturalLeft,
3013 NaturalRight,
3014 NaturalFull,
3015 Semi,
3016 Anti,
3017 LeftSemi,
3019 LeftAnti,
3020 RightSemi,
3021 RightAnti,
3022 CrossApply,
3024 OuterApply,
3025 AsOf,
3027 AsOfLeft,
3028 AsOfRight,
3029 Lateral,
3031 LeftLateral,
3032 Straight,
3034 Implicit,
3036 Array,
3038 LeftArray,
3039 Paste,
3041}
3042
3043impl Default for JoinKind {
3044 fn default() -> Self {
3045 JoinKind::Inner
3046 }
3047}
3048
3049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3052#[cfg_attr(feature = "bindings", derive(TS))]
3053pub struct JoinedTable {
3054 pub left: Expression,
3056 pub joins: Vec<Join>,
3058 pub lateral_views: Vec<LateralView>,
3060 pub alias: Option<Identifier>,
3062}
3063
3064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3066#[cfg_attr(feature = "bindings", derive(TS))]
3067pub struct Where {
3068 pub this: Expression,
3070}
3071
3072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3077#[cfg_attr(feature = "bindings", derive(TS))]
3078pub struct GroupBy {
3079 pub expressions: Vec<Expression>,
3081 #[serde(default)]
3083 pub all: Option<bool>,
3084 #[serde(default)]
3086 pub totals: bool,
3087 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3089 pub comments: Vec<String>,
3090}
3091
3092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3094#[cfg_attr(feature = "bindings", derive(TS))]
3095pub struct Having {
3096 pub this: Expression,
3098 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3100 pub comments: Vec<String>,
3101}
3102
3103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3105#[cfg_attr(feature = "bindings", derive(TS))]
3106pub struct OrderBy {
3107 pub expressions: Vec<Ordered>,
3109 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3111 pub siblings: bool,
3112 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3114 pub comments: Vec<String>,
3115}
3116
3117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3124#[cfg_attr(feature = "bindings", derive(TS))]
3125pub struct Ordered {
3126 pub this: Expression,
3128 pub desc: bool,
3130 pub nulls_first: Option<bool>,
3132 #[serde(default)]
3134 pub explicit_asc: bool,
3135 #[serde(default, skip_serializing_if = "Option::is_none")]
3137 pub with_fill: Option<Box<WithFill>>,
3138}
3139
3140impl Ordered {
3141 pub fn asc(expr: Expression) -> Self {
3142 Self {
3143 this: expr,
3144 desc: false,
3145 nulls_first: None,
3146 explicit_asc: false,
3147 with_fill: None,
3148 }
3149 }
3150
3151 pub fn desc(expr: Expression) -> Self {
3152 Self {
3153 this: expr,
3154 desc: true,
3155 nulls_first: None,
3156 explicit_asc: false,
3157 with_fill: None,
3158 }
3159 }
3160}
3161
3162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3165#[cfg_attr(feature = "bindings", derive(TS))]
3166#[cfg_attr(feature = "bindings", ts(export))]
3167pub struct DistributeBy {
3168 pub expressions: Vec<Expression>,
3169}
3170
3171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3174#[cfg_attr(feature = "bindings", derive(TS))]
3175#[cfg_attr(feature = "bindings", ts(export))]
3176pub struct ClusterBy {
3177 pub expressions: Vec<Ordered>,
3178}
3179
3180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3183#[cfg_attr(feature = "bindings", derive(TS))]
3184#[cfg_attr(feature = "bindings", ts(export))]
3185pub struct SortBy {
3186 pub expressions: Vec<Ordered>,
3187}
3188
3189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3192#[cfg_attr(feature = "bindings", derive(TS))]
3193#[cfg_attr(feature = "bindings", ts(export))]
3194pub struct LateralView {
3195 pub this: Expression,
3197 pub table_alias: Option<Identifier>,
3199 pub column_aliases: Vec<Identifier>,
3201 pub outer: bool,
3203}
3204
3205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3207#[cfg_attr(feature = "bindings", derive(TS))]
3208#[cfg_attr(feature = "bindings", ts(export))]
3209pub struct Hint {
3210 pub expressions: Vec<HintExpression>,
3211}
3212
3213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3215#[cfg_attr(feature = "bindings", derive(TS))]
3216#[cfg_attr(feature = "bindings", ts(export))]
3217pub enum HintExpression {
3218 Function { name: String, args: Vec<Expression> },
3220 Identifier(String),
3222 Raw(String),
3224}
3225
3226#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3228#[cfg_attr(feature = "bindings", derive(TS))]
3229#[cfg_attr(feature = "bindings", ts(export))]
3230pub enum PseudocolumnType {
3231 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
3238
3239impl PseudocolumnType {
3240 pub fn as_str(&self) -> &'static str {
3241 match self {
3242 PseudocolumnType::Rownum => "ROWNUM",
3243 PseudocolumnType::Rowid => "ROWID",
3244 PseudocolumnType::Level => "LEVEL",
3245 PseudocolumnType::Sysdate => "SYSDATE",
3246 PseudocolumnType::ObjectId => "OBJECT_ID",
3247 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
3248 }
3249 }
3250
3251 pub fn from_str(s: &str) -> Option<Self> {
3252 match s.to_uppercase().as_str() {
3253 "ROWNUM" => Some(PseudocolumnType::Rownum),
3254 "ROWID" => Some(PseudocolumnType::Rowid),
3255 "LEVEL" => Some(PseudocolumnType::Level),
3256 "SYSDATE" => Some(PseudocolumnType::Sysdate),
3257 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
3258 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
3259 _ => None,
3260 }
3261 }
3262}
3263
3264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3267#[cfg_attr(feature = "bindings", derive(TS))]
3268#[cfg_attr(feature = "bindings", ts(export))]
3269pub struct Pseudocolumn {
3270 pub kind: PseudocolumnType,
3271}
3272
3273impl Pseudocolumn {
3274 pub fn rownum() -> Self {
3275 Self {
3276 kind: PseudocolumnType::Rownum,
3277 }
3278 }
3279
3280 pub fn rowid() -> Self {
3281 Self {
3282 kind: PseudocolumnType::Rowid,
3283 }
3284 }
3285
3286 pub fn level() -> Self {
3287 Self {
3288 kind: PseudocolumnType::Level,
3289 }
3290 }
3291}
3292
3293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3295#[cfg_attr(feature = "bindings", derive(TS))]
3296#[cfg_attr(feature = "bindings", ts(export))]
3297pub struct Connect {
3298 pub start: Option<Expression>,
3300 pub connect: Expression,
3302 pub nocycle: bool,
3304}
3305
3306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3308#[cfg_attr(feature = "bindings", derive(TS))]
3309#[cfg_attr(feature = "bindings", ts(export))]
3310pub struct Prior {
3311 pub this: Expression,
3312}
3313
3314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3316#[cfg_attr(feature = "bindings", derive(TS))]
3317#[cfg_attr(feature = "bindings", ts(export))]
3318pub struct ConnectByRoot {
3319 pub this: Expression,
3320}
3321
3322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3324#[cfg_attr(feature = "bindings", derive(TS))]
3325#[cfg_attr(feature = "bindings", ts(export))]
3326pub struct MatchRecognize {
3327 pub this: Option<Box<Expression>>,
3329 pub partition_by: Option<Vec<Expression>>,
3331 pub order_by: Option<Vec<Ordered>>,
3333 pub measures: Option<Vec<MatchRecognizeMeasure>>,
3335 pub rows: Option<MatchRecognizeRows>,
3337 pub after: Option<MatchRecognizeAfter>,
3339 pub pattern: Option<String>,
3341 pub define: Option<Vec<(Identifier, Expression)>>,
3343 pub alias: Option<Identifier>,
3345 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3347 pub alias_explicit_as: bool,
3348}
3349
3350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3352#[cfg_attr(feature = "bindings", derive(TS))]
3353#[cfg_attr(feature = "bindings", ts(export))]
3354pub struct MatchRecognizeMeasure {
3355 pub this: Expression,
3357 pub window_frame: Option<MatchRecognizeSemantics>,
3359}
3360
3361#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3363#[cfg_attr(feature = "bindings", derive(TS))]
3364#[cfg_attr(feature = "bindings", ts(export))]
3365pub enum MatchRecognizeSemantics {
3366 Running,
3367 Final,
3368}
3369
3370#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3372#[cfg_attr(feature = "bindings", derive(TS))]
3373#[cfg_attr(feature = "bindings", ts(export))]
3374pub enum MatchRecognizeRows {
3375 OneRowPerMatch,
3376 AllRowsPerMatch,
3377 AllRowsPerMatchShowEmptyMatches,
3378 AllRowsPerMatchOmitEmptyMatches,
3379 AllRowsPerMatchWithUnmatchedRows,
3380}
3381
3382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3384#[cfg_attr(feature = "bindings", derive(TS))]
3385#[cfg_attr(feature = "bindings", ts(export))]
3386pub enum MatchRecognizeAfter {
3387 PastLastRow,
3388 ToNextRow,
3389 ToFirst(Identifier),
3390 ToLast(Identifier),
3391}
3392
3393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3395#[cfg_attr(feature = "bindings", derive(TS))]
3396pub struct Limit {
3397 pub this: Expression,
3399 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3401 pub percent: bool,
3402 #[serde(default)]
3404 #[serde(skip_serializing_if = "Vec::is_empty")]
3405 pub comments: Vec<String>,
3406}
3407
3408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3410#[cfg_attr(feature = "bindings", derive(TS))]
3411pub struct Offset {
3412 pub this: Expression,
3413 #[serde(skip_serializing_if = "Option::is_none", default)]
3415 pub rows: Option<bool>,
3416}
3417
3418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3420#[cfg_attr(feature = "bindings", derive(TS))]
3421pub struct Top {
3422 pub this: Expression,
3423 pub percent: bool,
3424 pub with_ties: bool,
3425 #[serde(default)]
3427 pub parenthesized: bool,
3428}
3429
3430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3432#[cfg_attr(feature = "bindings", derive(TS))]
3433pub struct Fetch {
3434 pub direction: String,
3436 pub count: Option<Expression>,
3438 pub percent: bool,
3440 pub rows: bool,
3442 pub with_ties: bool,
3444}
3445
3446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3452#[cfg_attr(feature = "bindings", derive(TS))]
3453pub struct Qualify {
3454 pub this: Expression,
3456}
3457
3458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3460#[cfg_attr(feature = "bindings", derive(TS))]
3461pub struct Sample {
3462 pub method: SampleMethod,
3463 pub size: Expression,
3464 pub seed: Option<Expression>,
3465 #[serde(default)]
3467 pub offset: Option<Expression>,
3468 pub unit_after_size: bool,
3470 #[serde(default)]
3472 pub use_sample_keyword: bool,
3473 #[serde(default)]
3475 pub explicit_method: bool,
3476 #[serde(default)]
3478 pub method_before_size: bool,
3479 #[serde(default)]
3481 pub use_seed_keyword: bool,
3482 pub bucket_numerator: Option<Box<Expression>>,
3484 pub bucket_denominator: Option<Box<Expression>>,
3486 pub bucket_field: Option<Box<Expression>>,
3488 #[serde(default)]
3490 pub is_using_sample: bool,
3491 #[serde(default)]
3493 pub is_percent: bool,
3494 #[serde(default)]
3496 pub suppress_method_output: bool,
3497}
3498
3499#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3501#[cfg_attr(feature = "bindings", derive(TS))]
3502pub enum SampleMethod {
3503 Bernoulli,
3504 System,
3505 Block,
3506 Row,
3507 Percent,
3508 Bucket,
3510 Reservoir,
3512}
3513
3514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3516#[cfg_attr(feature = "bindings", derive(TS))]
3517pub struct NamedWindow {
3518 pub name: Identifier,
3519 pub spec: Over,
3520}
3521
3522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3528#[cfg_attr(feature = "bindings", derive(TS))]
3529pub struct With {
3530 pub ctes: Vec<Cte>,
3532 pub recursive: bool,
3534 #[serde(default)]
3536 pub leading_comments: Vec<String>,
3537 #[serde(default, skip_serializing_if = "Option::is_none")]
3539 pub search: Option<Box<Expression>>,
3540}
3541
3542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3549#[cfg_attr(feature = "bindings", derive(TS))]
3550pub struct Cte {
3551 pub alias: Identifier,
3553 pub this: Expression,
3555 pub columns: Vec<Identifier>,
3557 pub materialized: Option<bool>,
3559 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3561 pub key_expressions: Vec<Identifier>,
3562 #[serde(default)]
3564 pub alias_first: bool,
3565 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3567 pub comments: Vec<String>,
3568}
3569
3570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3572#[cfg_attr(feature = "bindings", derive(TS))]
3573pub struct WindowSpec {
3574 pub partition_by: Vec<Expression>,
3575 pub order_by: Vec<Ordered>,
3576 pub frame: Option<WindowFrame>,
3577}
3578
3579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3581#[cfg_attr(feature = "bindings", derive(TS))]
3582pub struct Over {
3583 pub window_name: Option<Identifier>,
3585 pub partition_by: Vec<Expression>,
3586 pub order_by: Vec<Ordered>,
3587 pub frame: Option<WindowFrame>,
3588 pub alias: Option<Identifier>,
3589}
3590
3591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3593#[cfg_attr(feature = "bindings", derive(TS))]
3594pub struct WindowFrame {
3595 pub kind: WindowFrameKind,
3596 pub start: WindowFrameBound,
3597 pub end: Option<WindowFrameBound>,
3598 pub exclude: Option<WindowFrameExclude>,
3599 #[serde(default, skip_serializing_if = "Option::is_none")]
3601 pub kind_text: Option<String>,
3602 #[serde(default, skip_serializing_if = "Option::is_none")]
3604 pub start_side_text: Option<String>,
3605 #[serde(default, skip_serializing_if = "Option::is_none")]
3607 pub end_side_text: Option<String>,
3608}
3609
3610#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3611#[cfg_attr(feature = "bindings", derive(TS))]
3612pub enum WindowFrameKind {
3613 Rows,
3614 Range,
3615 Groups,
3616}
3617
3618#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3620#[cfg_attr(feature = "bindings", derive(TS))]
3621pub enum WindowFrameExclude {
3622 CurrentRow,
3623 Group,
3624 Ties,
3625 NoOthers,
3626}
3627
3628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3629#[cfg_attr(feature = "bindings", derive(TS))]
3630pub enum WindowFrameBound {
3631 CurrentRow,
3632 UnboundedPreceding,
3633 UnboundedFollowing,
3634 Preceding(Box<Expression>),
3635 Following(Box<Expression>),
3636 BarePreceding,
3638 BareFollowing,
3640 Value(Box<Expression>),
3642}
3643
3644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3646#[cfg_attr(feature = "bindings", derive(TS))]
3647pub struct StructField {
3648 pub name: String,
3649 pub data_type: DataType,
3650 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3651 pub options: Vec<Expression>,
3652 #[serde(default, skip_serializing_if = "Option::is_none")]
3653 pub comment: Option<String>,
3654}
3655
3656impl StructField {
3657 pub fn new(name: String, data_type: DataType) -> Self {
3659 Self {
3660 name,
3661 data_type,
3662 options: Vec::new(),
3663 comment: None,
3664 }
3665 }
3666
3667 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
3669 Self {
3670 name,
3671 data_type,
3672 options,
3673 comment: None,
3674 }
3675 }
3676
3677 pub fn with_options_and_comment(
3679 name: String,
3680 data_type: DataType,
3681 options: Vec<Expression>,
3682 comment: Option<String>,
3683 ) -> Self {
3684 Self {
3685 name,
3686 data_type,
3687 options,
3688 comment,
3689 }
3690 }
3691}
3692
3693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3705#[cfg_attr(feature = "bindings", derive(TS))]
3706#[serde(tag = "data_type", rename_all = "snake_case")]
3707pub enum DataType {
3708 Boolean,
3710 TinyInt {
3711 length: Option<u32>,
3712 },
3713 SmallInt {
3714 length: Option<u32>,
3715 },
3716 Int {
3720 length: Option<u32>,
3721 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3722 integer_spelling: bool,
3723 },
3724 BigInt {
3725 length: Option<u32>,
3726 },
3727 Float {
3731 precision: Option<u32>,
3732 scale: Option<u32>,
3733 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3734 real_spelling: bool,
3735 },
3736 Double {
3737 precision: Option<u32>,
3738 scale: Option<u32>,
3739 },
3740 Decimal {
3741 precision: Option<u32>,
3742 scale: Option<u32>,
3743 },
3744
3745 Char {
3747 length: Option<u32>,
3748 },
3749 VarChar {
3752 length: Option<u32>,
3753 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3754 parenthesized_length: bool,
3755 },
3756 String {
3758 length: Option<u32>,
3759 },
3760 Text,
3761 TextWithLength {
3763 length: u32,
3764 },
3765
3766 Binary {
3768 length: Option<u32>,
3769 },
3770 VarBinary {
3771 length: Option<u32>,
3772 },
3773 Blob,
3774
3775 Bit {
3777 length: Option<u32>,
3778 },
3779 VarBit {
3780 length: Option<u32>,
3781 },
3782
3783 Date,
3785 Time {
3786 precision: Option<u32>,
3787 #[serde(default)]
3788 timezone: bool,
3789 },
3790 Timestamp {
3791 precision: Option<u32>,
3792 timezone: bool,
3793 },
3794 Interval {
3795 unit: Option<String>,
3796 #[serde(default, skip_serializing_if = "Option::is_none")]
3798 to: Option<String>,
3799 },
3800
3801 Json,
3803 JsonB,
3804
3805 Uuid,
3807
3808 Array {
3810 element_type: Box<DataType>,
3811 #[serde(default, skip_serializing_if = "Option::is_none")]
3813 dimension: Option<u32>,
3814 },
3815
3816 List {
3819 element_type: Box<DataType>,
3820 },
3821
3822 Struct {
3826 fields: Vec<StructField>,
3827 nested: bool,
3828 },
3829 Map {
3830 key_type: Box<DataType>,
3831 value_type: Box<DataType>,
3832 },
3833
3834 Enum {
3836 values: Vec<String>,
3837 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3838 assignments: Vec<Option<String>>,
3839 },
3840
3841 Set {
3843 values: Vec<String>,
3844 },
3845
3846 Union {
3848 fields: Vec<(String, DataType)>,
3849 },
3850
3851 Vector {
3853 #[serde(default)]
3854 element_type: Option<Box<DataType>>,
3855 dimension: Option<u32>,
3856 },
3857
3858 Object {
3861 fields: Vec<(String, DataType, bool)>,
3862 modifier: Option<String>,
3863 },
3864
3865 Nullable {
3867 inner: Box<DataType>,
3868 },
3869
3870 Custom {
3872 name: String,
3873 },
3874
3875 Geometry {
3877 subtype: Option<String>,
3878 srid: Option<u32>,
3879 },
3880 Geography {
3881 subtype: Option<String>,
3882 srid: Option<u32>,
3883 },
3884
3885 CharacterSet {
3888 name: String,
3889 },
3890
3891 Unknown,
3893}
3894
3895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3897#[cfg_attr(feature = "bindings", derive(TS))]
3898#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
3899pub struct Array {
3900 pub expressions: Vec<Expression>,
3901}
3902
3903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3905#[cfg_attr(feature = "bindings", derive(TS))]
3906pub struct Struct {
3907 pub fields: Vec<(Option<String>, Expression)>,
3908}
3909
3910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3912#[cfg_attr(feature = "bindings", derive(TS))]
3913pub struct Tuple {
3914 pub expressions: Vec<Expression>,
3915}
3916
3917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3919#[cfg_attr(feature = "bindings", derive(TS))]
3920pub struct Interval {
3921 pub this: Option<Expression>,
3923 pub unit: Option<IntervalUnitSpec>,
3925}
3926
3927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3929#[cfg_attr(feature = "bindings", derive(TS))]
3930#[serde(tag = "type", rename_all = "snake_case")]
3931pub enum IntervalUnitSpec {
3932 Simple {
3934 unit: IntervalUnit,
3935 use_plural: bool,
3937 },
3938 Span(IntervalSpan),
3940 ExprSpan(IntervalSpanExpr),
3943 Expr(Box<Expression>),
3945}
3946
3947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3949#[cfg_attr(feature = "bindings", derive(TS))]
3950pub struct IntervalSpan {
3951 pub this: IntervalUnit,
3953 pub expression: IntervalUnit,
3955}
3956
3957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3960#[cfg_attr(feature = "bindings", derive(TS))]
3961pub struct IntervalSpanExpr {
3962 pub this: Box<Expression>,
3964 pub expression: Box<Expression>,
3966}
3967
3968#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3969#[cfg_attr(feature = "bindings", derive(TS))]
3970pub enum IntervalUnit {
3971 Year,
3972 Quarter,
3973 Month,
3974 Week,
3975 Day,
3976 Hour,
3977 Minute,
3978 Second,
3979 Millisecond,
3980 Microsecond,
3981 Nanosecond,
3982}
3983
3984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3986#[cfg_attr(feature = "bindings", derive(TS))]
3987pub struct Command {
3988 pub this: String,
3990}
3991
3992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3995#[cfg_attr(feature = "bindings", derive(TS))]
3996pub struct ExecuteStatement {
3997 pub this: Expression,
3999 #[serde(default)]
4001 pub parameters: Vec<ExecuteParameter>,
4002}
4003
4004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4006#[cfg_attr(feature = "bindings", derive(TS))]
4007pub struct ExecuteParameter {
4008 pub name: String,
4010 pub value: Expression,
4012}
4013
4014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4017#[cfg_attr(feature = "bindings", derive(TS))]
4018pub struct Kill {
4019 pub this: Expression,
4021 pub kind: Option<String>,
4023}
4024
4025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4027#[cfg_attr(feature = "bindings", derive(TS))]
4028pub struct Raw {
4029 pub sql: String,
4030}
4031
4032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4038#[cfg_attr(feature = "bindings", derive(TS))]
4039pub struct UnaryFunc {
4040 pub this: Expression,
4041 #[serde(skip_serializing_if = "Option::is_none", default)]
4043 pub original_name: Option<String>,
4044}
4045
4046impl UnaryFunc {
4047 pub fn new(this: Expression) -> Self {
4049 Self {
4050 this,
4051 original_name: None,
4052 }
4053 }
4054
4055 pub fn with_name(this: Expression, name: String) -> Self {
4057 Self {
4058 this,
4059 original_name: Some(name),
4060 }
4061 }
4062}
4063
4064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4068#[cfg_attr(feature = "bindings", derive(TS))]
4069pub struct CharFunc {
4070 pub args: Vec<Expression>,
4071 #[serde(skip_serializing_if = "Option::is_none", default)]
4072 pub charset: Option<String>,
4073 #[serde(skip_serializing_if = "Option::is_none", default)]
4075 pub name: Option<String>,
4076}
4077
4078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4080#[cfg_attr(feature = "bindings", derive(TS))]
4081pub struct BinaryFunc {
4082 pub this: Expression,
4083 pub expression: Expression,
4084 #[serde(skip_serializing_if = "Option::is_none", default)]
4086 pub original_name: Option<String>,
4087}
4088
4089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4091#[cfg_attr(feature = "bindings", derive(TS))]
4092pub struct VarArgFunc {
4093 pub expressions: Vec<Expression>,
4094 #[serde(skip_serializing_if = "Option::is_none", default)]
4096 pub original_name: Option<String>,
4097}
4098
4099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4101#[cfg_attr(feature = "bindings", derive(TS))]
4102pub struct ConcatWs {
4103 pub separator: Expression,
4104 pub expressions: Vec<Expression>,
4105}
4106
4107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4109#[cfg_attr(feature = "bindings", derive(TS))]
4110pub struct SubstringFunc {
4111 pub this: Expression,
4112 pub start: Expression,
4113 pub length: Option<Expression>,
4114 #[serde(default)]
4116 pub from_for_syntax: bool,
4117}
4118
4119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4121#[cfg_attr(feature = "bindings", derive(TS))]
4122pub struct OverlayFunc {
4123 pub this: Expression,
4124 pub replacement: Expression,
4125 pub from: Expression,
4126 pub length: Option<Expression>,
4127}
4128
4129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4131#[cfg_attr(feature = "bindings", derive(TS))]
4132pub struct TrimFunc {
4133 pub this: Expression,
4134 pub characters: Option<Expression>,
4135 pub position: TrimPosition,
4136 #[serde(default)]
4138 pub sql_standard_syntax: bool,
4139 #[serde(default)]
4141 pub position_explicit: bool,
4142}
4143
4144#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4145#[cfg_attr(feature = "bindings", derive(TS))]
4146pub enum TrimPosition {
4147 Both,
4148 Leading,
4149 Trailing,
4150}
4151
4152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4154#[cfg_attr(feature = "bindings", derive(TS))]
4155pub struct ReplaceFunc {
4156 pub this: Expression,
4157 pub old: Expression,
4158 pub new: Expression,
4159}
4160
4161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4163#[cfg_attr(feature = "bindings", derive(TS))]
4164pub struct LeftRightFunc {
4165 pub this: Expression,
4166 pub length: Expression,
4167}
4168
4169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4171#[cfg_attr(feature = "bindings", derive(TS))]
4172pub struct RepeatFunc {
4173 pub this: Expression,
4174 pub times: Expression,
4175}
4176
4177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4179#[cfg_attr(feature = "bindings", derive(TS))]
4180pub struct PadFunc {
4181 pub this: Expression,
4182 pub length: Expression,
4183 pub fill: Option<Expression>,
4184}
4185
4186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4188#[cfg_attr(feature = "bindings", derive(TS))]
4189pub struct SplitFunc {
4190 pub this: Expression,
4191 pub delimiter: Expression,
4192}
4193
4194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4196#[cfg_attr(feature = "bindings", derive(TS))]
4197pub struct RegexpFunc {
4198 pub this: Expression,
4199 pub pattern: Expression,
4200 pub flags: Option<Expression>,
4201}
4202
4203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4205#[cfg_attr(feature = "bindings", derive(TS))]
4206pub struct RegexpReplaceFunc {
4207 pub this: Expression,
4208 pub pattern: Expression,
4209 pub replacement: Expression,
4210 pub flags: Option<Expression>,
4211}
4212
4213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4215#[cfg_attr(feature = "bindings", derive(TS))]
4216pub struct RegexpExtractFunc {
4217 pub this: Expression,
4218 pub pattern: Expression,
4219 pub group: Option<Expression>,
4220}
4221
4222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4224#[cfg_attr(feature = "bindings", derive(TS))]
4225pub struct RoundFunc {
4226 pub this: Expression,
4227 pub decimals: Option<Expression>,
4228}
4229
4230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4232#[cfg_attr(feature = "bindings", derive(TS))]
4233pub struct FloorFunc {
4234 pub this: Expression,
4235 pub scale: Option<Expression>,
4236 #[serde(skip_serializing_if = "Option::is_none", default)]
4238 pub to: Option<Expression>,
4239}
4240
4241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4243#[cfg_attr(feature = "bindings", derive(TS))]
4244pub struct CeilFunc {
4245 pub this: Expression,
4246 #[serde(skip_serializing_if = "Option::is_none", default)]
4247 pub decimals: Option<Expression>,
4248 #[serde(skip_serializing_if = "Option::is_none", default)]
4250 pub to: Option<Expression>,
4251}
4252
4253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4255#[cfg_attr(feature = "bindings", derive(TS))]
4256pub struct LogFunc {
4257 pub this: Expression,
4258 pub base: Option<Expression>,
4259}
4260
4261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4263#[cfg_attr(feature = "bindings", derive(TS))]
4264pub struct CurrentDate;
4265
4266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4268#[cfg_attr(feature = "bindings", derive(TS))]
4269pub struct CurrentTime {
4270 pub precision: Option<u32>,
4271}
4272
4273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4275#[cfg_attr(feature = "bindings", derive(TS))]
4276pub struct CurrentTimestamp {
4277 pub precision: Option<u32>,
4278 #[serde(default)]
4280 pub sysdate: bool,
4281}
4282
4283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4285#[cfg_attr(feature = "bindings", derive(TS))]
4286pub struct CurrentTimestampLTZ {
4287 pub precision: Option<u32>,
4288}
4289
4290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4292#[cfg_attr(feature = "bindings", derive(TS))]
4293pub struct AtTimeZone {
4294 pub this: Expression,
4296 pub zone: Expression,
4298}
4299
4300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4302#[cfg_attr(feature = "bindings", derive(TS))]
4303pub struct DateAddFunc {
4304 pub this: Expression,
4305 pub interval: Expression,
4306 pub unit: IntervalUnit,
4307}
4308
4309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4311#[cfg_attr(feature = "bindings", derive(TS))]
4312pub struct DateDiffFunc {
4313 pub this: Expression,
4314 pub expression: Expression,
4315 pub unit: Option<IntervalUnit>,
4316}
4317
4318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4320#[cfg_attr(feature = "bindings", derive(TS))]
4321pub struct DateTruncFunc {
4322 pub this: Expression,
4323 pub unit: DateTimeField,
4324}
4325
4326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4328#[cfg_attr(feature = "bindings", derive(TS))]
4329pub struct ExtractFunc {
4330 pub this: Expression,
4331 pub field: DateTimeField,
4332}
4333
4334#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4335#[cfg_attr(feature = "bindings", derive(TS))]
4336pub enum DateTimeField {
4337 Year,
4338 Month,
4339 Day,
4340 Hour,
4341 Minute,
4342 Second,
4343 Millisecond,
4344 Microsecond,
4345 DayOfWeek,
4346 DayOfYear,
4347 Week,
4348 WeekWithModifier(String),
4350 Quarter,
4351 Epoch,
4352 Timezone,
4353 TimezoneHour,
4354 TimezoneMinute,
4355 Date,
4356 Time,
4357 Custom(String),
4359}
4360
4361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4363#[cfg_attr(feature = "bindings", derive(TS))]
4364pub struct ToDateFunc {
4365 pub this: Expression,
4366 pub format: Option<Expression>,
4367}
4368
4369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4371#[cfg_attr(feature = "bindings", derive(TS))]
4372pub struct ToTimestampFunc {
4373 pub this: Expression,
4374 pub format: Option<Expression>,
4375}
4376
4377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4379#[cfg_attr(feature = "bindings", derive(TS))]
4380pub struct IfFunc {
4381 pub condition: Expression,
4382 pub true_value: Expression,
4383 pub false_value: Option<Expression>,
4384 #[serde(skip_serializing_if = "Option::is_none", default)]
4386 pub original_name: Option<String>,
4387}
4388
4389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4391#[cfg_attr(feature = "bindings", derive(TS))]
4392pub struct Nvl2Func {
4393 pub this: Expression,
4394 pub true_value: Expression,
4395 pub false_value: Expression,
4396}
4397
4398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4404#[cfg_attr(feature = "bindings", derive(TS))]
4405pub struct AggFunc {
4406 pub this: Expression,
4407 pub distinct: bool,
4408 pub filter: Option<Expression>,
4409 pub order_by: Vec<Ordered>,
4410 #[serde(skip_serializing_if = "Option::is_none", default)]
4412 pub name: Option<String>,
4413 #[serde(skip_serializing_if = "Option::is_none", default)]
4415 pub ignore_nulls: Option<bool>,
4416 #[serde(skip_serializing_if = "Option::is_none", default)]
4419 pub having_max: Option<(Box<Expression>, bool)>,
4420 #[serde(skip_serializing_if = "Option::is_none", default)]
4422 pub limit: Option<Box<Expression>>,
4423}
4424
4425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4427#[cfg_attr(feature = "bindings", derive(TS))]
4428pub struct CountFunc {
4429 pub this: Option<Expression>,
4430 pub star: bool,
4431 pub distinct: bool,
4432 pub filter: Option<Expression>,
4433 #[serde(default, skip_serializing_if = "Option::is_none")]
4435 pub ignore_nulls: Option<bool>,
4436 #[serde(default, skip_serializing_if = "Option::is_none")]
4438 pub original_name: Option<String>,
4439}
4440
4441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4443#[cfg_attr(feature = "bindings", derive(TS))]
4444pub struct GroupConcatFunc {
4445 pub this: Expression,
4446 pub separator: Option<Expression>,
4447 pub order_by: Option<Vec<Ordered>>,
4448 pub distinct: bool,
4449 pub filter: Option<Expression>,
4450}
4451
4452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4454#[cfg_attr(feature = "bindings", derive(TS))]
4455pub struct StringAggFunc {
4456 pub this: Expression,
4457 #[serde(default)]
4458 pub separator: Option<Expression>,
4459 #[serde(default)]
4460 pub order_by: Option<Vec<Ordered>>,
4461 #[serde(default)]
4462 pub distinct: bool,
4463 #[serde(default)]
4464 pub filter: Option<Expression>,
4465 #[serde(default, skip_serializing_if = "Option::is_none")]
4467 pub limit: Option<Box<Expression>>,
4468}
4469
4470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4472#[cfg_attr(feature = "bindings", derive(TS))]
4473pub struct ListAggFunc {
4474 pub this: Expression,
4475 pub separator: Option<Expression>,
4476 pub on_overflow: Option<ListAggOverflow>,
4477 pub order_by: Option<Vec<Ordered>>,
4478 pub distinct: bool,
4479 pub filter: Option<Expression>,
4480}
4481
4482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4484#[cfg_attr(feature = "bindings", derive(TS))]
4485pub enum ListAggOverflow {
4486 Error,
4487 Truncate {
4488 filler: Option<Expression>,
4489 with_count: bool,
4490 },
4491}
4492
4493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4495#[cfg_attr(feature = "bindings", derive(TS))]
4496pub struct SumIfFunc {
4497 pub this: Expression,
4498 pub condition: Expression,
4499 pub filter: Option<Expression>,
4500}
4501
4502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4504#[cfg_attr(feature = "bindings", derive(TS))]
4505pub struct ApproxPercentileFunc {
4506 pub this: Expression,
4507 pub percentile: Expression,
4508 pub accuracy: Option<Expression>,
4509 pub filter: Option<Expression>,
4510}
4511
4512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4514#[cfg_attr(feature = "bindings", derive(TS))]
4515pub struct PercentileFunc {
4516 pub this: Expression,
4517 pub percentile: Expression,
4518 pub order_by: Option<Vec<Ordered>>,
4519 pub filter: Option<Expression>,
4520}
4521
4522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4528#[cfg_attr(feature = "bindings", derive(TS))]
4529pub struct RowNumber;
4530
4531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4533#[cfg_attr(feature = "bindings", derive(TS))]
4534pub struct Rank {
4535 #[serde(default, skip_serializing_if = "Option::is_none")]
4537 pub order_by: Option<Vec<Ordered>>,
4538 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4540 pub args: Vec<Expression>,
4541}
4542
4543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4545#[cfg_attr(feature = "bindings", derive(TS))]
4546pub struct DenseRank {
4547 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4549 pub args: Vec<Expression>,
4550}
4551
4552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4554#[cfg_attr(feature = "bindings", derive(TS))]
4555pub struct NTileFunc {
4556 #[serde(default, skip_serializing_if = "Option::is_none")]
4558 pub num_buckets: Option<Expression>,
4559 #[serde(default, skip_serializing_if = "Option::is_none")]
4561 pub order_by: Option<Vec<Ordered>>,
4562}
4563
4564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4566#[cfg_attr(feature = "bindings", derive(TS))]
4567pub struct LeadLagFunc {
4568 pub this: Expression,
4569 pub offset: Option<Expression>,
4570 pub default: Option<Expression>,
4571 pub ignore_nulls: bool,
4572}
4573
4574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4576#[cfg_attr(feature = "bindings", derive(TS))]
4577pub struct ValueFunc {
4578 pub this: Expression,
4579 #[serde(default, skip_serializing_if = "Option::is_none")]
4581 pub ignore_nulls: Option<bool>,
4582}
4583
4584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4586#[cfg_attr(feature = "bindings", derive(TS))]
4587pub struct NthValueFunc {
4588 pub this: Expression,
4589 pub offset: Expression,
4590 #[serde(default, skip_serializing_if = "Option::is_none")]
4592 pub ignore_nulls: Option<bool>,
4593 #[serde(default, skip_serializing_if = "Option::is_none")]
4596 pub from_first: Option<bool>,
4597}
4598
4599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4601#[cfg_attr(feature = "bindings", derive(TS))]
4602pub struct PercentRank {
4603 #[serde(default, skip_serializing_if = "Option::is_none")]
4605 pub order_by: Option<Vec<Ordered>>,
4606 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4608 pub args: Vec<Expression>,
4609}
4610
4611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4613#[cfg_attr(feature = "bindings", derive(TS))]
4614pub struct CumeDist {
4615 #[serde(default, skip_serializing_if = "Option::is_none")]
4617 pub order_by: Option<Vec<Ordered>>,
4618 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4620 pub args: Vec<Expression>,
4621}
4622
4623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4629#[cfg_attr(feature = "bindings", derive(TS))]
4630pub struct PositionFunc {
4631 pub substring: Expression,
4632 pub string: Expression,
4633 pub start: Option<Expression>,
4634}
4635
4636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4642#[cfg_attr(feature = "bindings", derive(TS))]
4643pub struct Random;
4644
4645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4647#[cfg_attr(feature = "bindings", derive(TS))]
4648pub struct Rand {
4649 pub seed: Option<Box<Expression>>,
4650 #[serde(default)]
4652 pub lower: Option<Box<Expression>>,
4653 #[serde(default)]
4655 pub upper: Option<Box<Expression>>,
4656}
4657
4658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4660#[cfg_attr(feature = "bindings", derive(TS))]
4661pub struct TruncateFunc {
4662 pub this: Expression,
4663 pub decimals: Option<Expression>,
4664}
4665
4666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4668#[cfg_attr(feature = "bindings", derive(TS))]
4669pub struct Pi;
4670
4671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4677#[cfg_attr(feature = "bindings", derive(TS))]
4678pub struct DecodeFunc {
4679 pub this: Expression,
4680 pub search_results: Vec<(Expression, Expression)>,
4681 pub default: Option<Expression>,
4682}
4683
4684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4690#[cfg_attr(feature = "bindings", derive(TS))]
4691pub struct DateFormatFunc {
4692 pub this: Expression,
4693 pub format: Expression,
4694}
4695
4696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4698#[cfg_attr(feature = "bindings", derive(TS))]
4699pub struct FromUnixtimeFunc {
4700 pub this: Expression,
4701 pub format: Option<Expression>,
4702}
4703
4704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4706#[cfg_attr(feature = "bindings", derive(TS))]
4707pub struct UnixTimestampFunc {
4708 pub this: Option<Expression>,
4709 pub format: Option<Expression>,
4710}
4711
4712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4714#[cfg_attr(feature = "bindings", derive(TS))]
4715pub struct MakeDateFunc {
4716 pub year: Expression,
4717 pub month: Expression,
4718 pub day: Expression,
4719}
4720
4721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4723#[cfg_attr(feature = "bindings", derive(TS))]
4724pub struct MakeTimestampFunc {
4725 pub year: Expression,
4726 pub month: Expression,
4727 pub day: Expression,
4728 pub hour: Expression,
4729 pub minute: Expression,
4730 pub second: Expression,
4731 pub timezone: Option<Expression>,
4732}
4733
4734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4736#[cfg_attr(feature = "bindings", derive(TS))]
4737pub struct LastDayFunc {
4738 pub this: Expression,
4739 #[serde(skip_serializing_if = "Option::is_none", default)]
4741 pub unit: Option<DateTimeField>,
4742}
4743
4744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4750#[cfg_attr(feature = "bindings", derive(TS))]
4751pub struct ArrayConstructor {
4752 pub expressions: Vec<Expression>,
4753 pub bracket_notation: bool,
4754 pub use_list_keyword: bool,
4756}
4757
4758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4760#[cfg_attr(feature = "bindings", derive(TS))]
4761pub struct ArraySortFunc {
4762 pub this: Expression,
4763 pub comparator: Option<Expression>,
4764 pub desc: bool,
4765 pub nulls_first: Option<bool>,
4766}
4767
4768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4770#[cfg_attr(feature = "bindings", derive(TS))]
4771pub struct ArrayJoinFunc {
4772 pub this: Expression,
4773 pub separator: Expression,
4774 pub null_replacement: Option<Expression>,
4775}
4776
4777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4779#[cfg_attr(feature = "bindings", derive(TS))]
4780pub struct UnnestFunc {
4781 pub this: Expression,
4782 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4784 pub expressions: Vec<Expression>,
4785 pub with_ordinality: bool,
4786 pub alias: Option<Identifier>,
4787 #[serde(default, skip_serializing_if = "Option::is_none")]
4789 pub offset_alias: Option<Identifier>,
4790}
4791
4792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4794#[cfg_attr(feature = "bindings", derive(TS))]
4795pub struct ArrayFilterFunc {
4796 pub this: Expression,
4797 pub filter: Expression,
4798}
4799
4800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4802#[cfg_attr(feature = "bindings", derive(TS))]
4803pub struct ArrayTransformFunc {
4804 pub this: Expression,
4805 pub transform: Expression,
4806}
4807
4808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4810#[cfg_attr(feature = "bindings", derive(TS))]
4811pub struct SequenceFunc {
4812 pub start: Expression,
4813 pub stop: Expression,
4814 pub step: Option<Expression>,
4815}
4816
4817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4823#[cfg_attr(feature = "bindings", derive(TS))]
4824pub struct StructConstructor {
4825 pub fields: Vec<(Option<Identifier>, Expression)>,
4826}
4827
4828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4830#[cfg_attr(feature = "bindings", derive(TS))]
4831pub struct StructExtractFunc {
4832 pub this: Expression,
4833 pub field: Identifier,
4834}
4835
4836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4838#[cfg_attr(feature = "bindings", derive(TS))]
4839pub struct NamedStructFunc {
4840 pub pairs: Vec<(Expression, Expression)>,
4841}
4842
4843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4849#[cfg_attr(feature = "bindings", derive(TS))]
4850pub struct MapConstructor {
4851 pub keys: Vec<Expression>,
4852 pub values: Vec<Expression>,
4853 #[serde(default)]
4855 pub curly_brace_syntax: bool,
4856 #[serde(default)]
4858 pub with_map_keyword: bool,
4859}
4860
4861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4863#[cfg_attr(feature = "bindings", derive(TS))]
4864pub struct TransformFunc {
4865 pub this: Expression,
4866 pub transform: Expression,
4867}
4868
4869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4875#[cfg_attr(feature = "bindings", derive(TS))]
4876pub struct JsonExtractFunc {
4877 pub this: Expression,
4878 pub path: Expression,
4879 pub returning: Option<DataType>,
4880 #[serde(default)]
4882 pub arrow_syntax: bool,
4883 #[serde(default)]
4885 pub hash_arrow_syntax: bool,
4886 #[serde(default)]
4888 pub wrapper_option: Option<String>,
4889 #[serde(default)]
4891 pub quotes_option: Option<String>,
4892 #[serde(default)]
4894 pub on_scalar_string: bool,
4895 #[serde(default)]
4897 pub on_error: Option<String>,
4898}
4899
4900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4902#[cfg_attr(feature = "bindings", derive(TS))]
4903pub struct JsonPathFunc {
4904 pub this: Expression,
4905 pub paths: Vec<Expression>,
4906}
4907
4908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4910#[cfg_attr(feature = "bindings", derive(TS))]
4911pub struct JsonObjectFunc {
4912 pub pairs: Vec<(Expression, Expression)>,
4913 pub null_handling: Option<JsonNullHandling>,
4914 #[serde(default)]
4915 pub with_unique_keys: bool,
4916 #[serde(default)]
4917 pub returning_type: Option<DataType>,
4918 #[serde(default)]
4919 pub format_json: bool,
4920 #[serde(default)]
4921 pub encoding: Option<String>,
4922 #[serde(default)]
4924 pub star: bool,
4925}
4926
4927#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4929#[cfg_attr(feature = "bindings", derive(TS))]
4930pub enum JsonNullHandling {
4931 NullOnNull,
4932 AbsentOnNull,
4933}
4934
4935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4937#[cfg_attr(feature = "bindings", derive(TS))]
4938pub struct JsonModifyFunc {
4939 pub this: Expression,
4940 pub path_values: Vec<(Expression, Expression)>,
4941}
4942
4943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4945#[cfg_attr(feature = "bindings", derive(TS))]
4946pub struct JsonArrayAggFunc {
4947 pub this: Expression,
4948 pub order_by: Option<Vec<Ordered>>,
4949 pub null_handling: Option<JsonNullHandling>,
4950 pub filter: Option<Expression>,
4951}
4952
4953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4955#[cfg_attr(feature = "bindings", derive(TS))]
4956pub struct JsonObjectAggFunc {
4957 pub key: Expression,
4958 pub value: Expression,
4959 pub null_handling: Option<JsonNullHandling>,
4960 pub filter: Option<Expression>,
4961}
4962
4963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4969#[cfg_attr(feature = "bindings", derive(TS))]
4970pub struct ConvertFunc {
4971 pub this: Expression,
4972 pub to: DataType,
4973 pub style: Option<Expression>,
4974}
4975
4976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4982#[cfg_attr(feature = "bindings", derive(TS))]
4983pub struct LambdaExpr {
4984 pub parameters: Vec<Identifier>,
4985 pub body: Expression,
4986 #[serde(default)]
4988 pub colon: bool,
4989 #[serde(default)]
4992 pub parameter_types: Vec<Option<DataType>>,
4993}
4994
4995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4997#[cfg_attr(feature = "bindings", derive(TS))]
4998pub struct Parameter {
4999 pub name: Option<String>,
5000 pub index: Option<u32>,
5001 pub style: ParameterStyle,
5002 #[serde(default)]
5004 pub quoted: bool,
5005 #[serde(default)]
5007 pub string_quoted: bool,
5008 #[serde(default)]
5010 pub expression: Option<String>,
5011}
5012
5013#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5015#[cfg_attr(feature = "bindings", derive(TS))]
5016pub enum ParameterStyle {
5017 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
5027
5028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5030#[cfg_attr(feature = "bindings", derive(TS))]
5031pub struct Placeholder {
5032 pub index: Option<u32>,
5033}
5034
5035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5037#[cfg_attr(feature = "bindings", derive(TS))]
5038pub struct NamedArgument {
5039 pub name: Identifier,
5040 pub value: Expression,
5041 pub separator: NamedArgSeparator,
5043}
5044
5045#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5047#[cfg_attr(feature = "bindings", derive(TS))]
5048pub enum NamedArgSeparator {
5049 DArrow,
5051 ColonEq,
5053 Eq,
5055}
5056
5057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5060#[cfg_attr(feature = "bindings", derive(TS))]
5061pub struct TableArgument {
5062 pub prefix: String,
5064 pub this: Expression,
5066}
5067
5068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5070#[cfg_attr(feature = "bindings", derive(TS))]
5071pub struct SqlComment {
5072 pub text: String,
5073 pub is_block: bool,
5074}
5075
5076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5082#[cfg_attr(feature = "bindings", derive(TS))]
5083pub struct SimilarToExpr {
5084 pub this: Expression,
5085 pub pattern: Expression,
5086 pub escape: Option<Expression>,
5087 pub not: bool,
5088}
5089
5090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5092#[cfg_attr(feature = "bindings", derive(TS))]
5093pub struct QuantifiedExpr {
5094 pub this: Expression,
5095 pub subquery: Expression,
5096 pub op: Option<QuantifiedOp>,
5097}
5098
5099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5101#[cfg_attr(feature = "bindings", derive(TS))]
5102pub enum QuantifiedOp {
5103 Eq,
5104 Neq,
5105 Lt,
5106 Lte,
5107 Gt,
5108 Gte,
5109}
5110
5111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5116#[cfg_attr(feature = "bindings", derive(TS))]
5117pub struct OverlapsExpr {
5118 #[serde(skip_serializing_if = "Option::is_none")]
5120 pub this: Option<Expression>,
5121 #[serde(skip_serializing_if = "Option::is_none")]
5123 pub expression: Option<Expression>,
5124 #[serde(skip_serializing_if = "Option::is_none")]
5126 pub left_start: Option<Expression>,
5127 #[serde(skip_serializing_if = "Option::is_none")]
5129 pub left_end: Option<Expression>,
5130 #[serde(skip_serializing_if = "Option::is_none")]
5132 pub right_start: Option<Expression>,
5133 #[serde(skip_serializing_if = "Option::is_none")]
5135 pub right_end: Option<Expression>,
5136}
5137
5138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5144#[cfg_attr(feature = "bindings", derive(TS))]
5145pub struct Subscript {
5146 pub this: Expression,
5147 pub index: Expression,
5148}
5149
5150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5152#[cfg_attr(feature = "bindings", derive(TS))]
5153pub struct DotAccess {
5154 pub this: Expression,
5155 pub field: Identifier,
5156}
5157
5158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5160#[cfg_attr(feature = "bindings", derive(TS))]
5161pub struct MethodCall {
5162 pub this: Expression,
5163 pub method: Identifier,
5164 pub args: Vec<Expression>,
5165}
5166
5167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5169#[cfg_attr(feature = "bindings", derive(TS))]
5170pub struct ArraySlice {
5171 pub this: Expression,
5172 pub start: Option<Expression>,
5173 pub end: Option<Expression>,
5174}
5175
5176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5182#[cfg_attr(feature = "bindings", derive(TS))]
5183pub enum OnCommit {
5184 PreserveRows,
5186 DeleteRows,
5188}
5189
5190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5192#[cfg_attr(feature = "bindings", derive(TS))]
5193pub struct CreateTable {
5194 pub name: TableRef,
5195 #[serde(default, skip_serializing_if = "Option::is_none")]
5197 pub on_cluster: Option<OnCluster>,
5198 pub columns: Vec<ColumnDef>,
5199 pub constraints: Vec<TableConstraint>,
5200 pub if_not_exists: bool,
5201 pub temporary: bool,
5202 pub or_replace: bool,
5203 #[serde(default, skip_serializing_if = "Option::is_none")]
5205 pub table_modifier: Option<String>,
5206 pub as_select: Option<Expression>,
5207 #[serde(default)]
5209 pub as_select_parenthesized: bool,
5210 #[serde(default)]
5212 pub on_commit: Option<OnCommit>,
5213 #[serde(default)]
5215 pub clone_source: Option<TableRef>,
5216 #[serde(default, skip_serializing_if = "Option::is_none")]
5218 pub clone_at_clause: Option<Expression>,
5219 #[serde(default)]
5221 pub is_copy: bool,
5222 #[serde(default)]
5224 pub shallow_clone: bool,
5225 #[serde(default)]
5227 pub leading_comments: Vec<String>,
5228 #[serde(default)]
5230 pub with_properties: Vec<(String, String)>,
5231 #[serde(default)]
5233 pub teradata_post_name_options: Vec<String>,
5234 #[serde(default)]
5236 pub with_data: Option<bool>,
5237 #[serde(default)]
5239 pub with_statistics: Option<bool>,
5240 #[serde(default)]
5242 pub teradata_indexes: Vec<TeradataIndex>,
5243 #[serde(default)]
5245 pub with_cte: Option<With>,
5246 #[serde(default)]
5248 pub properties: Vec<Expression>,
5249 #[serde(default, skip_serializing_if = "Option::is_none")]
5251 pub partition_of: Option<Expression>,
5252 #[serde(default)]
5254 pub post_table_properties: Vec<Expression>,
5255 #[serde(default)]
5257 pub mysql_table_options: Vec<(String, String)>,
5258 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5260 pub inherits: Vec<TableRef>,
5261 #[serde(default, skip_serializing_if = "Option::is_none")]
5263 pub on_property: Option<OnProperty>,
5264 #[serde(default)]
5266 pub copy_grants: bool,
5267 #[serde(default, skip_serializing_if = "Option::is_none")]
5269 pub using_template: Option<Box<Expression>>,
5270 #[serde(default, skip_serializing_if = "Option::is_none")]
5272 pub rollup: Option<RollupProperty>,
5273}
5274
5275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5277#[cfg_attr(feature = "bindings", derive(TS))]
5278pub struct TeradataIndex {
5279 pub kind: TeradataIndexKind,
5281 pub name: Option<String>,
5283 pub columns: Vec<String>,
5285}
5286
5287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5289#[cfg_attr(feature = "bindings", derive(TS))]
5290pub enum TeradataIndexKind {
5291 NoPrimary,
5293 Primary,
5295 PrimaryAmp,
5297 Unique,
5299 UniquePrimary,
5301 Secondary,
5303}
5304
5305impl CreateTable {
5306 pub fn new(name: impl Into<String>) -> Self {
5307 Self {
5308 name: TableRef::new(name),
5309 on_cluster: None,
5310 columns: Vec::new(),
5311 constraints: Vec::new(),
5312 if_not_exists: false,
5313 temporary: false,
5314 or_replace: false,
5315 table_modifier: None,
5316 as_select: None,
5317 as_select_parenthesized: false,
5318 on_commit: None,
5319 clone_source: None,
5320 clone_at_clause: None,
5321 shallow_clone: false,
5322 is_copy: false,
5323 leading_comments: Vec::new(),
5324 with_properties: Vec::new(),
5325 teradata_post_name_options: Vec::new(),
5326 with_data: None,
5327 with_statistics: None,
5328 teradata_indexes: Vec::new(),
5329 with_cte: None,
5330 properties: Vec::new(),
5331 partition_of: None,
5332 post_table_properties: Vec::new(),
5333 mysql_table_options: Vec::new(),
5334 inherits: Vec::new(),
5335 on_property: None,
5336 copy_grants: false,
5337 using_template: None,
5338 rollup: None,
5339 }
5340 }
5341}
5342
5343#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
5345#[cfg_attr(feature = "bindings", derive(TS))]
5346pub enum SortOrder {
5347 Asc,
5348 Desc,
5349}
5350
5351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5353#[cfg_attr(feature = "bindings", derive(TS))]
5354pub enum ConstraintType {
5355 NotNull,
5356 Null,
5357 PrimaryKey,
5358 Unique,
5359 Default,
5360 AutoIncrement,
5361 Collate,
5362 Comment,
5363 References,
5364 Check,
5365 GeneratedAsIdentity,
5366 Tags,
5368 ComputedColumn,
5370 GeneratedAsRow,
5372 OnUpdate,
5374 Path,
5376 Encode,
5378}
5379
5380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5382#[cfg_attr(feature = "bindings", derive(TS))]
5383pub struct ColumnDef {
5384 pub name: Identifier,
5385 pub data_type: DataType,
5386 pub nullable: Option<bool>,
5387 pub default: Option<Expression>,
5388 pub primary_key: bool,
5389 #[serde(default)]
5391 pub primary_key_order: Option<SortOrder>,
5392 pub unique: bool,
5393 #[serde(default)]
5395 pub unique_nulls_not_distinct: bool,
5396 pub auto_increment: bool,
5397 pub comment: Option<String>,
5398 pub constraints: Vec<ColumnConstraint>,
5399 #[serde(default)]
5401 pub constraint_order: Vec<ConstraintType>,
5402 #[serde(default)]
5404 pub format: Option<String>,
5405 #[serde(default)]
5407 pub title: Option<String>,
5408 #[serde(default)]
5410 pub inline_length: Option<u64>,
5411 #[serde(default)]
5413 pub compress: Option<Vec<Expression>>,
5414 #[serde(default)]
5416 pub character_set: Option<String>,
5417 #[serde(default)]
5419 pub uppercase: bool,
5420 #[serde(default)]
5422 pub casespecific: Option<bool>,
5423 #[serde(default)]
5425 pub auto_increment_start: Option<Box<Expression>>,
5426 #[serde(default)]
5428 pub auto_increment_increment: Option<Box<Expression>>,
5429 #[serde(default)]
5431 pub auto_increment_order: Option<bool>,
5432 #[serde(default)]
5434 pub unsigned: bool,
5435 #[serde(default)]
5437 pub zerofill: bool,
5438 #[serde(default, skip_serializing_if = "Option::is_none")]
5440 pub on_update: Option<Expression>,
5441 #[serde(default, skip_serializing_if = "Option::is_none")]
5443 pub unique_constraint_name: Option<String>,
5444 #[serde(default, skip_serializing_if = "Option::is_none")]
5446 pub not_null_constraint_name: Option<String>,
5447 #[serde(default, skip_serializing_if = "Option::is_none")]
5449 pub primary_key_constraint_name: Option<String>,
5450 #[serde(default, skip_serializing_if = "Option::is_none")]
5452 pub check_constraint_name: Option<String>,
5453 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5455 pub options: Vec<Expression>,
5456 #[serde(default)]
5458 pub no_type: bool,
5459 #[serde(default, skip_serializing_if = "Option::is_none")]
5461 pub encoding: Option<String>,
5462 #[serde(default, skip_serializing_if = "Option::is_none")]
5464 pub codec: Option<String>,
5465 #[serde(default, skip_serializing_if = "Option::is_none")]
5467 pub ephemeral: Option<Option<Box<Expression>>>,
5468 #[serde(default, skip_serializing_if = "Option::is_none")]
5470 pub materialized_expr: Option<Box<Expression>>,
5471 #[serde(default, skip_serializing_if = "Option::is_none")]
5473 pub alias_expr: Option<Box<Expression>>,
5474 #[serde(default, skip_serializing_if = "Option::is_none")]
5476 pub ttl_expr: Option<Box<Expression>>,
5477 #[serde(default)]
5479 pub not_for_replication: bool,
5480}
5481
5482impl ColumnDef {
5483 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
5484 Self {
5485 name: Identifier::new(name),
5486 data_type,
5487 nullable: None,
5488 default: None,
5489 primary_key: false,
5490 primary_key_order: None,
5491 unique: false,
5492 unique_nulls_not_distinct: false,
5493 auto_increment: false,
5494 comment: None,
5495 constraints: Vec::new(),
5496 constraint_order: Vec::new(),
5497 format: None,
5498 title: None,
5499 inline_length: None,
5500 compress: None,
5501 character_set: None,
5502 uppercase: false,
5503 casespecific: None,
5504 auto_increment_start: None,
5505 auto_increment_increment: None,
5506 auto_increment_order: None,
5507 unsigned: false,
5508 zerofill: false,
5509 on_update: None,
5510 unique_constraint_name: None,
5511 not_null_constraint_name: None,
5512 primary_key_constraint_name: None,
5513 check_constraint_name: None,
5514 options: Vec::new(),
5515 no_type: false,
5516 encoding: None,
5517 codec: None,
5518 ephemeral: None,
5519 materialized_expr: None,
5520 alias_expr: None,
5521 ttl_expr: None,
5522 not_for_replication: false,
5523 }
5524 }
5525}
5526
5527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5529#[cfg_attr(feature = "bindings", derive(TS))]
5530pub enum ColumnConstraint {
5531 NotNull,
5532 Null,
5533 Unique,
5534 PrimaryKey,
5535 Default(Expression),
5536 Check(Expression),
5537 References(ForeignKeyRef),
5538 GeneratedAsIdentity(GeneratedAsIdentity),
5539 Collate(Identifier),
5540 Comment(String),
5541 Tags(Tags),
5543 ComputedColumn(ComputedColumn),
5546 GeneratedAsRow(GeneratedAsRow),
5548 Path(Expression),
5550}
5551
5552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5554#[cfg_attr(feature = "bindings", derive(TS))]
5555pub struct ComputedColumn {
5556 pub expression: Box<Expression>,
5558 #[serde(default)]
5560 pub persisted: bool,
5561 #[serde(default)]
5563 pub not_null: bool,
5564 #[serde(default)]
5567 pub persistence_kind: Option<String>,
5568 #[serde(default, skip_serializing_if = "Option::is_none")]
5570 pub data_type: Option<DataType>,
5571}
5572
5573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5575#[cfg_attr(feature = "bindings", derive(TS))]
5576pub struct GeneratedAsRow {
5577 pub start: bool,
5579 #[serde(default)]
5581 pub hidden: bool,
5582}
5583
5584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5586#[cfg_attr(feature = "bindings", derive(TS))]
5587pub struct GeneratedAsIdentity {
5588 pub always: bool,
5590 pub on_null: bool,
5592 pub start: Option<Box<Expression>>,
5594 pub increment: Option<Box<Expression>>,
5596 pub minvalue: Option<Box<Expression>>,
5598 pub maxvalue: Option<Box<Expression>>,
5600 pub cycle: Option<bool>,
5602}
5603
5604#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5606#[cfg_attr(feature = "bindings", derive(TS))]
5607pub struct ConstraintModifiers {
5608 pub enforced: Option<bool>,
5610 pub deferrable: Option<bool>,
5612 pub initially_deferred: Option<bool>,
5614 pub norely: bool,
5616 pub rely: bool,
5618 #[serde(default)]
5620 pub using: Option<String>,
5621 #[serde(default)]
5623 pub using_before_columns: bool,
5624 #[serde(default, skip_serializing_if = "Option::is_none")]
5626 pub comment: Option<String>,
5627 #[serde(default, skip_serializing_if = "Option::is_none")]
5629 pub visible: Option<bool>,
5630 #[serde(default, skip_serializing_if = "Option::is_none")]
5632 pub engine_attribute: Option<String>,
5633 #[serde(default, skip_serializing_if = "Option::is_none")]
5635 pub with_parser: Option<String>,
5636 #[serde(default)]
5638 pub not_valid: bool,
5639 #[serde(default, skip_serializing_if = "Option::is_none")]
5641 pub clustered: Option<String>,
5642 #[serde(default, skip_serializing_if = "Option::is_none")]
5644 pub on_conflict: Option<String>,
5645 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5647 pub with_options: Vec<(String, String)>,
5648 #[serde(default, skip_serializing_if = "Option::is_none")]
5650 pub on_filegroup: Option<Identifier>,
5651}
5652
5653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5655#[cfg_attr(feature = "bindings", derive(TS))]
5656pub enum TableConstraint {
5657 PrimaryKey {
5658 name: Option<Identifier>,
5659 columns: Vec<Identifier>,
5660 #[serde(default)]
5662 include_columns: Vec<Identifier>,
5663 #[serde(default)]
5664 modifiers: ConstraintModifiers,
5665 #[serde(default)]
5667 has_constraint_keyword: bool,
5668 },
5669 Unique {
5670 name: Option<Identifier>,
5671 columns: Vec<Identifier>,
5672 #[serde(default)]
5674 columns_parenthesized: bool,
5675 #[serde(default)]
5676 modifiers: ConstraintModifiers,
5677 #[serde(default)]
5679 has_constraint_keyword: bool,
5680 #[serde(default)]
5682 nulls_not_distinct: bool,
5683 },
5684 ForeignKey {
5685 name: Option<Identifier>,
5686 columns: Vec<Identifier>,
5687 #[serde(default)]
5688 references: Option<ForeignKeyRef>,
5689 #[serde(default)]
5691 on_delete: Option<ReferentialAction>,
5692 #[serde(default)]
5694 on_update: Option<ReferentialAction>,
5695 #[serde(default)]
5696 modifiers: ConstraintModifiers,
5697 },
5698 Check {
5699 name: Option<Identifier>,
5700 expression: Expression,
5701 #[serde(default)]
5702 modifiers: ConstraintModifiers,
5703 },
5704 Index {
5706 name: Option<Identifier>,
5707 columns: Vec<Identifier>,
5708 #[serde(default)]
5710 kind: Option<String>,
5711 #[serde(default)]
5712 modifiers: ConstraintModifiers,
5713 #[serde(default)]
5715 use_key_keyword: bool,
5716 #[serde(default, skip_serializing_if = "Option::is_none")]
5718 expression: Option<Box<Expression>>,
5719 #[serde(default, skip_serializing_if = "Option::is_none")]
5721 index_type: Option<Box<Expression>>,
5722 #[serde(default, skip_serializing_if = "Option::is_none")]
5724 granularity: Option<Box<Expression>>,
5725 },
5726 Projection {
5728 name: Identifier,
5729 expression: Expression,
5730 },
5731 Like {
5733 source: TableRef,
5734 options: Vec<(LikeOptionAction, String)>,
5736 },
5737 PeriodForSystemTime {
5739 start_col: Identifier,
5740 end_col: Identifier,
5741 },
5742 Exclude {
5745 name: Option<Identifier>,
5746 #[serde(default)]
5748 using: Option<String>,
5749 elements: Vec<ExcludeElement>,
5751 #[serde(default)]
5753 include_columns: Vec<Identifier>,
5754 #[serde(default)]
5756 where_clause: Option<Box<Expression>>,
5757 #[serde(default)]
5759 with_params: Vec<(String, String)>,
5760 #[serde(default)]
5762 using_index_tablespace: Option<String>,
5763 #[serde(default)]
5764 modifiers: ConstraintModifiers,
5765 },
5766 Tags(Tags),
5768 InitiallyDeferred {
5772 deferred: bool,
5774 },
5775}
5776
5777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5779#[cfg_attr(feature = "bindings", derive(TS))]
5780pub struct ExcludeElement {
5781 pub expression: String,
5783 pub operator: String,
5785}
5786
5787#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5789#[cfg_attr(feature = "bindings", derive(TS))]
5790pub enum LikeOptionAction {
5791 Including,
5792 Excluding,
5793}
5794
5795#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5797#[cfg_attr(feature = "bindings", derive(TS))]
5798pub enum MatchType {
5799 Full,
5800 Partial,
5801 Simple,
5802}
5803
5804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5806#[cfg_attr(feature = "bindings", derive(TS))]
5807pub struct ForeignKeyRef {
5808 pub table: TableRef,
5809 pub columns: Vec<Identifier>,
5810 pub on_delete: Option<ReferentialAction>,
5811 pub on_update: Option<ReferentialAction>,
5812 #[serde(default)]
5814 pub on_update_first: bool,
5815 #[serde(default)]
5817 pub match_type: Option<MatchType>,
5818 #[serde(default)]
5820 pub match_after_actions: bool,
5821 #[serde(default)]
5823 pub constraint_name: Option<String>,
5824 #[serde(default)]
5826 pub deferrable: Option<bool>,
5827 #[serde(default)]
5829 pub has_foreign_key_keywords: bool,
5830}
5831
5832#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5834#[cfg_attr(feature = "bindings", derive(TS))]
5835pub enum ReferentialAction {
5836 Cascade,
5837 SetNull,
5838 SetDefault,
5839 Restrict,
5840 NoAction,
5841}
5842
5843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5845#[cfg_attr(feature = "bindings", derive(TS))]
5846pub struct DropTable {
5847 pub names: Vec<TableRef>,
5848 pub if_exists: bool,
5849 pub cascade: bool,
5850 #[serde(default)]
5852 pub cascade_constraints: bool,
5853 #[serde(default)]
5855 pub purge: bool,
5856 #[serde(default)]
5858 pub leading_comments: Vec<String>,
5859}
5860
5861impl DropTable {
5862 pub fn new(name: impl Into<String>) -> Self {
5863 Self {
5864 names: vec![TableRef::new(name)],
5865 if_exists: false,
5866 cascade: false,
5867 cascade_constraints: false,
5868 purge: false,
5869 leading_comments: Vec::new(),
5870 }
5871 }
5872}
5873
5874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5876#[cfg_attr(feature = "bindings", derive(TS))]
5877pub struct AlterTable {
5878 pub name: TableRef,
5879 pub actions: Vec<AlterTableAction>,
5880 #[serde(default)]
5882 pub if_exists: bool,
5883 #[serde(default, skip_serializing_if = "Option::is_none")]
5885 pub algorithm: Option<String>,
5886 #[serde(default, skip_serializing_if = "Option::is_none")]
5888 pub lock: Option<String>,
5889 #[serde(default, skip_serializing_if = "Option::is_none")]
5891 pub with_check: Option<String>,
5892 #[serde(default, skip_serializing_if = "Option::is_none")]
5894 pub partition: Option<Vec<(Identifier, Expression)>>,
5895 #[serde(default, skip_serializing_if = "Option::is_none")]
5897 pub on_cluster: Option<OnCluster>,
5898}
5899
5900impl AlterTable {
5901 pub fn new(name: impl Into<String>) -> Self {
5902 Self {
5903 name: TableRef::new(name),
5904 actions: Vec::new(),
5905 if_exists: false,
5906 algorithm: None,
5907 lock: None,
5908 with_check: None,
5909 partition: None,
5910 on_cluster: None,
5911 }
5912 }
5913}
5914
5915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5917#[cfg_attr(feature = "bindings", derive(TS))]
5918pub enum ColumnPosition {
5919 First,
5920 After(Identifier),
5921}
5922
5923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5925#[cfg_attr(feature = "bindings", derive(TS))]
5926pub enum AlterTableAction {
5927 AddColumn {
5928 column: ColumnDef,
5929 if_not_exists: bool,
5930 position: Option<ColumnPosition>,
5931 },
5932 DropColumn {
5933 name: Identifier,
5934 if_exists: bool,
5935 cascade: bool,
5936 },
5937 RenameColumn {
5938 old_name: Identifier,
5939 new_name: Identifier,
5940 if_exists: bool,
5941 },
5942 AlterColumn {
5943 name: Identifier,
5944 action: AlterColumnAction,
5945 #[serde(default)]
5947 use_modify_keyword: bool,
5948 },
5949 RenameTable(TableRef),
5950 AddConstraint(TableConstraint),
5951 DropConstraint {
5952 name: Identifier,
5953 if_exists: bool,
5954 },
5955 DropForeignKey {
5957 name: Identifier,
5958 },
5959 DropPartition {
5961 partitions: Vec<Vec<(Identifier, Expression)>>,
5963 if_exists: bool,
5964 },
5965 AddPartition {
5967 partition: Expression,
5969 if_not_exists: bool,
5970 location: Option<Expression>,
5971 },
5972 Delete {
5974 where_clause: Expression,
5975 },
5976 SwapWith(TableRef),
5978 SetProperty {
5980 properties: Vec<(String, Expression)>,
5981 },
5982 UnsetProperty {
5984 properties: Vec<String>,
5985 },
5986 ClusterBy {
5988 expressions: Vec<Expression>,
5989 },
5990 SetTag {
5992 expressions: Vec<(String, Expression)>,
5993 },
5994 UnsetTag {
5996 names: Vec<String>,
5997 },
5998 SetOptions {
6000 expressions: Vec<Expression>,
6001 },
6002 AlterIndex {
6004 name: Identifier,
6005 visible: bool,
6006 },
6007 SetAttribute {
6009 attribute: String,
6010 },
6011 SetStageFileFormat {
6013 options: Option<Expression>,
6014 },
6015 SetStageCopyOptions {
6017 options: Option<Expression>,
6018 },
6019 AddColumns {
6021 columns: Vec<ColumnDef>,
6022 cascade: bool,
6023 },
6024 DropColumns {
6026 names: Vec<Identifier>,
6027 },
6028 ChangeColumn {
6031 old_name: Identifier,
6032 new_name: Identifier,
6033 #[serde(default, skip_serializing_if = "Option::is_none")]
6034 data_type: Option<DataType>,
6035 comment: Option<String>,
6036 #[serde(default)]
6037 cascade: bool,
6038 },
6039 AlterSortKey {
6042 this: Option<String>,
6044 expressions: Vec<Expression>,
6046 compound: bool,
6048 },
6049 AlterDistStyle {
6053 style: String,
6055 distkey: Option<Identifier>,
6057 },
6058 SetTableProperties {
6060 properties: Vec<(Expression, Expression)>,
6061 },
6062 SetLocation {
6064 location: String,
6065 },
6066 SetFileFormat {
6068 format: String,
6069 },
6070 ReplacePartition {
6072 partition: Expression,
6073 source: Option<Box<Expression>>,
6074 },
6075 Raw {
6077 sql: String,
6078 },
6079}
6080
6081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6083#[cfg_attr(feature = "bindings", derive(TS))]
6084pub enum AlterColumnAction {
6085 SetDataType {
6086 data_type: DataType,
6087 using: Option<Expression>,
6089 #[serde(default, skip_serializing_if = "Option::is_none")]
6091 collate: Option<String>,
6092 },
6093 SetDefault(Expression),
6094 DropDefault,
6095 SetNotNull,
6096 DropNotNull,
6097 Comment(String),
6099 SetVisible,
6101 SetInvisible,
6103}
6104
6105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6107#[cfg_attr(feature = "bindings", derive(TS))]
6108pub struct CreateIndex {
6109 pub name: Identifier,
6110 pub table: TableRef,
6111 pub columns: Vec<IndexColumn>,
6112 pub unique: bool,
6113 pub if_not_exists: bool,
6114 pub using: Option<String>,
6115 #[serde(default)]
6117 pub clustered: Option<String>,
6118 #[serde(default)]
6120 pub concurrently: bool,
6121 #[serde(default)]
6123 pub where_clause: Option<Box<Expression>>,
6124 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6126 pub include_columns: Vec<Identifier>,
6127 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6129 pub with_options: Vec<(String, String)>,
6130 #[serde(default)]
6132 pub on_filegroup: Option<String>,
6133}
6134
6135impl CreateIndex {
6136 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
6137 Self {
6138 name: Identifier::new(name),
6139 table: TableRef::new(table),
6140 columns: Vec::new(),
6141 unique: false,
6142 if_not_exists: false,
6143 using: None,
6144 clustered: None,
6145 concurrently: false,
6146 where_clause: None,
6147 include_columns: Vec::new(),
6148 with_options: Vec::new(),
6149 on_filegroup: None,
6150 }
6151 }
6152}
6153
6154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6156#[cfg_attr(feature = "bindings", derive(TS))]
6157pub struct IndexColumn {
6158 pub column: Identifier,
6159 pub desc: bool,
6160 #[serde(default)]
6162 pub asc: bool,
6163 pub nulls_first: Option<bool>,
6164 #[serde(default, skip_serializing_if = "Option::is_none")]
6166 pub opclass: Option<String>,
6167}
6168
6169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6171#[cfg_attr(feature = "bindings", derive(TS))]
6172pub struct DropIndex {
6173 pub name: Identifier,
6174 pub table: Option<TableRef>,
6175 pub if_exists: bool,
6176 #[serde(default)]
6178 pub concurrently: bool,
6179}
6180
6181impl DropIndex {
6182 pub fn new(name: impl Into<String>) -> Self {
6183 Self {
6184 name: Identifier::new(name),
6185 table: None,
6186 if_exists: false,
6187 concurrently: false,
6188 }
6189 }
6190}
6191
6192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6194#[cfg_attr(feature = "bindings", derive(TS))]
6195pub struct ViewColumn {
6196 pub name: Identifier,
6197 pub comment: Option<String>,
6198 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6200 pub options: Vec<Expression>,
6201}
6202
6203impl ViewColumn {
6204 pub fn new(name: impl Into<String>) -> Self {
6205 Self {
6206 name: Identifier::new(name),
6207 comment: None,
6208 options: Vec::new(),
6209 }
6210 }
6211
6212 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
6213 Self {
6214 name: Identifier::new(name),
6215 comment: Some(comment.into()),
6216 options: Vec::new(),
6217 }
6218 }
6219}
6220
6221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6223#[cfg_attr(feature = "bindings", derive(TS))]
6224pub struct CreateView {
6225 pub name: TableRef,
6226 pub columns: Vec<ViewColumn>,
6227 pub query: Expression,
6228 pub or_replace: bool,
6229 pub if_not_exists: bool,
6230 pub materialized: bool,
6231 pub temporary: bool,
6232 #[serde(default)]
6234 pub secure: bool,
6235 #[serde(skip_serializing_if = "Option::is_none")]
6237 pub algorithm: Option<String>,
6238 #[serde(skip_serializing_if = "Option::is_none")]
6240 pub definer: Option<String>,
6241 #[serde(skip_serializing_if = "Option::is_none")]
6243 pub security: Option<FunctionSecurity>,
6244 #[serde(default = "default_true")]
6246 pub security_sql_style: bool,
6247 #[serde(default)]
6249 pub query_parenthesized: bool,
6250 #[serde(skip_serializing_if = "Option::is_none")]
6252 pub locking_mode: Option<String>,
6253 #[serde(skip_serializing_if = "Option::is_none")]
6255 pub locking_access: Option<String>,
6256 #[serde(default)]
6258 pub copy_grants: bool,
6259 #[serde(skip_serializing_if = "Option::is_none", default)]
6261 pub comment: Option<String>,
6262 #[serde(default)]
6264 pub tags: Vec<(String, String)>,
6265 #[serde(default)]
6267 pub options: Vec<Expression>,
6268 #[serde(skip_serializing_if = "Option::is_none", default)]
6270 pub build: Option<String>,
6271 #[serde(skip_serializing_if = "Option::is_none", default)]
6273 pub refresh: Option<Box<RefreshTriggerProperty>>,
6274 #[serde(skip_serializing_if = "Option::is_none", default)]
6277 pub schema: Option<Box<Schema>>,
6278 #[serde(skip_serializing_if = "Option::is_none", default)]
6280 pub unique_key: Option<Box<UniqueKeyProperty>>,
6281 #[serde(default)]
6283 pub no_schema_binding: bool,
6284 #[serde(skip_serializing_if = "Option::is_none", default)]
6286 pub auto_refresh: Option<bool>,
6287 #[serde(default, skip_serializing_if = "Option::is_none")]
6289 pub on_cluster: Option<OnCluster>,
6290 #[serde(default, skip_serializing_if = "Option::is_none")]
6292 pub to_table: Option<TableRef>,
6293 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6295 pub table_properties: Vec<Expression>,
6296}
6297
6298impl CreateView {
6299 pub fn new(name: impl Into<String>, query: Expression) -> Self {
6300 Self {
6301 name: TableRef::new(name),
6302 columns: Vec::new(),
6303 query,
6304 or_replace: false,
6305 if_not_exists: false,
6306 materialized: false,
6307 temporary: false,
6308 secure: false,
6309 algorithm: None,
6310 definer: None,
6311 security: None,
6312 security_sql_style: true,
6313 query_parenthesized: false,
6314 locking_mode: None,
6315 locking_access: None,
6316 copy_grants: false,
6317 comment: None,
6318 tags: Vec::new(),
6319 options: Vec::new(),
6320 build: None,
6321 refresh: None,
6322 schema: None,
6323 unique_key: None,
6324 no_schema_binding: false,
6325 auto_refresh: None,
6326 on_cluster: None,
6327 to_table: None,
6328 table_properties: Vec::new(),
6329 }
6330 }
6331}
6332
6333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6335#[cfg_attr(feature = "bindings", derive(TS))]
6336pub struct DropView {
6337 pub name: TableRef,
6338 pub if_exists: bool,
6339 pub materialized: bool,
6340}
6341
6342impl DropView {
6343 pub fn new(name: impl Into<String>) -> Self {
6344 Self {
6345 name: TableRef::new(name),
6346 if_exists: false,
6347 materialized: false,
6348 }
6349 }
6350}
6351
6352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6354#[cfg_attr(feature = "bindings", derive(TS))]
6355pub struct Truncate {
6356 #[serde(default)]
6358 pub target: TruncateTarget,
6359 #[serde(default)]
6361 pub if_exists: bool,
6362 pub table: TableRef,
6363 #[serde(default, skip_serializing_if = "Option::is_none")]
6365 pub on_cluster: Option<OnCluster>,
6366 pub cascade: bool,
6367 #[serde(default)]
6369 pub extra_tables: Vec<TruncateTableEntry>,
6370 #[serde(default)]
6372 pub identity: Option<TruncateIdentity>,
6373 #[serde(default)]
6375 pub restrict: bool,
6376 #[serde(default, skip_serializing_if = "Option::is_none")]
6378 pub partition: Option<Box<Expression>>,
6379}
6380
6381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6383#[cfg_attr(feature = "bindings", derive(TS))]
6384pub struct TruncateTableEntry {
6385 pub table: TableRef,
6386 #[serde(default)]
6388 pub star: bool,
6389}
6390
6391#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6393#[cfg_attr(feature = "bindings", derive(TS))]
6394pub enum TruncateTarget {
6395 Table,
6396 Database,
6397}
6398
6399impl Default for TruncateTarget {
6400 fn default() -> Self {
6401 TruncateTarget::Table
6402 }
6403}
6404
6405#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6407#[cfg_attr(feature = "bindings", derive(TS))]
6408pub enum TruncateIdentity {
6409 Restart,
6410 Continue,
6411}
6412
6413impl Truncate {
6414 pub fn new(table: impl Into<String>) -> Self {
6415 Self {
6416 target: TruncateTarget::Table,
6417 if_exists: false,
6418 table: TableRef::new(table),
6419 on_cluster: None,
6420 cascade: false,
6421 extra_tables: Vec::new(),
6422 identity: None,
6423 restrict: false,
6424 partition: None,
6425 }
6426 }
6427}
6428
6429#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6431#[cfg_attr(feature = "bindings", derive(TS))]
6432pub struct Use {
6433 pub kind: Option<UseKind>,
6435 pub this: Identifier,
6437}
6438
6439#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6441#[cfg_attr(feature = "bindings", derive(TS))]
6442pub enum UseKind {
6443 Database,
6444 Schema,
6445 Role,
6446 Warehouse,
6447 Catalog,
6448 SecondaryRoles,
6450}
6451
6452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6454#[cfg_attr(feature = "bindings", derive(TS))]
6455pub struct SetStatement {
6456 pub items: Vec<SetItem>,
6458}
6459
6460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6462#[cfg_attr(feature = "bindings", derive(TS))]
6463pub struct SetItem {
6464 pub name: Expression,
6466 pub value: Expression,
6468 pub kind: Option<String>,
6470 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6472 pub no_equals: bool,
6473}
6474
6475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6477#[cfg_attr(feature = "bindings", derive(TS))]
6478pub struct Cache {
6479 pub table: Identifier,
6481 pub lazy: bool,
6483 pub options: Vec<(Expression, Expression)>,
6485 pub query: Option<Expression>,
6487}
6488
6489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6491#[cfg_attr(feature = "bindings", derive(TS))]
6492pub struct Uncache {
6493 pub table: Identifier,
6495 pub if_exists: bool,
6497}
6498
6499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6501#[cfg_attr(feature = "bindings", derive(TS))]
6502pub struct LoadData {
6503 pub local: bool,
6505 pub inpath: String,
6507 pub overwrite: bool,
6509 pub table: Expression,
6511 pub partition: Vec<(Identifier, Expression)>,
6513 pub input_format: Option<String>,
6515 pub serde: Option<String>,
6517}
6518
6519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6521#[cfg_attr(feature = "bindings", derive(TS))]
6522pub struct Pragma {
6523 pub schema: Option<Identifier>,
6525 pub name: Identifier,
6527 pub value: Option<Expression>,
6529 pub args: Vec<Expression>,
6531}
6532
6533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6536#[cfg_attr(feature = "bindings", derive(TS))]
6537pub struct Privilege {
6538 pub name: String,
6540 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6542 pub columns: Vec<String>,
6543}
6544
6545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6547#[cfg_attr(feature = "bindings", derive(TS))]
6548pub struct GrantPrincipal {
6549 pub name: Identifier,
6551 pub is_role: bool,
6553 #[serde(default)]
6555 pub is_group: bool,
6556}
6557
6558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6560#[cfg_attr(feature = "bindings", derive(TS))]
6561pub struct Grant {
6562 pub privileges: Vec<Privilege>,
6564 pub kind: Option<String>,
6566 pub securable: Identifier,
6568 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6570 pub function_params: Vec<String>,
6571 pub principals: Vec<GrantPrincipal>,
6573 pub grant_option: bool,
6575 #[serde(default, skip_serializing_if = "Option::is_none")]
6577 pub as_principal: Option<Identifier>,
6578}
6579
6580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6582#[cfg_attr(feature = "bindings", derive(TS))]
6583pub struct Revoke {
6584 pub privileges: Vec<Privilege>,
6586 pub kind: Option<String>,
6588 pub securable: Identifier,
6590 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6592 pub function_params: Vec<String>,
6593 pub principals: Vec<GrantPrincipal>,
6595 pub grant_option: bool,
6597 pub cascade: bool,
6599 #[serde(default)]
6601 pub restrict: bool,
6602}
6603
6604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6606#[cfg_attr(feature = "bindings", derive(TS))]
6607pub struct Comment {
6608 pub this: Expression,
6610 pub kind: String,
6612 pub expression: Expression,
6614 pub exists: bool,
6616 pub materialized: bool,
6618}
6619
6620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6626#[cfg_attr(feature = "bindings", derive(TS))]
6627pub struct AlterView {
6628 pub name: TableRef,
6629 pub actions: Vec<AlterViewAction>,
6630 #[serde(default, skip_serializing_if = "Option::is_none")]
6632 pub algorithm: Option<String>,
6633 #[serde(default, skip_serializing_if = "Option::is_none")]
6635 pub definer: Option<String>,
6636 #[serde(default, skip_serializing_if = "Option::is_none")]
6638 pub sql_security: Option<String>,
6639 #[serde(default, skip_serializing_if = "Option::is_none")]
6641 pub with_option: Option<String>,
6642 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6644 pub columns: Vec<ViewColumn>,
6645}
6646
6647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6649#[cfg_attr(feature = "bindings", derive(TS))]
6650pub enum AlterViewAction {
6651 Rename(TableRef),
6653 OwnerTo(Identifier),
6655 SetSchema(Identifier),
6657 SetAuthorization(String),
6659 AlterColumn {
6661 name: Identifier,
6662 action: AlterColumnAction,
6663 },
6664 AsSelect(Box<Expression>),
6666 SetTblproperties(Vec<(String, String)>),
6668 UnsetTblproperties(Vec<String>),
6670}
6671
6672impl AlterView {
6673 pub fn new(name: impl Into<String>) -> Self {
6674 Self {
6675 name: TableRef::new(name),
6676 actions: Vec::new(),
6677 algorithm: None,
6678 definer: None,
6679 sql_security: None,
6680 with_option: None,
6681 columns: Vec::new(),
6682 }
6683 }
6684}
6685
6686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6688#[cfg_attr(feature = "bindings", derive(TS))]
6689pub struct AlterIndex {
6690 pub name: Identifier,
6691 pub table: Option<TableRef>,
6692 pub actions: Vec<AlterIndexAction>,
6693}
6694
6695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6697#[cfg_attr(feature = "bindings", derive(TS))]
6698pub enum AlterIndexAction {
6699 Rename(Identifier),
6701 SetTablespace(Identifier),
6703 Visible(bool),
6705}
6706
6707impl AlterIndex {
6708 pub fn new(name: impl Into<String>) -> Self {
6709 Self {
6710 name: Identifier::new(name),
6711 table: None,
6712 actions: Vec::new(),
6713 }
6714 }
6715}
6716
6717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6719#[cfg_attr(feature = "bindings", derive(TS))]
6720pub struct CreateSchema {
6721 pub name: Identifier,
6722 pub if_not_exists: bool,
6723 pub authorization: Option<Identifier>,
6724 #[serde(default)]
6725 pub clone_from: Option<Identifier>,
6726 #[serde(default)]
6728 pub at_clause: Option<Expression>,
6729 #[serde(default)]
6731 pub properties: Vec<Expression>,
6732 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6734 pub leading_comments: Vec<String>,
6735}
6736
6737impl CreateSchema {
6738 pub fn new(name: impl Into<String>) -> Self {
6739 Self {
6740 name: Identifier::new(name),
6741 if_not_exists: false,
6742 authorization: None,
6743 clone_from: None,
6744 at_clause: None,
6745 properties: Vec::new(),
6746 leading_comments: Vec::new(),
6747 }
6748 }
6749}
6750
6751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6753#[cfg_attr(feature = "bindings", derive(TS))]
6754pub struct DropSchema {
6755 pub name: Identifier,
6756 pub if_exists: bool,
6757 pub cascade: bool,
6758}
6759
6760impl DropSchema {
6761 pub fn new(name: impl Into<String>) -> Self {
6762 Self {
6763 name: Identifier::new(name),
6764 if_exists: false,
6765 cascade: false,
6766 }
6767 }
6768}
6769
6770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6772#[cfg_attr(feature = "bindings", derive(TS))]
6773pub struct DropNamespace {
6774 pub name: Identifier,
6775 pub if_exists: bool,
6776 pub cascade: bool,
6777}
6778
6779impl DropNamespace {
6780 pub fn new(name: impl Into<String>) -> Self {
6781 Self {
6782 name: Identifier::new(name),
6783 if_exists: false,
6784 cascade: false,
6785 }
6786 }
6787}
6788
6789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6791#[cfg_attr(feature = "bindings", derive(TS))]
6792pub struct CreateDatabase {
6793 pub name: Identifier,
6794 pub if_not_exists: bool,
6795 pub options: Vec<DatabaseOption>,
6796 #[serde(default)]
6798 pub clone_from: Option<Identifier>,
6799 #[serde(default)]
6801 pub at_clause: Option<Expression>,
6802}
6803
6804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6806#[cfg_attr(feature = "bindings", derive(TS))]
6807pub enum DatabaseOption {
6808 CharacterSet(String),
6809 Collate(String),
6810 Owner(Identifier),
6811 Template(Identifier),
6812 Encoding(String),
6813 Location(String),
6814}
6815
6816impl CreateDatabase {
6817 pub fn new(name: impl Into<String>) -> Self {
6818 Self {
6819 name: Identifier::new(name),
6820 if_not_exists: false,
6821 options: Vec::new(),
6822 clone_from: None,
6823 at_clause: None,
6824 }
6825 }
6826}
6827
6828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6830#[cfg_attr(feature = "bindings", derive(TS))]
6831pub struct DropDatabase {
6832 pub name: Identifier,
6833 pub if_exists: bool,
6834}
6835
6836impl DropDatabase {
6837 pub fn new(name: impl Into<String>) -> Self {
6838 Self {
6839 name: Identifier::new(name),
6840 if_exists: false,
6841 }
6842 }
6843}
6844
6845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6847#[cfg_attr(feature = "bindings", derive(TS))]
6848pub struct CreateFunction {
6849 pub name: TableRef,
6850 pub parameters: Vec<FunctionParameter>,
6851 pub return_type: Option<DataType>,
6852 pub body: Option<FunctionBody>,
6853 pub or_replace: bool,
6854 pub if_not_exists: bool,
6855 pub temporary: bool,
6856 pub language: Option<String>,
6857 pub deterministic: Option<bool>,
6858 pub returns_null_on_null_input: Option<bool>,
6859 pub security: Option<FunctionSecurity>,
6860 #[serde(default = "default_true")]
6862 pub has_parens: bool,
6863 #[serde(default)]
6865 pub sql_data_access: Option<SqlDataAccess>,
6866 #[serde(default, skip_serializing_if = "Option::is_none")]
6868 pub returns_table_body: Option<String>,
6869 #[serde(default)]
6871 pub language_first: bool,
6872 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6874 pub set_options: Vec<FunctionSetOption>,
6875 #[serde(default)]
6877 pub strict: bool,
6878 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6880 pub options: Vec<Expression>,
6881 #[serde(default)]
6883 pub is_table_function: bool,
6884 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6886 pub property_order: Vec<FunctionPropertyKind>,
6887 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6889 pub environment: Vec<Expression>,
6890}
6891
6892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6894#[cfg_attr(feature = "bindings", derive(TS))]
6895pub struct FunctionSetOption {
6896 pub name: String,
6897 pub value: FunctionSetValue,
6898}
6899
6900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6902#[cfg_attr(feature = "bindings", derive(TS))]
6903pub enum FunctionSetValue {
6904 Value { value: String, use_to: bool },
6906 FromCurrent,
6908}
6909
6910#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6912#[cfg_attr(feature = "bindings", derive(TS))]
6913pub enum SqlDataAccess {
6914 NoSql,
6916 ContainsSql,
6918 ReadsSqlData,
6920 ModifiesSqlData,
6922}
6923
6924#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6926#[cfg_attr(feature = "bindings", derive(TS))]
6927pub enum FunctionPropertyKind {
6928 Set,
6930 As,
6932 Language,
6934 Determinism,
6936 NullInput,
6938 Security,
6940 SqlDataAccess,
6942 Options,
6944 Environment,
6946}
6947
6948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6950#[cfg_attr(feature = "bindings", derive(TS))]
6951pub struct FunctionParameter {
6952 pub name: Option<Identifier>,
6953 pub data_type: DataType,
6954 pub mode: Option<ParameterMode>,
6955 pub default: Option<Expression>,
6956 #[serde(default, skip_serializing_if = "Option::is_none")]
6958 pub mode_text: Option<String>,
6959}
6960
6961#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6963#[cfg_attr(feature = "bindings", derive(TS))]
6964pub enum ParameterMode {
6965 In,
6966 Out,
6967 InOut,
6968 Variadic,
6969}
6970
6971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6973#[cfg_attr(feature = "bindings", derive(TS))]
6974pub enum FunctionBody {
6975 Block(String),
6977 StringLiteral(String),
6979 Expression(Expression),
6981 External(String),
6983 Return(Expression),
6985 Statements(Vec<Expression>),
6987 DollarQuoted {
6990 content: String,
6991 tag: Option<String>,
6992 },
6993}
6994
6995#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6997#[cfg_attr(feature = "bindings", derive(TS))]
6998pub enum FunctionSecurity {
6999 Definer,
7000 Invoker,
7001 None,
7003}
7004
7005impl CreateFunction {
7006 pub fn new(name: impl Into<String>) -> Self {
7007 Self {
7008 name: TableRef::new(name),
7009 parameters: Vec::new(),
7010 return_type: None,
7011 body: None,
7012 or_replace: false,
7013 if_not_exists: false,
7014 temporary: false,
7015 language: None,
7016 deterministic: None,
7017 returns_null_on_null_input: None,
7018 security: None,
7019 has_parens: true,
7020 sql_data_access: None,
7021 returns_table_body: None,
7022 language_first: false,
7023 set_options: Vec::new(),
7024 strict: false,
7025 options: Vec::new(),
7026 is_table_function: false,
7027 property_order: Vec::new(),
7028 environment: Vec::new(),
7029 }
7030 }
7031}
7032
7033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7035#[cfg_attr(feature = "bindings", derive(TS))]
7036pub struct DropFunction {
7037 pub name: TableRef,
7038 pub parameters: Option<Vec<DataType>>,
7039 pub if_exists: bool,
7040 pub cascade: bool,
7041}
7042
7043impl DropFunction {
7044 pub fn new(name: impl Into<String>) -> Self {
7045 Self {
7046 name: TableRef::new(name),
7047 parameters: None,
7048 if_exists: false,
7049 cascade: false,
7050 }
7051 }
7052}
7053
7054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7056#[cfg_attr(feature = "bindings", derive(TS))]
7057pub struct CreateProcedure {
7058 pub name: TableRef,
7059 pub parameters: Vec<FunctionParameter>,
7060 pub body: Option<FunctionBody>,
7061 pub or_replace: bool,
7062 pub if_not_exists: bool,
7063 pub language: Option<String>,
7064 pub security: Option<FunctionSecurity>,
7065 #[serde(default)]
7067 pub return_type: Option<DataType>,
7068 #[serde(default)]
7070 pub execute_as: Option<String>,
7071 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7073 pub with_options: Vec<String>,
7074 #[serde(default = "default_true", skip_serializing_if = "is_true")]
7076 pub has_parens: bool,
7077 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
7079 pub use_proc_keyword: bool,
7080}
7081
7082impl CreateProcedure {
7083 pub fn new(name: impl Into<String>) -> Self {
7084 Self {
7085 name: TableRef::new(name),
7086 parameters: Vec::new(),
7087 body: None,
7088 or_replace: false,
7089 if_not_exists: false,
7090 language: None,
7091 security: None,
7092 return_type: None,
7093 execute_as: None,
7094 with_options: Vec::new(),
7095 has_parens: true,
7096 use_proc_keyword: false,
7097 }
7098 }
7099}
7100
7101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7103#[cfg_attr(feature = "bindings", derive(TS))]
7104pub struct DropProcedure {
7105 pub name: TableRef,
7106 pub parameters: Option<Vec<DataType>>,
7107 pub if_exists: bool,
7108 pub cascade: bool,
7109}
7110
7111impl DropProcedure {
7112 pub fn new(name: impl Into<String>) -> Self {
7113 Self {
7114 name: TableRef::new(name),
7115 parameters: None,
7116 if_exists: false,
7117 cascade: false,
7118 }
7119 }
7120}
7121
7122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7124#[cfg_attr(feature = "bindings", derive(TS))]
7125pub enum SeqPropKind {
7126 Start,
7127 Increment,
7128 Minvalue,
7129 Maxvalue,
7130 Cache,
7131 NoCache,
7132 Cycle,
7133 NoCycle,
7134 OwnedBy,
7135 Order,
7136 NoOrder,
7137 Comment,
7138 Sharing,
7140 Keep,
7142 NoKeep,
7144 Scale,
7146 NoScale,
7148 Shard,
7150 NoShard,
7152 Session,
7154 Global,
7156 NoCacheWord,
7158 NoCycleWord,
7160 NoMinvalueWord,
7162 NoMaxvalueWord,
7164}
7165
7166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7168#[cfg_attr(feature = "bindings", derive(TS))]
7169pub struct CreateSequence {
7170 pub name: TableRef,
7171 pub if_not_exists: bool,
7172 pub temporary: bool,
7173 #[serde(default)]
7174 pub or_replace: bool,
7175 #[serde(default, skip_serializing_if = "Option::is_none")]
7177 pub as_type: Option<DataType>,
7178 pub increment: Option<i64>,
7179 pub minvalue: Option<SequenceBound>,
7180 pub maxvalue: Option<SequenceBound>,
7181 pub start: Option<i64>,
7182 pub cache: Option<i64>,
7183 pub cycle: bool,
7184 pub owned_by: Option<TableRef>,
7185 #[serde(default)]
7187 pub owned_by_none: bool,
7188 #[serde(default)]
7190 pub order: Option<bool>,
7191 #[serde(default)]
7193 pub comment: Option<String>,
7194 #[serde(default, skip_serializing_if = "Option::is_none")]
7196 pub sharing: Option<String>,
7197 #[serde(default, skip_serializing_if = "Option::is_none")]
7199 pub scale_modifier: Option<String>,
7200 #[serde(default, skip_serializing_if = "Option::is_none")]
7202 pub shard_modifier: Option<String>,
7203 #[serde(default)]
7205 pub property_order: Vec<SeqPropKind>,
7206}
7207
7208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7210#[cfg_attr(feature = "bindings", derive(TS))]
7211pub enum SequenceBound {
7212 Value(i64),
7213 None,
7214}
7215
7216impl CreateSequence {
7217 pub fn new(name: impl Into<String>) -> Self {
7218 Self {
7219 name: TableRef::new(name),
7220 if_not_exists: false,
7221 temporary: false,
7222 or_replace: false,
7223 as_type: None,
7224 increment: None,
7225 minvalue: None,
7226 maxvalue: None,
7227 start: None,
7228 cache: None,
7229 cycle: false,
7230 owned_by: None,
7231 owned_by_none: false,
7232 order: None,
7233 comment: None,
7234 sharing: None,
7235 scale_modifier: None,
7236 shard_modifier: None,
7237 property_order: Vec::new(),
7238 }
7239 }
7240}
7241
7242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7244#[cfg_attr(feature = "bindings", derive(TS))]
7245pub struct DropSequence {
7246 pub name: TableRef,
7247 pub if_exists: bool,
7248 pub cascade: bool,
7249}
7250
7251impl DropSequence {
7252 pub fn new(name: impl Into<String>) -> Self {
7253 Self {
7254 name: TableRef::new(name),
7255 if_exists: false,
7256 cascade: false,
7257 }
7258 }
7259}
7260
7261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7263#[cfg_attr(feature = "bindings", derive(TS))]
7264pub struct AlterSequence {
7265 pub name: TableRef,
7266 pub if_exists: bool,
7267 pub increment: Option<i64>,
7268 pub minvalue: Option<SequenceBound>,
7269 pub maxvalue: Option<SequenceBound>,
7270 pub start: Option<i64>,
7271 pub restart: Option<Option<i64>>,
7272 pub cache: Option<i64>,
7273 pub cycle: Option<bool>,
7274 pub owned_by: Option<Option<TableRef>>,
7275}
7276
7277impl AlterSequence {
7278 pub fn new(name: impl Into<String>) -> Self {
7279 Self {
7280 name: TableRef::new(name),
7281 if_exists: false,
7282 increment: None,
7283 minvalue: None,
7284 maxvalue: None,
7285 start: None,
7286 restart: None,
7287 cache: None,
7288 cycle: None,
7289 owned_by: None,
7290 }
7291 }
7292}
7293
7294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7296#[cfg_attr(feature = "bindings", derive(TS))]
7297pub struct CreateTrigger {
7298 pub name: Identifier,
7299 pub table: TableRef,
7300 pub timing: TriggerTiming,
7301 pub events: Vec<TriggerEvent>,
7302 pub for_each: TriggerForEach,
7303 pub when: Option<Expression>,
7304 pub body: TriggerBody,
7305 pub or_replace: bool,
7306 pub constraint: bool,
7307 pub deferrable: Option<bool>,
7308 pub initially_deferred: Option<bool>,
7309 pub referencing: Option<TriggerReferencing>,
7310}
7311
7312#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7314#[cfg_attr(feature = "bindings", derive(TS))]
7315pub enum TriggerTiming {
7316 Before,
7317 After,
7318 InsteadOf,
7319}
7320
7321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7323#[cfg_attr(feature = "bindings", derive(TS))]
7324pub enum TriggerEvent {
7325 Insert,
7326 Update(Option<Vec<Identifier>>),
7327 Delete,
7328 Truncate,
7329}
7330
7331#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7333#[cfg_attr(feature = "bindings", derive(TS))]
7334pub enum TriggerForEach {
7335 Row,
7336 Statement,
7337}
7338
7339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7341#[cfg_attr(feature = "bindings", derive(TS))]
7342pub enum TriggerBody {
7343 Execute {
7345 function: TableRef,
7346 args: Vec<Expression>,
7347 },
7348 Block(String),
7350}
7351
7352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7354#[cfg_attr(feature = "bindings", derive(TS))]
7355pub struct TriggerReferencing {
7356 pub old_table: Option<Identifier>,
7357 pub new_table: Option<Identifier>,
7358 pub old_row: Option<Identifier>,
7359 pub new_row: Option<Identifier>,
7360}
7361
7362impl CreateTrigger {
7363 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
7364 Self {
7365 name: Identifier::new(name),
7366 table: TableRef::new(table),
7367 timing: TriggerTiming::Before,
7368 events: Vec::new(),
7369 for_each: TriggerForEach::Row,
7370 when: None,
7371 body: TriggerBody::Execute {
7372 function: TableRef::new(""),
7373 args: Vec::new(),
7374 },
7375 or_replace: false,
7376 constraint: false,
7377 deferrable: None,
7378 initially_deferred: None,
7379 referencing: None,
7380 }
7381 }
7382}
7383
7384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7386#[cfg_attr(feature = "bindings", derive(TS))]
7387pub struct DropTrigger {
7388 pub name: Identifier,
7389 pub table: Option<TableRef>,
7390 pub if_exists: bool,
7391 pub cascade: bool,
7392}
7393
7394impl DropTrigger {
7395 pub fn new(name: impl Into<String>) -> Self {
7396 Self {
7397 name: Identifier::new(name),
7398 table: None,
7399 if_exists: false,
7400 cascade: false,
7401 }
7402 }
7403}
7404
7405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7407#[cfg_attr(feature = "bindings", derive(TS))]
7408pub struct CreateType {
7409 pub name: TableRef,
7410 pub definition: TypeDefinition,
7411 pub if_not_exists: bool,
7412}
7413
7414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7416#[cfg_attr(feature = "bindings", derive(TS))]
7417pub enum TypeDefinition {
7418 Enum(Vec<String>),
7420 Composite(Vec<TypeAttribute>),
7422 Range {
7424 subtype: DataType,
7425 subtype_diff: Option<String>,
7426 canonical: Option<String>,
7427 },
7428 Base {
7430 input: String,
7431 output: String,
7432 internallength: Option<i32>,
7433 },
7434 Domain {
7436 base_type: DataType,
7437 default: Option<Expression>,
7438 constraints: Vec<DomainConstraint>,
7439 },
7440}
7441
7442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7444#[cfg_attr(feature = "bindings", derive(TS))]
7445pub struct TypeAttribute {
7446 pub name: Identifier,
7447 pub data_type: DataType,
7448 pub collate: Option<Identifier>,
7449}
7450
7451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7453#[cfg_attr(feature = "bindings", derive(TS))]
7454pub struct DomainConstraint {
7455 pub name: Option<Identifier>,
7456 pub check: Expression,
7457}
7458
7459impl CreateType {
7460 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
7461 Self {
7462 name: TableRef::new(name),
7463 definition: TypeDefinition::Enum(values),
7464 if_not_exists: false,
7465 }
7466 }
7467
7468 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
7469 Self {
7470 name: TableRef::new(name),
7471 definition: TypeDefinition::Composite(attributes),
7472 if_not_exists: false,
7473 }
7474 }
7475}
7476
7477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7479#[cfg_attr(feature = "bindings", derive(TS))]
7480pub struct DropType {
7481 pub name: TableRef,
7482 pub if_exists: bool,
7483 pub cascade: bool,
7484}
7485
7486impl DropType {
7487 pub fn new(name: impl Into<String>) -> Self {
7488 Self {
7489 name: TableRef::new(name),
7490 if_exists: false,
7491 cascade: false,
7492 }
7493 }
7494}
7495
7496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7498#[cfg_attr(feature = "bindings", derive(TS))]
7499pub struct Describe {
7500 pub target: Expression,
7502 pub extended: bool,
7504 pub formatted: bool,
7506 #[serde(default)]
7508 pub kind: Option<String>,
7509 #[serde(default)]
7511 pub properties: Vec<(String, String)>,
7512 #[serde(default, skip_serializing_if = "Option::is_none")]
7514 pub style: Option<String>,
7515 #[serde(default)]
7517 pub partition: Option<Box<Expression>>,
7518 #[serde(default)]
7520 pub leading_comments: Vec<String>,
7521 #[serde(default)]
7523 pub as_json: bool,
7524}
7525
7526impl Describe {
7527 pub fn new(target: Expression) -> Self {
7528 Self {
7529 target,
7530 extended: false,
7531 formatted: false,
7532 kind: None,
7533 properties: Vec::new(),
7534 style: None,
7535 partition: None,
7536 leading_comments: Vec::new(),
7537 as_json: false,
7538 }
7539 }
7540}
7541
7542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7544#[cfg_attr(feature = "bindings", derive(TS))]
7545pub struct Show {
7546 pub this: String,
7548 #[serde(default)]
7550 pub terse: bool,
7551 #[serde(default)]
7553 pub history: bool,
7554 pub like: Option<Expression>,
7556 pub scope_kind: Option<String>,
7558 pub scope: Option<Expression>,
7560 pub starts_with: Option<Expression>,
7562 pub limit: Option<Box<Limit>>,
7564 pub from: Option<Expression>,
7566 #[serde(default, skip_serializing_if = "Option::is_none")]
7568 pub where_clause: Option<Expression>,
7569 #[serde(default, skip_serializing_if = "Option::is_none")]
7571 pub for_target: Option<Expression>,
7572 #[serde(default, skip_serializing_if = "Option::is_none")]
7574 pub db: Option<Expression>,
7575 #[serde(default, skip_serializing_if = "Option::is_none")]
7577 pub target: Option<Expression>,
7578 #[serde(default, skip_serializing_if = "Option::is_none")]
7580 pub mutex: Option<bool>,
7581 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7583 pub privileges: Vec<String>,
7584}
7585
7586impl Show {
7587 pub fn new(this: impl Into<String>) -> Self {
7588 Self {
7589 this: this.into(),
7590 terse: false,
7591 history: false,
7592 like: None,
7593 scope_kind: None,
7594 scope: None,
7595 starts_with: None,
7596 limit: None,
7597 from: None,
7598 where_clause: None,
7599 for_target: None,
7600 db: None,
7601 target: None,
7602 mutex: None,
7603 privileges: Vec::new(),
7604 }
7605 }
7606}
7607
7608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7613#[cfg_attr(feature = "bindings", derive(TS))]
7614pub struct Paren {
7615 pub this: Expression,
7617 #[serde(default)]
7618 pub trailing_comments: Vec<String>,
7619}
7620
7621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7623#[cfg_attr(feature = "bindings", derive(TS))]
7624pub struct Annotated {
7625 pub this: Expression,
7626 pub trailing_comments: Vec<String>,
7627}
7628
7629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7634#[cfg_attr(feature = "bindings", derive(TS))]
7635pub struct Refresh {
7636 pub this: Box<Expression>,
7637 pub kind: String,
7638}
7639
7640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7642#[cfg_attr(feature = "bindings", derive(TS))]
7643pub struct LockingStatement {
7644 pub this: Box<Expression>,
7645 pub expression: Box<Expression>,
7646}
7647
7648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7650#[cfg_attr(feature = "bindings", derive(TS))]
7651pub struct SequenceProperties {
7652 #[serde(default)]
7653 pub increment: Option<Box<Expression>>,
7654 #[serde(default)]
7655 pub minvalue: Option<Box<Expression>>,
7656 #[serde(default)]
7657 pub maxvalue: Option<Box<Expression>>,
7658 #[serde(default)]
7659 pub cache: Option<Box<Expression>>,
7660 #[serde(default)]
7661 pub start: Option<Box<Expression>>,
7662 #[serde(default)]
7663 pub owned: Option<Box<Expression>>,
7664 #[serde(default)]
7665 pub options: Vec<Expression>,
7666}
7667
7668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7670#[cfg_attr(feature = "bindings", derive(TS))]
7671pub struct TruncateTable {
7672 #[serde(default)]
7673 pub expressions: Vec<Expression>,
7674 #[serde(default)]
7675 pub is_database: Option<Box<Expression>>,
7676 #[serde(default)]
7677 pub exists: bool,
7678 #[serde(default)]
7679 pub only: Option<Box<Expression>>,
7680 #[serde(default)]
7681 pub cluster: Option<Box<Expression>>,
7682 #[serde(default)]
7683 pub identity: Option<Box<Expression>>,
7684 #[serde(default)]
7685 pub option: Option<Box<Expression>>,
7686 #[serde(default)]
7687 pub partition: Option<Box<Expression>>,
7688}
7689
7690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7692#[cfg_attr(feature = "bindings", derive(TS))]
7693pub struct Clone {
7694 pub this: Box<Expression>,
7695 #[serde(default)]
7696 pub shallow: Option<Box<Expression>>,
7697 #[serde(default)]
7698 pub copy: Option<Box<Expression>>,
7699}
7700
7701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7703#[cfg_attr(feature = "bindings", derive(TS))]
7704pub struct Attach {
7705 pub this: Box<Expression>,
7706 #[serde(default)]
7707 pub exists: bool,
7708 #[serde(default)]
7709 pub expressions: Vec<Expression>,
7710}
7711
7712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7714#[cfg_attr(feature = "bindings", derive(TS))]
7715pub struct Detach {
7716 pub this: Box<Expression>,
7717 #[serde(default)]
7718 pub exists: bool,
7719}
7720
7721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7723#[cfg_attr(feature = "bindings", derive(TS))]
7724pub struct Install {
7725 pub this: Box<Expression>,
7726 #[serde(default)]
7727 pub from_: Option<Box<Expression>>,
7728 #[serde(default)]
7729 pub force: Option<Box<Expression>>,
7730}
7731
7732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7734#[cfg_attr(feature = "bindings", derive(TS))]
7735pub struct Summarize {
7736 pub this: Box<Expression>,
7737 #[serde(default)]
7738 pub table: Option<Box<Expression>>,
7739}
7740
7741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7743#[cfg_attr(feature = "bindings", derive(TS))]
7744pub struct Declare {
7745 #[serde(default)]
7746 pub expressions: Vec<Expression>,
7747}
7748
7749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7751#[cfg_attr(feature = "bindings", derive(TS))]
7752pub struct DeclareItem {
7753 pub this: Box<Expression>,
7754 #[serde(default)]
7755 pub kind: Option<String>,
7756 #[serde(default)]
7757 pub default: Option<Box<Expression>>,
7758 #[serde(default)]
7759 pub has_as: bool,
7760 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7762 pub additional_names: Vec<Expression>,
7763}
7764
7765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7767#[cfg_attr(feature = "bindings", derive(TS))]
7768pub struct Set {
7769 #[serde(default)]
7770 pub expressions: Vec<Expression>,
7771 #[serde(default)]
7772 pub unset: Option<Box<Expression>>,
7773 #[serde(default)]
7774 pub tag: Option<Box<Expression>>,
7775}
7776
7777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7779#[cfg_attr(feature = "bindings", derive(TS))]
7780pub struct Heredoc {
7781 pub this: Box<Expression>,
7782 #[serde(default)]
7783 pub tag: Option<Box<Expression>>,
7784}
7785
7786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7788#[cfg_attr(feature = "bindings", derive(TS))]
7789pub struct QueryBand {
7790 pub this: Box<Expression>,
7791 #[serde(default)]
7792 pub scope: Option<Box<Expression>>,
7793 #[serde(default)]
7794 pub update: Option<Box<Expression>>,
7795}
7796
7797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7799#[cfg_attr(feature = "bindings", derive(TS))]
7800pub struct UserDefinedFunction {
7801 pub this: Box<Expression>,
7802 #[serde(default)]
7803 pub expressions: Vec<Expression>,
7804 #[serde(default)]
7805 pub wrapped: Option<Box<Expression>>,
7806}
7807
7808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7810#[cfg_attr(feature = "bindings", derive(TS))]
7811pub struct RecursiveWithSearch {
7812 pub kind: String,
7813 pub this: Box<Expression>,
7814 pub expression: Box<Expression>,
7815 #[serde(default)]
7816 pub using: Option<Box<Expression>>,
7817}
7818
7819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7821#[cfg_attr(feature = "bindings", derive(TS))]
7822pub struct ProjectionDef {
7823 pub this: Box<Expression>,
7824 pub expression: Box<Expression>,
7825}
7826
7827#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7829#[cfg_attr(feature = "bindings", derive(TS))]
7830pub struct TableAlias {
7831 #[serde(default)]
7832 pub this: Option<Box<Expression>>,
7833 #[serde(default)]
7834 pub columns: Vec<Expression>,
7835}
7836
7837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7839#[cfg_attr(feature = "bindings", derive(TS))]
7840pub struct ByteString {
7841 pub this: Box<Expression>,
7842 #[serde(default)]
7843 pub is_bytes: Option<Box<Expression>>,
7844}
7845
7846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7849#[cfg_attr(feature = "bindings", derive(TS))]
7850pub struct HexStringExpr {
7851 pub this: Box<Expression>,
7852 #[serde(default)]
7853 pub is_integer: Option<bool>,
7854}
7855
7856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7858#[cfg_attr(feature = "bindings", derive(TS))]
7859pub struct UnicodeString {
7860 pub this: Box<Expression>,
7861 #[serde(default)]
7862 pub escape: Option<Box<Expression>>,
7863}
7864
7865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7867#[cfg_attr(feature = "bindings", derive(TS))]
7868pub struct AlterColumn {
7869 pub this: Box<Expression>,
7870 #[serde(default)]
7871 pub dtype: Option<Box<Expression>>,
7872 #[serde(default)]
7873 pub collate: Option<Box<Expression>>,
7874 #[serde(default)]
7875 pub using: Option<Box<Expression>>,
7876 #[serde(default)]
7877 pub default: Option<Box<Expression>>,
7878 #[serde(default)]
7879 pub drop: Option<Box<Expression>>,
7880 #[serde(default)]
7881 pub comment: Option<Box<Expression>>,
7882 #[serde(default)]
7883 pub allow_null: Option<Box<Expression>>,
7884 #[serde(default)]
7885 pub visible: Option<Box<Expression>>,
7886 #[serde(default)]
7887 pub rename_to: Option<Box<Expression>>,
7888}
7889
7890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7892#[cfg_attr(feature = "bindings", derive(TS))]
7893pub struct AlterSortKey {
7894 #[serde(default)]
7895 pub this: Option<Box<Expression>>,
7896 #[serde(default)]
7897 pub expressions: Vec<Expression>,
7898 #[serde(default)]
7899 pub compound: Option<Box<Expression>>,
7900}
7901
7902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7904#[cfg_attr(feature = "bindings", derive(TS))]
7905pub struct AlterSet {
7906 #[serde(default)]
7907 pub expressions: Vec<Expression>,
7908 #[serde(default)]
7909 pub option: Option<Box<Expression>>,
7910 #[serde(default)]
7911 pub tablespace: Option<Box<Expression>>,
7912 #[serde(default)]
7913 pub access_method: Option<Box<Expression>>,
7914 #[serde(default)]
7915 pub file_format: Option<Box<Expression>>,
7916 #[serde(default)]
7917 pub copy_options: Option<Box<Expression>>,
7918 #[serde(default)]
7919 pub tag: Option<Box<Expression>>,
7920 #[serde(default)]
7921 pub location: Option<Box<Expression>>,
7922 #[serde(default)]
7923 pub serde: Option<Box<Expression>>,
7924}
7925
7926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7928#[cfg_attr(feature = "bindings", derive(TS))]
7929pub struct RenameColumn {
7930 pub this: Box<Expression>,
7931 #[serde(default)]
7932 pub to: Option<Box<Expression>>,
7933 #[serde(default)]
7934 pub exists: bool,
7935}
7936
7937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7939#[cfg_attr(feature = "bindings", derive(TS))]
7940pub struct Comprehension {
7941 pub this: Box<Expression>,
7942 pub expression: Box<Expression>,
7943 #[serde(default)]
7944 pub position: Option<Box<Expression>>,
7945 #[serde(default)]
7946 pub iterator: Option<Box<Expression>>,
7947 #[serde(default)]
7948 pub condition: Option<Box<Expression>>,
7949}
7950
7951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7953#[cfg_attr(feature = "bindings", derive(TS))]
7954pub struct MergeTreeTTLAction {
7955 pub this: Box<Expression>,
7956 #[serde(default)]
7957 pub delete: Option<Box<Expression>>,
7958 #[serde(default)]
7959 pub recompress: Option<Box<Expression>>,
7960 #[serde(default)]
7961 pub to_disk: Option<Box<Expression>>,
7962 #[serde(default)]
7963 pub to_volume: Option<Box<Expression>>,
7964}
7965
7966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7968#[cfg_attr(feature = "bindings", derive(TS))]
7969pub struct MergeTreeTTL {
7970 #[serde(default)]
7971 pub expressions: Vec<Expression>,
7972 #[serde(default)]
7973 pub where_: Option<Box<Expression>>,
7974 #[serde(default)]
7975 pub group: Option<Box<Expression>>,
7976 #[serde(default)]
7977 pub aggregates: Option<Box<Expression>>,
7978}
7979
7980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7982#[cfg_attr(feature = "bindings", derive(TS))]
7983pub struct IndexConstraintOption {
7984 #[serde(default)]
7985 pub key_block_size: Option<Box<Expression>>,
7986 #[serde(default)]
7987 pub using: Option<Box<Expression>>,
7988 #[serde(default)]
7989 pub parser: Option<Box<Expression>>,
7990 #[serde(default)]
7991 pub comment: Option<Box<Expression>>,
7992 #[serde(default)]
7993 pub visible: Option<Box<Expression>>,
7994 #[serde(default)]
7995 pub engine_attr: Option<Box<Expression>>,
7996 #[serde(default)]
7997 pub secondary_engine_attr: Option<Box<Expression>>,
7998}
7999
8000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8002#[cfg_attr(feature = "bindings", derive(TS))]
8003pub struct PeriodForSystemTimeConstraint {
8004 pub this: Box<Expression>,
8005 pub expression: Box<Expression>,
8006}
8007
8008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8010#[cfg_attr(feature = "bindings", derive(TS))]
8011pub struct CaseSpecificColumnConstraint {
8012 #[serde(default)]
8013 pub not_: Option<Box<Expression>>,
8014}
8015
8016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8018#[cfg_attr(feature = "bindings", derive(TS))]
8019pub struct CharacterSetColumnConstraint {
8020 pub this: Box<Expression>,
8021}
8022
8023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8025#[cfg_attr(feature = "bindings", derive(TS))]
8026pub struct CheckColumnConstraint {
8027 pub this: Box<Expression>,
8028 #[serde(default)]
8029 pub enforced: Option<Box<Expression>>,
8030}
8031
8032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8034#[cfg_attr(feature = "bindings", derive(TS))]
8035pub struct CompressColumnConstraint {
8036 #[serde(default)]
8037 pub this: Option<Box<Expression>>,
8038}
8039
8040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8042#[cfg_attr(feature = "bindings", derive(TS))]
8043pub struct DateFormatColumnConstraint {
8044 pub this: Box<Expression>,
8045}
8046
8047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8049#[cfg_attr(feature = "bindings", derive(TS))]
8050pub struct EphemeralColumnConstraint {
8051 #[serde(default)]
8052 pub this: Option<Box<Expression>>,
8053}
8054
8055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8057#[cfg_attr(feature = "bindings", derive(TS))]
8058pub struct WithOperator {
8059 pub this: Box<Expression>,
8060 pub op: String,
8061}
8062
8063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8065#[cfg_attr(feature = "bindings", derive(TS))]
8066pub struct GeneratedAsIdentityColumnConstraint {
8067 #[serde(default)]
8068 pub this: Option<Box<Expression>>,
8069 #[serde(default)]
8070 pub expression: Option<Box<Expression>>,
8071 #[serde(default)]
8072 pub on_null: Option<Box<Expression>>,
8073 #[serde(default)]
8074 pub start: Option<Box<Expression>>,
8075 #[serde(default)]
8076 pub increment: Option<Box<Expression>>,
8077 #[serde(default)]
8078 pub minvalue: Option<Box<Expression>>,
8079 #[serde(default)]
8080 pub maxvalue: Option<Box<Expression>>,
8081 #[serde(default)]
8082 pub cycle: Option<Box<Expression>>,
8083 #[serde(default)]
8084 pub order: Option<Box<Expression>>,
8085}
8086
8087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8090#[cfg_attr(feature = "bindings", derive(TS))]
8091pub struct AutoIncrementColumnConstraint;
8092
8093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8095#[cfg_attr(feature = "bindings", derive(TS))]
8096pub struct CommentColumnConstraint;
8097
8098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8100#[cfg_attr(feature = "bindings", derive(TS))]
8101pub struct GeneratedAsRowColumnConstraint {
8102 #[serde(default)]
8103 pub start: Option<Box<Expression>>,
8104 #[serde(default)]
8105 pub hidden: Option<Box<Expression>>,
8106}
8107
8108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8110#[cfg_attr(feature = "bindings", derive(TS))]
8111pub struct IndexColumnConstraint {
8112 #[serde(default)]
8113 pub this: Option<Box<Expression>>,
8114 #[serde(default)]
8115 pub expressions: Vec<Expression>,
8116 #[serde(default)]
8117 pub kind: Option<String>,
8118 #[serde(default)]
8119 pub index_type: Option<Box<Expression>>,
8120 #[serde(default)]
8121 pub options: Vec<Expression>,
8122 #[serde(default)]
8123 pub expression: Option<Box<Expression>>,
8124 #[serde(default)]
8125 pub granularity: Option<Box<Expression>>,
8126}
8127
8128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8130#[cfg_attr(feature = "bindings", derive(TS))]
8131pub struct MaskingPolicyColumnConstraint {
8132 pub this: Box<Expression>,
8133 #[serde(default)]
8134 pub expressions: Vec<Expression>,
8135}
8136
8137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8139#[cfg_attr(feature = "bindings", derive(TS))]
8140pub struct NotNullColumnConstraint {
8141 #[serde(default)]
8142 pub allow_null: Option<Box<Expression>>,
8143}
8144
8145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8147#[cfg_attr(feature = "bindings", derive(TS))]
8148pub struct DefaultColumnConstraint {
8149 pub this: Box<Expression>,
8150}
8151
8152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8154#[cfg_attr(feature = "bindings", derive(TS))]
8155pub struct PrimaryKeyColumnConstraint {
8156 #[serde(default)]
8157 pub desc: Option<Box<Expression>>,
8158 #[serde(default)]
8159 pub options: Vec<Expression>,
8160}
8161
8162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8164#[cfg_attr(feature = "bindings", derive(TS))]
8165pub struct UniqueColumnConstraint {
8166 #[serde(default)]
8167 pub this: Option<Box<Expression>>,
8168 #[serde(default)]
8169 pub index_type: Option<Box<Expression>>,
8170 #[serde(default)]
8171 pub on_conflict: Option<Box<Expression>>,
8172 #[serde(default)]
8173 pub nulls: Option<Box<Expression>>,
8174 #[serde(default)]
8175 pub options: Vec<Expression>,
8176}
8177
8178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8180#[cfg_attr(feature = "bindings", derive(TS))]
8181pub struct WatermarkColumnConstraint {
8182 pub this: Box<Expression>,
8183 pub expression: Box<Expression>,
8184}
8185
8186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8188#[cfg_attr(feature = "bindings", derive(TS))]
8189pub struct ComputedColumnConstraint {
8190 pub this: Box<Expression>,
8191 #[serde(default)]
8192 pub persisted: Option<Box<Expression>>,
8193 #[serde(default)]
8194 pub not_null: Option<Box<Expression>>,
8195 #[serde(default)]
8196 pub data_type: Option<Box<Expression>>,
8197}
8198
8199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8201#[cfg_attr(feature = "bindings", derive(TS))]
8202pub struct InOutColumnConstraint {
8203 #[serde(default)]
8204 pub input_: Option<Box<Expression>>,
8205 #[serde(default)]
8206 pub output: Option<Box<Expression>>,
8207}
8208
8209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8211#[cfg_attr(feature = "bindings", derive(TS))]
8212pub struct PathColumnConstraint {
8213 pub this: Box<Expression>,
8214}
8215
8216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8218#[cfg_attr(feature = "bindings", derive(TS))]
8219pub struct Constraint {
8220 pub this: Box<Expression>,
8221 #[serde(default)]
8222 pub expressions: Vec<Expression>,
8223}
8224
8225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8227#[cfg_attr(feature = "bindings", derive(TS))]
8228pub struct Export {
8229 pub this: Box<Expression>,
8230 #[serde(default)]
8231 pub connection: Option<Box<Expression>>,
8232 #[serde(default)]
8233 pub options: Vec<Expression>,
8234}
8235
8236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8238#[cfg_attr(feature = "bindings", derive(TS))]
8239pub struct Filter {
8240 pub this: Box<Expression>,
8241 pub expression: Box<Expression>,
8242}
8243
8244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8246#[cfg_attr(feature = "bindings", derive(TS))]
8247pub struct Changes {
8248 #[serde(default)]
8249 pub information: Option<Box<Expression>>,
8250 #[serde(default)]
8251 pub at_before: Option<Box<Expression>>,
8252 #[serde(default)]
8253 pub end: Option<Box<Expression>>,
8254}
8255
8256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8258#[cfg_attr(feature = "bindings", derive(TS))]
8259pub struct Directory {
8260 pub this: Box<Expression>,
8261 #[serde(default)]
8262 pub local: Option<Box<Expression>>,
8263 #[serde(default)]
8264 pub row_format: Option<Box<Expression>>,
8265}
8266
8267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8269#[cfg_attr(feature = "bindings", derive(TS))]
8270pub struct ForeignKey {
8271 #[serde(default)]
8272 pub expressions: Vec<Expression>,
8273 #[serde(default)]
8274 pub reference: Option<Box<Expression>>,
8275 #[serde(default)]
8276 pub delete: Option<Box<Expression>>,
8277 #[serde(default)]
8278 pub update: Option<Box<Expression>>,
8279 #[serde(default)]
8280 pub options: Vec<Expression>,
8281}
8282
8283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8285#[cfg_attr(feature = "bindings", derive(TS))]
8286pub struct ColumnPrefix {
8287 pub this: Box<Expression>,
8288 pub expression: Box<Expression>,
8289}
8290
8291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8293#[cfg_attr(feature = "bindings", derive(TS))]
8294pub struct PrimaryKey {
8295 #[serde(default)]
8296 pub this: Option<Box<Expression>>,
8297 #[serde(default)]
8298 pub expressions: Vec<Expression>,
8299 #[serde(default)]
8300 pub options: Vec<Expression>,
8301 #[serde(default)]
8302 pub include: Option<Box<Expression>>,
8303}
8304
8305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8307#[cfg_attr(feature = "bindings", derive(TS))]
8308pub struct IntoClause {
8309 #[serde(default)]
8310 pub this: Option<Box<Expression>>,
8311 #[serde(default)]
8312 pub temporary: bool,
8313 #[serde(default)]
8314 pub unlogged: Option<Box<Expression>>,
8315 #[serde(default)]
8316 pub bulk_collect: Option<Box<Expression>>,
8317 #[serde(default)]
8318 pub expressions: Vec<Expression>,
8319}
8320
8321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8323#[cfg_attr(feature = "bindings", derive(TS))]
8324pub struct JoinHint {
8325 pub this: Box<Expression>,
8326 #[serde(default)]
8327 pub expressions: Vec<Expression>,
8328}
8329
8330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8332#[cfg_attr(feature = "bindings", derive(TS))]
8333pub struct Opclass {
8334 pub this: Box<Expression>,
8335 pub expression: Box<Expression>,
8336}
8337
8338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8340#[cfg_attr(feature = "bindings", derive(TS))]
8341pub struct Index {
8342 #[serde(default)]
8343 pub this: Option<Box<Expression>>,
8344 #[serde(default)]
8345 pub table: Option<Box<Expression>>,
8346 #[serde(default)]
8347 pub unique: bool,
8348 #[serde(default)]
8349 pub primary: Option<Box<Expression>>,
8350 #[serde(default)]
8351 pub amp: Option<Box<Expression>>,
8352 #[serde(default)]
8353 pub params: Vec<Expression>,
8354}
8355
8356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8358#[cfg_attr(feature = "bindings", derive(TS))]
8359pub struct IndexParameters {
8360 #[serde(default)]
8361 pub using: Option<Box<Expression>>,
8362 #[serde(default)]
8363 pub include: Option<Box<Expression>>,
8364 #[serde(default)]
8365 pub columns: Vec<Expression>,
8366 #[serde(default)]
8367 pub with_storage: Option<Box<Expression>>,
8368 #[serde(default)]
8369 pub partition_by: Option<Box<Expression>>,
8370 #[serde(default)]
8371 pub tablespace: Option<Box<Expression>>,
8372 #[serde(default)]
8373 pub where_: Option<Box<Expression>>,
8374 #[serde(default)]
8375 pub on: Option<Box<Expression>>,
8376}
8377
8378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8380#[cfg_attr(feature = "bindings", derive(TS))]
8381pub struct ConditionalInsert {
8382 pub this: Box<Expression>,
8383 #[serde(default)]
8384 pub expression: Option<Box<Expression>>,
8385 #[serde(default)]
8386 pub else_: Option<Box<Expression>>,
8387}
8388
8389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8391#[cfg_attr(feature = "bindings", derive(TS))]
8392pub struct MultitableInserts {
8393 #[serde(default)]
8394 pub expressions: Vec<Expression>,
8395 pub kind: String,
8396 #[serde(default)]
8397 pub source: Option<Box<Expression>>,
8398 #[serde(default)]
8400 pub leading_comments: Vec<String>,
8401}
8402
8403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8405#[cfg_attr(feature = "bindings", derive(TS))]
8406pub struct OnConflict {
8407 #[serde(default)]
8408 pub duplicate: Option<Box<Expression>>,
8409 #[serde(default)]
8410 pub expressions: Vec<Expression>,
8411 #[serde(default)]
8412 pub action: Option<Box<Expression>>,
8413 #[serde(default)]
8414 pub conflict_keys: Option<Box<Expression>>,
8415 #[serde(default)]
8416 pub index_predicate: Option<Box<Expression>>,
8417 #[serde(default)]
8418 pub constraint: Option<Box<Expression>>,
8419 #[serde(default)]
8420 pub where_: Option<Box<Expression>>,
8421}
8422
8423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8425#[cfg_attr(feature = "bindings", derive(TS))]
8426pub struct OnCondition {
8427 #[serde(default)]
8428 pub error: Option<Box<Expression>>,
8429 #[serde(default)]
8430 pub empty: Option<Box<Expression>>,
8431 #[serde(default)]
8432 pub null: Option<Box<Expression>>,
8433}
8434
8435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8437#[cfg_attr(feature = "bindings", derive(TS))]
8438pub struct Returning {
8439 #[serde(default)]
8440 pub expressions: Vec<Expression>,
8441 #[serde(default)]
8442 pub into: Option<Box<Expression>>,
8443}
8444
8445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8447#[cfg_attr(feature = "bindings", derive(TS))]
8448pub struct Introducer {
8449 pub this: Box<Expression>,
8450 pub expression: Box<Expression>,
8451}
8452
8453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8455#[cfg_attr(feature = "bindings", derive(TS))]
8456pub struct PartitionRange {
8457 pub this: Box<Expression>,
8458 #[serde(default)]
8459 pub expression: Option<Box<Expression>>,
8460 #[serde(default)]
8461 pub expressions: Vec<Expression>,
8462}
8463
8464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8466#[cfg_attr(feature = "bindings", derive(TS))]
8467pub struct Group {
8468 #[serde(default)]
8469 pub expressions: Vec<Expression>,
8470 #[serde(default)]
8471 pub grouping_sets: Option<Box<Expression>>,
8472 #[serde(default)]
8473 pub cube: Option<Box<Expression>>,
8474 #[serde(default)]
8475 pub rollup: Option<Box<Expression>>,
8476 #[serde(default)]
8477 pub totals: Option<Box<Expression>>,
8478 #[serde(default)]
8480 pub all: Option<bool>,
8481}
8482
8483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8485#[cfg_attr(feature = "bindings", derive(TS))]
8486pub struct Cube {
8487 #[serde(default)]
8488 pub expressions: Vec<Expression>,
8489}
8490
8491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8493#[cfg_attr(feature = "bindings", derive(TS))]
8494pub struct Rollup {
8495 #[serde(default)]
8496 pub expressions: Vec<Expression>,
8497}
8498
8499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8501#[cfg_attr(feature = "bindings", derive(TS))]
8502pub struct GroupingSets {
8503 #[serde(default)]
8504 pub expressions: Vec<Expression>,
8505}
8506
8507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8509#[cfg_attr(feature = "bindings", derive(TS))]
8510pub struct LimitOptions {
8511 #[serde(default)]
8512 pub percent: Option<Box<Expression>>,
8513 #[serde(default)]
8514 pub rows: Option<Box<Expression>>,
8515 #[serde(default)]
8516 pub with_ties: Option<Box<Expression>>,
8517}
8518
8519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8521#[cfg_attr(feature = "bindings", derive(TS))]
8522pub struct Lateral {
8523 pub this: Box<Expression>,
8524 #[serde(default)]
8525 pub view: Option<Box<Expression>>,
8526 #[serde(default)]
8527 pub outer: Option<Box<Expression>>,
8528 #[serde(default)]
8529 pub alias: Option<String>,
8530 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8532 pub alias_quoted: bool,
8533 #[serde(default)]
8534 pub cross_apply: Option<Box<Expression>>,
8535 #[serde(default)]
8536 pub ordinality: Option<Box<Expression>>,
8537 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8539 pub column_aliases: Vec<String>,
8540}
8541
8542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8544#[cfg_attr(feature = "bindings", derive(TS))]
8545pub struct TableFromRows {
8546 pub this: Box<Expression>,
8547 #[serde(default)]
8548 pub alias: Option<String>,
8549 #[serde(default)]
8550 pub joins: Vec<Expression>,
8551 #[serde(default)]
8552 pub pivots: Option<Box<Expression>>,
8553 #[serde(default)]
8554 pub sample: Option<Box<Expression>>,
8555}
8556
8557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8560#[cfg_attr(feature = "bindings", derive(TS))]
8561pub struct RowsFrom {
8562 pub expressions: Vec<Expression>,
8564 #[serde(default)]
8566 pub ordinality: bool,
8567 #[serde(default)]
8569 pub alias: Option<Box<Expression>>,
8570}
8571
8572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8574#[cfg_attr(feature = "bindings", derive(TS))]
8575pub struct WithFill {
8576 #[serde(default)]
8577 pub from_: Option<Box<Expression>>,
8578 #[serde(default)]
8579 pub to: Option<Box<Expression>>,
8580 #[serde(default)]
8581 pub step: Option<Box<Expression>>,
8582 #[serde(default)]
8583 pub staleness: Option<Box<Expression>>,
8584 #[serde(default)]
8585 pub interpolate: Option<Box<Expression>>,
8586}
8587
8588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8590#[cfg_attr(feature = "bindings", derive(TS))]
8591pub struct Property {
8592 pub this: Box<Expression>,
8593 #[serde(default)]
8594 pub value: Option<Box<Expression>>,
8595}
8596
8597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8599#[cfg_attr(feature = "bindings", derive(TS))]
8600pub struct GrantPrivilege {
8601 pub this: Box<Expression>,
8602 #[serde(default)]
8603 pub expressions: Vec<Expression>,
8604}
8605
8606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8608#[cfg_attr(feature = "bindings", derive(TS))]
8609pub struct AllowedValuesProperty {
8610 #[serde(default)]
8611 pub expressions: Vec<Expression>,
8612}
8613
8614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8616#[cfg_attr(feature = "bindings", derive(TS))]
8617pub struct AlgorithmProperty {
8618 pub this: Box<Expression>,
8619}
8620
8621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8623#[cfg_attr(feature = "bindings", derive(TS))]
8624pub struct AutoIncrementProperty {
8625 pub this: Box<Expression>,
8626}
8627
8628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8630#[cfg_attr(feature = "bindings", derive(TS))]
8631pub struct AutoRefreshProperty {
8632 pub this: Box<Expression>,
8633}
8634
8635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8637#[cfg_attr(feature = "bindings", derive(TS))]
8638pub struct BackupProperty {
8639 pub this: Box<Expression>,
8640}
8641
8642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8644#[cfg_attr(feature = "bindings", derive(TS))]
8645pub struct BuildProperty {
8646 pub this: Box<Expression>,
8647}
8648
8649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8651#[cfg_attr(feature = "bindings", derive(TS))]
8652pub struct BlockCompressionProperty {
8653 #[serde(default)]
8654 pub autotemp: Option<Box<Expression>>,
8655 #[serde(default)]
8656 pub always: Option<Box<Expression>>,
8657 #[serde(default)]
8658 pub default: Option<Box<Expression>>,
8659 #[serde(default)]
8660 pub manual: Option<Box<Expression>>,
8661 #[serde(default)]
8662 pub never: Option<Box<Expression>>,
8663}
8664
8665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8667#[cfg_attr(feature = "bindings", derive(TS))]
8668pub struct CharacterSetProperty {
8669 pub this: Box<Expression>,
8670 #[serde(default)]
8671 pub default: Option<Box<Expression>>,
8672}
8673
8674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8676#[cfg_attr(feature = "bindings", derive(TS))]
8677pub struct ChecksumProperty {
8678 #[serde(default)]
8679 pub on: Option<Box<Expression>>,
8680 #[serde(default)]
8681 pub default: Option<Box<Expression>>,
8682}
8683
8684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8686#[cfg_attr(feature = "bindings", derive(TS))]
8687pub struct CollateProperty {
8688 pub this: Box<Expression>,
8689 #[serde(default)]
8690 pub default: Option<Box<Expression>>,
8691}
8692
8693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8695#[cfg_attr(feature = "bindings", derive(TS))]
8696pub struct DataBlocksizeProperty {
8697 #[serde(default)]
8698 pub size: Option<i64>,
8699 #[serde(default)]
8700 pub units: Option<Box<Expression>>,
8701 #[serde(default)]
8702 pub minimum: Option<Box<Expression>>,
8703 #[serde(default)]
8704 pub maximum: Option<Box<Expression>>,
8705 #[serde(default)]
8706 pub default: Option<Box<Expression>>,
8707}
8708
8709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8711#[cfg_attr(feature = "bindings", derive(TS))]
8712pub struct DataDeletionProperty {
8713 pub on: Box<Expression>,
8714 #[serde(default)]
8715 pub filter_column: Option<Box<Expression>>,
8716 #[serde(default)]
8717 pub retention_period: Option<Box<Expression>>,
8718}
8719
8720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8722#[cfg_attr(feature = "bindings", derive(TS))]
8723pub struct DefinerProperty {
8724 pub this: Box<Expression>,
8725}
8726
8727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8729#[cfg_attr(feature = "bindings", derive(TS))]
8730pub struct DistKeyProperty {
8731 pub this: Box<Expression>,
8732}
8733
8734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8736#[cfg_attr(feature = "bindings", derive(TS))]
8737pub struct DistributedByProperty {
8738 #[serde(default)]
8739 pub expressions: Vec<Expression>,
8740 pub kind: String,
8741 #[serde(default)]
8742 pub buckets: Option<Box<Expression>>,
8743 #[serde(default)]
8744 pub order: Option<Box<Expression>>,
8745}
8746
8747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8749#[cfg_attr(feature = "bindings", derive(TS))]
8750pub struct DistStyleProperty {
8751 pub this: Box<Expression>,
8752}
8753
8754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8756#[cfg_attr(feature = "bindings", derive(TS))]
8757pub struct DuplicateKeyProperty {
8758 #[serde(default)]
8759 pub expressions: Vec<Expression>,
8760}
8761
8762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8764#[cfg_attr(feature = "bindings", derive(TS))]
8765pub struct EngineProperty {
8766 pub this: Box<Expression>,
8767}
8768
8769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8771#[cfg_attr(feature = "bindings", derive(TS))]
8772pub struct ToTableProperty {
8773 pub this: Box<Expression>,
8774}
8775
8776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8778#[cfg_attr(feature = "bindings", derive(TS))]
8779pub struct ExecuteAsProperty {
8780 pub this: Box<Expression>,
8781}
8782
8783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8785#[cfg_attr(feature = "bindings", derive(TS))]
8786pub struct ExternalProperty {
8787 #[serde(default)]
8788 pub this: Option<Box<Expression>>,
8789}
8790
8791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8793#[cfg_attr(feature = "bindings", derive(TS))]
8794pub struct FallbackProperty {
8795 #[serde(default)]
8796 pub no: Option<Box<Expression>>,
8797 #[serde(default)]
8798 pub protection: Option<Box<Expression>>,
8799}
8800
8801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8803#[cfg_attr(feature = "bindings", derive(TS))]
8804pub struct FileFormatProperty {
8805 #[serde(default)]
8806 pub this: Option<Box<Expression>>,
8807 #[serde(default)]
8808 pub expressions: Vec<Expression>,
8809 #[serde(default)]
8810 pub hive_format: Option<Box<Expression>>,
8811}
8812
8813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8815#[cfg_attr(feature = "bindings", derive(TS))]
8816pub struct CredentialsProperty {
8817 #[serde(default)]
8818 pub expressions: Vec<Expression>,
8819}
8820
8821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8823#[cfg_attr(feature = "bindings", derive(TS))]
8824pub struct FreespaceProperty {
8825 pub this: Box<Expression>,
8826 #[serde(default)]
8827 pub percent: Option<Box<Expression>>,
8828}
8829
8830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8832#[cfg_attr(feature = "bindings", derive(TS))]
8833pub struct InheritsProperty {
8834 #[serde(default)]
8835 pub expressions: Vec<Expression>,
8836}
8837
8838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8840#[cfg_attr(feature = "bindings", derive(TS))]
8841pub struct InputModelProperty {
8842 pub this: Box<Expression>,
8843}
8844
8845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8847#[cfg_attr(feature = "bindings", derive(TS))]
8848pub struct OutputModelProperty {
8849 pub this: Box<Expression>,
8850}
8851
8852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8854#[cfg_attr(feature = "bindings", derive(TS))]
8855pub struct IsolatedLoadingProperty {
8856 #[serde(default)]
8857 pub no: Option<Box<Expression>>,
8858 #[serde(default)]
8859 pub concurrent: Option<Box<Expression>>,
8860 #[serde(default)]
8861 pub target: Option<Box<Expression>>,
8862}
8863
8864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8866#[cfg_attr(feature = "bindings", derive(TS))]
8867pub struct JournalProperty {
8868 #[serde(default)]
8869 pub no: Option<Box<Expression>>,
8870 #[serde(default)]
8871 pub dual: Option<Box<Expression>>,
8872 #[serde(default)]
8873 pub before: Option<Box<Expression>>,
8874 #[serde(default)]
8875 pub local: Option<Box<Expression>>,
8876 #[serde(default)]
8877 pub after: Option<Box<Expression>>,
8878}
8879
8880#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8882#[cfg_attr(feature = "bindings", derive(TS))]
8883pub struct LanguageProperty {
8884 pub this: Box<Expression>,
8885}
8886
8887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8889#[cfg_attr(feature = "bindings", derive(TS))]
8890pub struct EnviromentProperty {
8891 #[serde(default)]
8892 pub expressions: Vec<Expression>,
8893}
8894
8895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8897#[cfg_attr(feature = "bindings", derive(TS))]
8898pub struct ClusteredByProperty {
8899 #[serde(default)]
8900 pub expressions: Vec<Expression>,
8901 #[serde(default)]
8902 pub sorted_by: Option<Box<Expression>>,
8903 #[serde(default)]
8904 pub buckets: Option<Box<Expression>>,
8905}
8906
8907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8909#[cfg_attr(feature = "bindings", derive(TS))]
8910pub struct DictProperty {
8911 pub this: Box<Expression>,
8912 pub kind: String,
8913 #[serde(default)]
8914 pub settings: Option<Box<Expression>>,
8915}
8916
8917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8919#[cfg_attr(feature = "bindings", derive(TS))]
8920pub struct DictRange {
8921 pub this: Box<Expression>,
8922 #[serde(default)]
8923 pub min: Option<Box<Expression>>,
8924 #[serde(default)]
8925 pub max: Option<Box<Expression>>,
8926}
8927
8928#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8930#[cfg_attr(feature = "bindings", derive(TS))]
8931pub struct OnCluster {
8932 pub this: Box<Expression>,
8933}
8934
8935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8937#[cfg_attr(feature = "bindings", derive(TS))]
8938pub struct LikeProperty {
8939 pub this: Box<Expression>,
8940 #[serde(default)]
8941 pub expressions: Vec<Expression>,
8942}
8943
8944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8946#[cfg_attr(feature = "bindings", derive(TS))]
8947pub struct LocationProperty {
8948 pub this: Box<Expression>,
8949}
8950
8951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8953#[cfg_attr(feature = "bindings", derive(TS))]
8954pub struct LockProperty {
8955 pub this: Box<Expression>,
8956}
8957
8958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8960#[cfg_attr(feature = "bindings", derive(TS))]
8961pub struct LockingProperty {
8962 #[serde(default)]
8963 pub this: Option<Box<Expression>>,
8964 pub kind: String,
8965 #[serde(default)]
8966 pub for_or_in: Option<Box<Expression>>,
8967 #[serde(default)]
8968 pub lock_type: Option<Box<Expression>>,
8969 #[serde(default)]
8970 pub override_: Option<Box<Expression>>,
8971}
8972
8973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8975#[cfg_attr(feature = "bindings", derive(TS))]
8976pub struct LogProperty {
8977 #[serde(default)]
8978 pub no: Option<Box<Expression>>,
8979}
8980
8981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8983#[cfg_attr(feature = "bindings", derive(TS))]
8984pub struct MaterializedProperty {
8985 #[serde(default)]
8986 pub this: Option<Box<Expression>>,
8987}
8988
8989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8991#[cfg_attr(feature = "bindings", derive(TS))]
8992pub struct MergeBlockRatioProperty {
8993 #[serde(default)]
8994 pub this: Option<Box<Expression>>,
8995 #[serde(default)]
8996 pub no: Option<Box<Expression>>,
8997 #[serde(default)]
8998 pub default: Option<Box<Expression>>,
8999 #[serde(default)]
9000 pub percent: Option<Box<Expression>>,
9001}
9002
9003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9005#[cfg_attr(feature = "bindings", derive(TS))]
9006pub struct OnProperty {
9007 pub this: Box<Expression>,
9008}
9009
9010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9012#[cfg_attr(feature = "bindings", derive(TS))]
9013pub struct OnCommitProperty {
9014 #[serde(default)]
9015 pub delete: Option<Box<Expression>>,
9016}
9017
9018#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9020#[cfg_attr(feature = "bindings", derive(TS))]
9021pub struct PartitionedByProperty {
9022 pub this: Box<Expression>,
9023}
9024
9025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9027#[cfg_attr(feature = "bindings", derive(TS))]
9028pub struct PartitionedByBucket {
9029 pub this: Box<Expression>,
9030 pub expression: Box<Expression>,
9031}
9032
9033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9035#[cfg_attr(feature = "bindings", derive(TS))]
9036pub struct PartitionByTruncate {
9037 pub this: Box<Expression>,
9038 pub expression: Box<Expression>,
9039}
9040
9041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9043#[cfg_attr(feature = "bindings", derive(TS))]
9044pub struct PartitionByRangeProperty {
9045 #[serde(default)]
9046 pub partition_expressions: Option<Box<Expression>>,
9047 #[serde(default)]
9048 pub create_expressions: Option<Box<Expression>>,
9049}
9050
9051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9053#[cfg_attr(feature = "bindings", derive(TS))]
9054pub struct PartitionByRangePropertyDynamic {
9055 #[serde(default)]
9056 pub this: Option<Box<Expression>>,
9057 #[serde(default)]
9058 pub start: Option<Box<Expression>>,
9059 #[serde(default)]
9061 pub use_start_end: bool,
9062 #[serde(default)]
9063 pub end: Option<Box<Expression>>,
9064 #[serde(default)]
9065 pub every: Option<Box<Expression>>,
9066}
9067
9068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9070#[cfg_attr(feature = "bindings", derive(TS))]
9071pub struct PartitionByListProperty {
9072 #[serde(default)]
9073 pub partition_expressions: Option<Box<Expression>>,
9074 #[serde(default)]
9075 pub create_expressions: Option<Box<Expression>>,
9076}
9077
9078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9080#[cfg_attr(feature = "bindings", derive(TS))]
9081pub struct PartitionList {
9082 pub this: Box<Expression>,
9083 #[serde(default)]
9084 pub expressions: Vec<Expression>,
9085}
9086
9087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9089#[cfg_attr(feature = "bindings", derive(TS))]
9090pub struct Partition {
9091 pub expressions: Vec<Expression>,
9092 #[serde(default)]
9093 pub subpartition: bool,
9094}
9095
9096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9099#[cfg_attr(feature = "bindings", derive(TS))]
9100pub struct RefreshTriggerProperty {
9101 pub method: String,
9103 #[serde(default)]
9105 pub kind: Option<String>,
9106 #[serde(default)]
9108 pub every: Option<Box<Expression>>,
9109 #[serde(default)]
9111 pub unit: Option<String>,
9112 #[serde(default)]
9114 pub starts: Option<Box<Expression>>,
9115}
9116
9117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9119#[cfg_attr(feature = "bindings", derive(TS))]
9120pub struct UniqueKeyProperty {
9121 #[serde(default)]
9122 pub expressions: Vec<Expression>,
9123}
9124
9125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9127#[cfg_attr(feature = "bindings", derive(TS))]
9128pub struct RollupProperty {
9129 pub expressions: Vec<RollupIndex>,
9130}
9131
9132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9134#[cfg_attr(feature = "bindings", derive(TS))]
9135pub struct RollupIndex {
9136 pub name: Identifier,
9137 pub expressions: Vec<Identifier>,
9138}
9139
9140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9142#[cfg_attr(feature = "bindings", derive(TS))]
9143pub struct PartitionBoundSpec {
9144 #[serde(default)]
9145 pub this: Option<Box<Expression>>,
9146 #[serde(default)]
9147 pub expression: Option<Box<Expression>>,
9148 #[serde(default)]
9149 pub from_expressions: Option<Box<Expression>>,
9150 #[serde(default)]
9151 pub to_expressions: Option<Box<Expression>>,
9152}
9153
9154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9156#[cfg_attr(feature = "bindings", derive(TS))]
9157pub struct PartitionedOfProperty {
9158 pub this: Box<Expression>,
9159 pub expression: Box<Expression>,
9160}
9161
9162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9164#[cfg_attr(feature = "bindings", derive(TS))]
9165pub struct RemoteWithConnectionModelProperty {
9166 pub this: Box<Expression>,
9167}
9168
9169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9171#[cfg_attr(feature = "bindings", derive(TS))]
9172pub struct ReturnsProperty {
9173 #[serde(default)]
9174 pub this: Option<Box<Expression>>,
9175 #[serde(default)]
9176 pub is_table: Option<Box<Expression>>,
9177 #[serde(default)]
9178 pub table: Option<Box<Expression>>,
9179 #[serde(default)]
9180 pub null: Option<Box<Expression>>,
9181}
9182
9183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9185#[cfg_attr(feature = "bindings", derive(TS))]
9186pub struct RowFormatProperty {
9187 pub this: Box<Expression>,
9188}
9189
9190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9192#[cfg_attr(feature = "bindings", derive(TS))]
9193pub struct RowFormatDelimitedProperty {
9194 #[serde(default)]
9195 pub fields: Option<Box<Expression>>,
9196 #[serde(default)]
9197 pub escaped: Option<Box<Expression>>,
9198 #[serde(default)]
9199 pub collection_items: Option<Box<Expression>>,
9200 #[serde(default)]
9201 pub map_keys: Option<Box<Expression>>,
9202 #[serde(default)]
9203 pub lines: Option<Box<Expression>>,
9204 #[serde(default)]
9205 pub null: Option<Box<Expression>>,
9206 #[serde(default)]
9207 pub serde: Option<Box<Expression>>,
9208}
9209
9210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9212#[cfg_attr(feature = "bindings", derive(TS))]
9213pub struct RowFormatSerdeProperty {
9214 pub this: Box<Expression>,
9215 #[serde(default)]
9216 pub serde_properties: Option<Box<Expression>>,
9217}
9218
9219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9221#[cfg_attr(feature = "bindings", derive(TS))]
9222pub struct QueryTransform {
9223 #[serde(default)]
9224 pub expressions: Vec<Expression>,
9225 #[serde(default)]
9226 pub command_script: Option<Box<Expression>>,
9227 #[serde(default)]
9228 pub schema: Option<Box<Expression>>,
9229 #[serde(default)]
9230 pub row_format_before: Option<Box<Expression>>,
9231 #[serde(default)]
9232 pub record_writer: Option<Box<Expression>>,
9233 #[serde(default)]
9234 pub row_format_after: Option<Box<Expression>>,
9235 #[serde(default)]
9236 pub record_reader: Option<Box<Expression>>,
9237}
9238
9239#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9241#[cfg_attr(feature = "bindings", derive(TS))]
9242pub struct SampleProperty {
9243 pub this: Box<Expression>,
9244}
9245
9246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9248#[cfg_attr(feature = "bindings", derive(TS))]
9249pub struct SecurityProperty {
9250 pub this: Box<Expression>,
9251}
9252
9253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9255#[cfg_attr(feature = "bindings", derive(TS))]
9256pub struct SchemaCommentProperty {
9257 pub this: Box<Expression>,
9258}
9259
9260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9262#[cfg_attr(feature = "bindings", derive(TS))]
9263pub struct SemanticView {
9264 pub this: Box<Expression>,
9265 #[serde(default)]
9266 pub metrics: Option<Box<Expression>>,
9267 #[serde(default)]
9268 pub dimensions: Option<Box<Expression>>,
9269 #[serde(default)]
9270 pub facts: Option<Box<Expression>>,
9271 #[serde(default)]
9272 pub where_: Option<Box<Expression>>,
9273}
9274
9275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9277#[cfg_attr(feature = "bindings", derive(TS))]
9278pub struct SerdeProperties {
9279 #[serde(default)]
9280 pub expressions: Vec<Expression>,
9281 #[serde(default)]
9282 pub with_: Option<Box<Expression>>,
9283}
9284
9285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9287#[cfg_attr(feature = "bindings", derive(TS))]
9288pub struct SetProperty {
9289 #[serde(default)]
9290 pub multi: Option<Box<Expression>>,
9291}
9292
9293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9295#[cfg_attr(feature = "bindings", derive(TS))]
9296pub struct SharingProperty {
9297 #[serde(default)]
9298 pub this: Option<Box<Expression>>,
9299}
9300
9301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9303#[cfg_attr(feature = "bindings", derive(TS))]
9304pub struct SetConfigProperty {
9305 pub this: Box<Expression>,
9306}
9307
9308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9310#[cfg_attr(feature = "bindings", derive(TS))]
9311pub struct SettingsProperty {
9312 #[serde(default)]
9313 pub expressions: Vec<Expression>,
9314}
9315
9316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9318#[cfg_attr(feature = "bindings", derive(TS))]
9319pub struct SortKeyProperty {
9320 pub this: Box<Expression>,
9321 #[serde(default)]
9322 pub compound: Option<Box<Expression>>,
9323}
9324
9325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9327#[cfg_attr(feature = "bindings", derive(TS))]
9328pub struct SqlReadWriteProperty {
9329 pub this: Box<Expression>,
9330}
9331
9332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9334#[cfg_attr(feature = "bindings", derive(TS))]
9335pub struct SqlSecurityProperty {
9336 pub this: Box<Expression>,
9337}
9338
9339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9341#[cfg_attr(feature = "bindings", derive(TS))]
9342pub struct StabilityProperty {
9343 pub this: Box<Expression>,
9344}
9345
9346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9348#[cfg_attr(feature = "bindings", derive(TS))]
9349pub struct StorageHandlerProperty {
9350 pub this: Box<Expression>,
9351}
9352
9353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9355#[cfg_attr(feature = "bindings", derive(TS))]
9356pub struct TemporaryProperty {
9357 #[serde(default)]
9358 pub this: Option<Box<Expression>>,
9359}
9360
9361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9363#[cfg_attr(feature = "bindings", derive(TS))]
9364pub struct Tags {
9365 #[serde(default)]
9366 pub expressions: Vec<Expression>,
9367}
9368
9369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9371#[cfg_attr(feature = "bindings", derive(TS))]
9372pub struct TransformModelProperty {
9373 #[serde(default)]
9374 pub expressions: Vec<Expression>,
9375}
9376
9377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9379#[cfg_attr(feature = "bindings", derive(TS))]
9380pub struct TransientProperty {
9381 #[serde(default)]
9382 pub this: Option<Box<Expression>>,
9383}
9384
9385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9387#[cfg_attr(feature = "bindings", derive(TS))]
9388pub struct UsingTemplateProperty {
9389 pub this: Box<Expression>,
9390}
9391
9392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9394#[cfg_attr(feature = "bindings", derive(TS))]
9395pub struct ViewAttributeProperty {
9396 pub this: Box<Expression>,
9397}
9398
9399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9401#[cfg_attr(feature = "bindings", derive(TS))]
9402pub struct VolatileProperty {
9403 #[serde(default)]
9404 pub this: Option<Box<Expression>>,
9405}
9406
9407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9409#[cfg_attr(feature = "bindings", derive(TS))]
9410pub struct WithDataProperty {
9411 #[serde(default)]
9412 pub no: Option<Box<Expression>>,
9413 #[serde(default)]
9414 pub statistics: Option<Box<Expression>>,
9415}
9416
9417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9419#[cfg_attr(feature = "bindings", derive(TS))]
9420pub struct WithJournalTableProperty {
9421 pub this: Box<Expression>,
9422}
9423
9424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9426#[cfg_attr(feature = "bindings", derive(TS))]
9427pub struct WithSchemaBindingProperty {
9428 pub this: Box<Expression>,
9429}
9430
9431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9433#[cfg_attr(feature = "bindings", derive(TS))]
9434pub struct WithSystemVersioningProperty {
9435 #[serde(default)]
9436 pub on: Option<Box<Expression>>,
9437 #[serde(default)]
9438 pub this: Option<Box<Expression>>,
9439 #[serde(default)]
9440 pub data_consistency: Option<Box<Expression>>,
9441 #[serde(default)]
9442 pub retention_period: Option<Box<Expression>>,
9443 #[serde(default)]
9444 pub with_: Option<Box<Expression>>,
9445}
9446
9447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9449#[cfg_attr(feature = "bindings", derive(TS))]
9450pub struct WithProcedureOptions {
9451 #[serde(default)]
9452 pub expressions: Vec<Expression>,
9453}
9454
9455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9457#[cfg_attr(feature = "bindings", derive(TS))]
9458pub struct EncodeProperty {
9459 pub this: Box<Expression>,
9460 #[serde(default)]
9461 pub properties: Vec<Expression>,
9462 #[serde(default)]
9463 pub key: Option<Box<Expression>>,
9464}
9465
9466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9468#[cfg_attr(feature = "bindings", derive(TS))]
9469pub struct IncludeProperty {
9470 pub this: Box<Expression>,
9471 #[serde(default)]
9472 pub alias: Option<String>,
9473 #[serde(default)]
9474 pub column_def: Option<Box<Expression>>,
9475}
9476
9477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9479#[cfg_attr(feature = "bindings", derive(TS))]
9480pub struct Properties {
9481 #[serde(default)]
9482 pub expressions: Vec<Expression>,
9483}
9484
9485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9487#[cfg_attr(feature = "bindings", derive(TS))]
9488pub struct InputOutputFormat {
9489 #[serde(default)]
9490 pub input_format: Option<Box<Expression>>,
9491 #[serde(default)]
9492 pub output_format: Option<Box<Expression>>,
9493}
9494
9495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9497#[cfg_attr(feature = "bindings", derive(TS))]
9498pub struct Reference {
9499 pub this: Box<Expression>,
9500 #[serde(default)]
9501 pub expressions: Vec<Expression>,
9502 #[serde(default)]
9503 pub options: Vec<Expression>,
9504}
9505
9506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9508#[cfg_attr(feature = "bindings", derive(TS))]
9509pub struct QueryOption {
9510 pub this: Box<Expression>,
9511 #[serde(default)]
9512 pub expression: Option<Box<Expression>>,
9513}
9514
9515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9517#[cfg_attr(feature = "bindings", derive(TS))]
9518pub struct WithTableHint {
9519 #[serde(default)]
9520 pub expressions: Vec<Expression>,
9521}
9522
9523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9525#[cfg_attr(feature = "bindings", derive(TS))]
9526pub struct IndexTableHint {
9527 pub this: Box<Expression>,
9528 #[serde(default)]
9529 pub expressions: Vec<Expression>,
9530 #[serde(default)]
9531 pub target: Option<Box<Expression>>,
9532}
9533
9534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9536#[cfg_attr(feature = "bindings", derive(TS))]
9537pub struct Get {
9538 pub this: Box<Expression>,
9539 #[serde(default)]
9540 pub target: Option<Box<Expression>>,
9541 #[serde(default)]
9542 pub properties: Vec<Expression>,
9543}
9544
9545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9547#[cfg_attr(feature = "bindings", derive(TS))]
9548pub struct SetOperation {
9549 #[serde(default)]
9550 pub with_: Option<Box<Expression>>,
9551 pub this: Box<Expression>,
9552 pub expression: Box<Expression>,
9553 #[serde(default)]
9554 pub distinct: bool,
9555 #[serde(default)]
9556 pub by_name: Option<Box<Expression>>,
9557 #[serde(default)]
9558 pub side: Option<Box<Expression>>,
9559 #[serde(default)]
9560 pub kind: Option<String>,
9561 #[serde(default)]
9562 pub on: Option<Box<Expression>>,
9563}
9564
9565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9567#[cfg_attr(feature = "bindings", derive(TS))]
9568pub struct Var {
9569 pub this: String,
9570}
9571
9572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9574#[cfg_attr(feature = "bindings", derive(TS))]
9575pub struct Variadic {
9576 pub this: Box<Expression>,
9577}
9578
9579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9581#[cfg_attr(feature = "bindings", derive(TS))]
9582pub struct Version {
9583 pub this: Box<Expression>,
9584 pub kind: String,
9585 #[serde(default)]
9586 pub expression: Option<Box<Expression>>,
9587}
9588
9589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9591#[cfg_attr(feature = "bindings", derive(TS))]
9592pub struct Schema {
9593 #[serde(default)]
9594 pub this: Option<Box<Expression>>,
9595 #[serde(default)]
9596 pub expressions: Vec<Expression>,
9597}
9598
9599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9601#[cfg_attr(feature = "bindings", derive(TS))]
9602pub struct Lock {
9603 #[serde(default)]
9604 pub update: Option<Box<Expression>>,
9605 #[serde(default)]
9606 pub expressions: Vec<Expression>,
9607 #[serde(default)]
9608 pub wait: Option<Box<Expression>>,
9609 #[serde(default)]
9610 pub key: Option<Box<Expression>>,
9611}
9612
9613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9616#[cfg_attr(feature = "bindings", derive(TS))]
9617pub struct TableSample {
9618 #[serde(default, skip_serializing_if = "Option::is_none")]
9620 pub this: Option<Box<Expression>>,
9621 #[serde(default, skip_serializing_if = "Option::is_none")]
9623 pub sample: Option<Box<Sample>>,
9624 #[serde(default)]
9625 pub expressions: Vec<Expression>,
9626 #[serde(default)]
9627 pub method: Option<String>,
9628 #[serde(default)]
9629 pub bucket_numerator: Option<Box<Expression>>,
9630 #[serde(default)]
9631 pub bucket_denominator: Option<Box<Expression>>,
9632 #[serde(default)]
9633 pub bucket_field: Option<Box<Expression>>,
9634 #[serde(default)]
9635 pub percent: Option<Box<Expression>>,
9636 #[serde(default)]
9637 pub rows: Option<Box<Expression>>,
9638 #[serde(default)]
9639 pub size: Option<i64>,
9640 #[serde(default)]
9641 pub seed: Option<Box<Expression>>,
9642}
9643
9644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9646#[cfg_attr(feature = "bindings", derive(TS))]
9647pub struct Tag {
9648 #[serde(default)]
9649 pub this: Option<Box<Expression>>,
9650 #[serde(default)]
9651 pub prefix: Option<Box<Expression>>,
9652 #[serde(default)]
9653 pub postfix: Option<Box<Expression>>,
9654}
9655
9656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9658#[cfg_attr(feature = "bindings", derive(TS))]
9659pub struct UnpivotColumns {
9660 pub this: Box<Expression>,
9661 #[serde(default)]
9662 pub expressions: Vec<Expression>,
9663}
9664
9665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9667#[cfg_attr(feature = "bindings", derive(TS))]
9668pub struct SessionParameter {
9669 pub this: Box<Expression>,
9670 #[serde(default)]
9671 pub kind: Option<String>,
9672}
9673
9674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9676#[cfg_attr(feature = "bindings", derive(TS))]
9677pub struct PseudoType {
9678 pub this: Box<Expression>,
9679}
9680
9681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9683#[cfg_attr(feature = "bindings", derive(TS))]
9684pub struct ObjectIdentifier {
9685 pub this: Box<Expression>,
9686}
9687
9688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9690#[cfg_attr(feature = "bindings", derive(TS))]
9691pub struct Transaction {
9692 #[serde(default)]
9693 pub this: Option<Box<Expression>>,
9694 #[serde(default)]
9695 pub modes: Option<Box<Expression>>,
9696 #[serde(default)]
9697 pub mark: Option<Box<Expression>>,
9698}
9699
9700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9702#[cfg_attr(feature = "bindings", derive(TS))]
9703pub struct Commit {
9704 #[serde(default)]
9705 pub chain: Option<Box<Expression>>,
9706 #[serde(default)]
9707 pub this: Option<Box<Expression>>,
9708 #[serde(default)]
9709 pub durability: Option<Box<Expression>>,
9710}
9711
9712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9714#[cfg_attr(feature = "bindings", derive(TS))]
9715pub struct Rollback {
9716 #[serde(default)]
9717 pub savepoint: Option<Box<Expression>>,
9718 #[serde(default)]
9719 pub this: Option<Box<Expression>>,
9720}
9721
9722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9724#[cfg_attr(feature = "bindings", derive(TS))]
9725pub struct AlterSession {
9726 #[serde(default)]
9727 pub expressions: Vec<Expression>,
9728 #[serde(default)]
9729 pub unset: Option<Box<Expression>>,
9730}
9731
9732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9734#[cfg_attr(feature = "bindings", derive(TS))]
9735pub struct Analyze {
9736 #[serde(default)]
9737 pub kind: Option<String>,
9738 #[serde(default)]
9739 pub this: Option<Box<Expression>>,
9740 #[serde(default)]
9741 pub options: Vec<Expression>,
9742 #[serde(default)]
9743 pub mode: Option<Box<Expression>>,
9744 #[serde(default)]
9745 pub partition: Option<Box<Expression>>,
9746 #[serde(default)]
9747 pub expression: Option<Box<Expression>>,
9748 #[serde(default)]
9749 pub properties: Vec<Expression>,
9750 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9752 pub columns: Vec<String>,
9753}
9754
9755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9757#[cfg_attr(feature = "bindings", derive(TS))]
9758pub struct AnalyzeStatistics {
9759 pub kind: String,
9760 #[serde(default)]
9761 pub option: Option<Box<Expression>>,
9762 #[serde(default)]
9763 pub this: Option<Box<Expression>>,
9764 #[serde(default)]
9765 pub expressions: Vec<Expression>,
9766}
9767
9768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9770#[cfg_attr(feature = "bindings", derive(TS))]
9771pub struct AnalyzeHistogram {
9772 pub this: Box<Expression>,
9773 #[serde(default)]
9774 pub expressions: Vec<Expression>,
9775 #[serde(default)]
9776 pub expression: Option<Box<Expression>>,
9777 #[serde(default)]
9778 pub update_options: Option<Box<Expression>>,
9779}
9780
9781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9783#[cfg_attr(feature = "bindings", derive(TS))]
9784pub struct AnalyzeSample {
9785 pub kind: String,
9786 #[serde(default)]
9787 pub sample: Option<Box<Expression>>,
9788}
9789
9790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9792#[cfg_attr(feature = "bindings", derive(TS))]
9793pub struct AnalyzeListChainedRows {
9794 #[serde(default)]
9795 pub expression: Option<Box<Expression>>,
9796}
9797
9798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9800#[cfg_attr(feature = "bindings", derive(TS))]
9801pub struct AnalyzeDelete {
9802 #[serde(default)]
9803 pub kind: Option<String>,
9804}
9805
9806#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9808#[cfg_attr(feature = "bindings", derive(TS))]
9809pub struct AnalyzeWith {
9810 #[serde(default)]
9811 pub expressions: Vec<Expression>,
9812}
9813
9814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9816#[cfg_attr(feature = "bindings", derive(TS))]
9817pub struct AnalyzeValidate {
9818 pub kind: String,
9819 #[serde(default)]
9820 pub this: Option<Box<Expression>>,
9821 #[serde(default)]
9822 pub expression: Option<Box<Expression>>,
9823}
9824
9825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9827#[cfg_attr(feature = "bindings", derive(TS))]
9828pub struct AddPartition {
9829 pub this: Box<Expression>,
9830 #[serde(default)]
9831 pub exists: bool,
9832 #[serde(default)]
9833 pub location: Option<Box<Expression>>,
9834}
9835
9836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9838#[cfg_attr(feature = "bindings", derive(TS))]
9839pub struct AttachOption {
9840 pub this: Box<Expression>,
9841 #[serde(default)]
9842 pub expression: Option<Box<Expression>>,
9843}
9844
9845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9847#[cfg_attr(feature = "bindings", derive(TS))]
9848pub struct DropPartition {
9849 #[serde(default)]
9850 pub expressions: Vec<Expression>,
9851 #[serde(default)]
9852 pub exists: bool,
9853}
9854
9855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9857#[cfg_attr(feature = "bindings", derive(TS))]
9858pub struct ReplacePartition {
9859 pub expression: Box<Expression>,
9860 #[serde(default)]
9861 pub source: Option<Box<Expression>>,
9862}
9863
9864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9866#[cfg_attr(feature = "bindings", derive(TS))]
9867pub struct DPipe {
9868 pub this: Box<Expression>,
9869 pub expression: Box<Expression>,
9870 #[serde(default)]
9871 pub safe: Option<Box<Expression>>,
9872}
9873
9874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9876#[cfg_attr(feature = "bindings", derive(TS))]
9877pub struct Operator {
9878 pub this: Box<Expression>,
9879 #[serde(default)]
9880 pub operator: Option<Box<Expression>>,
9881 pub expression: Box<Expression>,
9882 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9884 pub comments: Vec<String>,
9885}
9886
9887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9889#[cfg_attr(feature = "bindings", derive(TS))]
9890pub struct PivotAny {
9891 #[serde(default)]
9892 pub this: Option<Box<Expression>>,
9893}
9894
9895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9897#[cfg_attr(feature = "bindings", derive(TS))]
9898pub struct Aliases {
9899 pub this: Box<Expression>,
9900 #[serde(default)]
9901 pub expressions: Vec<Expression>,
9902}
9903
9904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9906#[cfg_attr(feature = "bindings", derive(TS))]
9907pub struct AtIndex {
9908 pub this: Box<Expression>,
9909 pub expression: Box<Expression>,
9910}
9911
9912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9914#[cfg_attr(feature = "bindings", derive(TS))]
9915pub struct FromTimeZone {
9916 pub this: Box<Expression>,
9917 #[serde(default)]
9918 pub zone: Option<Box<Expression>>,
9919}
9920
9921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9923#[cfg_attr(feature = "bindings", derive(TS))]
9924pub struct FormatPhrase {
9925 pub this: Box<Expression>,
9926 pub format: String,
9927}
9928
9929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9931#[cfg_attr(feature = "bindings", derive(TS))]
9932pub struct ForIn {
9933 pub this: Box<Expression>,
9934 pub expression: Box<Expression>,
9935}
9936
9937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9939#[cfg_attr(feature = "bindings", derive(TS))]
9940pub struct TimeUnit {
9941 #[serde(default)]
9942 pub unit: Option<String>,
9943}
9944
9945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9947#[cfg_attr(feature = "bindings", derive(TS))]
9948pub struct IntervalOp {
9949 #[serde(default)]
9950 pub unit: Option<String>,
9951 pub expression: Box<Expression>,
9952}
9953
9954#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9956#[cfg_attr(feature = "bindings", derive(TS))]
9957pub struct HavingMax {
9958 pub this: Box<Expression>,
9959 pub expression: Box<Expression>,
9960 #[serde(default)]
9961 pub max: Option<Box<Expression>>,
9962}
9963
9964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9966#[cfg_attr(feature = "bindings", derive(TS))]
9967pub struct CosineDistance {
9968 pub this: Box<Expression>,
9969 pub expression: Box<Expression>,
9970}
9971
9972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9974#[cfg_attr(feature = "bindings", derive(TS))]
9975pub struct DotProduct {
9976 pub this: Box<Expression>,
9977 pub expression: Box<Expression>,
9978}
9979
9980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9982#[cfg_attr(feature = "bindings", derive(TS))]
9983pub struct EuclideanDistance {
9984 pub this: Box<Expression>,
9985 pub expression: Box<Expression>,
9986}
9987
9988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9990#[cfg_attr(feature = "bindings", derive(TS))]
9991pub struct ManhattanDistance {
9992 pub this: Box<Expression>,
9993 pub expression: Box<Expression>,
9994}
9995
9996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9998#[cfg_attr(feature = "bindings", derive(TS))]
9999pub struct JarowinklerSimilarity {
10000 pub this: Box<Expression>,
10001 pub expression: Box<Expression>,
10002}
10003
10004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10006#[cfg_attr(feature = "bindings", derive(TS))]
10007pub struct Booland {
10008 pub this: Box<Expression>,
10009 pub expression: Box<Expression>,
10010}
10011
10012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10014#[cfg_attr(feature = "bindings", derive(TS))]
10015pub struct Boolor {
10016 pub this: Box<Expression>,
10017 pub expression: Box<Expression>,
10018}
10019
10020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10022#[cfg_attr(feature = "bindings", derive(TS))]
10023pub struct ParameterizedAgg {
10024 pub this: Box<Expression>,
10025 #[serde(default)]
10026 pub expressions: Vec<Expression>,
10027 #[serde(default)]
10028 pub params: Vec<Expression>,
10029}
10030
10031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10033#[cfg_attr(feature = "bindings", derive(TS))]
10034pub struct ArgMax {
10035 pub this: Box<Expression>,
10036 pub expression: Box<Expression>,
10037 #[serde(default)]
10038 pub count: Option<Box<Expression>>,
10039}
10040
10041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10043#[cfg_attr(feature = "bindings", derive(TS))]
10044pub struct ArgMin {
10045 pub this: Box<Expression>,
10046 pub expression: Box<Expression>,
10047 #[serde(default)]
10048 pub count: Option<Box<Expression>>,
10049}
10050
10051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10053#[cfg_attr(feature = "bindings", derive(TS))]
10054pub struct ApproxTopK {
10055 pub this: Box<Expression>,
10056 #[serde(default)]
10057 pub expression: Option<Box<Expression>>,
10058 #[serde(default)]
10059 pub counters: Option<Box<Expression>>,
10060}
10061
10062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10064#[cfg_attr(feature = "bindings", derive(TS))]
10065pub struct ApproxTopKAccumulate {
10066 pub this: Box<Expression>,
10067 #[serde(default)]
10068 pub expression: Option<Box<Expression>>,
10069}
10070
10071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10073#[cfg_attr(feature = "bindings", derive(TS))]
10074pub struct ApproxTopKCombine {
10075 pub this: Box<Expression>,
10076 #[serde(default)]
10077 pub expression: Option<Box<Expression>>,
10078}
10079
10080#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10082#[cfg_attr(feature = "bindings", derive(TS))]
10083pub struct ApproxTopKEstimate {
10084 pub this: Box<Expression>,
10085 #[serde(default)]
10086 pub expression: Option<Box<Expression>>,
10087}
10088
10089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10091#[cfg_attr(feature = "bindings", derive(TS))]
10092pub struct ApproxTopSum {
10093 pub this: Box<Expression>,
10094 pub expression: Box<Expression>,
10095 #[serde(default)]
10096 pub count: Option<Box<Expression>>,
10097}
10098
10099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10101#[cfg_attr(feature = "bindings", derive(TS))]
10102pub struct ApproxQuantiles {
10103 pub this: Box<Expression>,
10104 #[serde(default)]
10105 pub expression: Option<Box<Expression>>,
10106}
10107
10108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10110#[cfg_attr(feature = "bindings", derive(TS))]
10111pub struct Minhash {
10112 pub this: Box<Expression>,
10113 #[serde(default)]
10114 pub expressions: Vec<Expression>,
10115}
10116
10117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10119#[cfg_attr(feature = "bindings", derive(TS))]
10120pub struct FarmFingerprint {
10121 #[serde(default)]
10122 pub expressions: Vec<Expression>,
10123}
10124
10125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10127#[cfg_attr(feature = "bindings", derive(TS))]
10128pub struct Float64 {
10129 pub this: Box<Expression>,
10130 #[serde(default)]
10131 pub expression: Option<Box<Expression>>,
10132}
10133
10134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10136#[cfg_attr(feature = "bindings", derive(TS))]
10137pub struct Transform {
10138 pub this: Box<Expression>,
10139 pub expression: Box<Expression>,
10140}
10141
10142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10144#[cfg_attr(feature = "bindings", derive(TS))]
10145pub struct Translate {
10146 pub this: Box<Expression>,
10147 #[serde(default)]
10148 pub from_: Option<Box<Expression>>,
10149 #[serde(default)]
10150 pub to: Option<Box<Expression>>,
10151}
10152
10153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10155#[cfg_attr(feature = "bindings", derive(TS))]
10156pub struct Grouping {
10157 #[serde(default)]
10158 pub expressions: Vec<Expression>,
10159}
10160
10161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10163#[cfg_attr(feature = "bindings", derive(TS))]
10164pub struct GroupingId {
10165 #[serde(default)]
10166 pub expressions: Vec<Expression>,
10167}
10168
10169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10171#[cfg_attr(feature = "bindings", derive(TS))]
10172pub struct Anonymous {
10173 pub this: Box<Expression>,
10174 #[serde(default)]
10175 pub expressions: Vec<Expression>,
10176}
10177
10178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10180#[cfg_attr(feature = "bindings", derive(TS))]
10181pub struct AnonymousAggFunc {
10182 pub this: Box<Expression>,
10183 #[serde(default)]
10184 pub expressions: Vec<Expression>,
10185}
10186
10187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10189#[cfg_attr(feature = "bindings", derive(TS))]
10190pub struct CombinedAggFunc {
10191 pub this: Box<Expression>,
10192 #[serde(default)]
10193 pub expressions: Vec<Expression>,
10194}
10195
10196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10198#[cfg_attr(feature = "bindings", derive(TS))]
10199pub struct CombinedParameterizedAgg {
10200 pub this: Box<Expression>,
10201 #[serde(default)]
10202 pub expressions: Vec<Expression>,
10203 #[serde(default)]
10204 pub params: Vec<Expression>,
10205}
10206
10207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10209#[cfg_attr(feature = "bindings", derive(TS))]
10210pub struct HashAgg {
10211 pub this: Box<Expression>,
10212 #[serde(default)]
10213 pub expressions: Vec<Expression>,
10214}
10215
10216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10218#[cfg_attr(feature = "bindings", derive(TS))]
10219pub struct Hll {
10220 pub this: Box<Expression>,
10221 #[serde(default)]
10222 pub expressions: Vec<Expression>,
10223}
10224
10225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10227#[cfg_attr(feature = "bindings", derive(TS))]
10228pub struct Apply {
10229 pub this: Box<Expression>,
10230 pub expression: Box<Expression>,
10231}
10232
10233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10235#[cfg_attr(feature = "bindings", derive(TS))]
10236pub struct ToBoolean {
10237 pub this: Box<Expression>,
10238 #[serde(default)]
10239 pub safe: Option<Box<Expression>>,
10240}
10241
10242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10244#[cfg_attr(feature = "bindings", derive(TS))]
10245pub struct List {
10246 #[serde(default)]
10247 pub expressions: Vec<Expression>,
10248}
10249
10250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10255#[cfg_attr(feature = "bindings", derive(TS))]
10256pub struct ToMap {
10257 pub this: Box<Expression>,
10259}
10260
10261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10263#[cfg_attr(feature = "bindings", derive(TS))]
10264pub struct Pad {
10265 pub this: Box<Expression>,
10266 pub expression: Box<Expression>,
10267 #[serde(default)]
10268 pub fill_pattern: Option<Box<Expression>>,
10269 #[serde(default)]
10270 pub is_left: Option<Box<Expression>>,
10271}
10272
10273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10275#[cfg_attr(feature = "bindings", derive(TS))]
10276pub struct ToChar {
10277 pub this: Box<Expression>,
10278 #[serde(default)]
10279 pub format: Option<String>,
10280 #[serde(default)]
10281 pub nlsparam: Option<Box<Expression>>,
10282 #[serde(default)]
10283 pub is_numeric: Option<Box<Expression>>,
10284}
10285
10286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10288#[cfg_attr(feature = "bindings", derive(TS))]
10289pub struct StringFunc {
10290 pub this: Box<Expression>,
10291 #[serde(default)]
10292 pub zone: Option<Box<Expression>>,
10293}
10294
10295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10297#[cfg_attr(feature = "bindings", derive(TS))]
10298pub struct ToNumber {
10299 pub this: Box<Expression>,
10300 #[serde(default)]
10301 pub format: Option<Box<Expression>>,
10302 #[serde(default)]
10303 pub nlsparam: Option<Box<Expression>>,
10304 #[serde(default)]
10305 pub precision: Option<Box<Expression>>,
10306 #[serde(default)]
10307 pub scale: Option<Box<Expression>>,
10308 #[serde(default)]
10309 pub safe: Option<Box<Expression>>,
10310 #[serde(default)]
10311 pub safe_name: Option<Box<Expression>>,
10312}
10313
10314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10316#[cfg_attr(feature = "bindings", derive(TS))]
10317pub struct ToDouble {
10318 pub this: Box<Expression>,
10319 #[serde(default)]
10320 pub format: Option<String>,
10321 #[serde(default)]
10322 pub safe: Option<Box<Expression>>,
10323}
10324
10325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10327#[cfg_attr(feature = "bindings", derive(TS))]
10328pub struct ToDecfloat {
10329 pub this: Box<Expression>,
10330 #[serde(default)]
10331 pub format: Option<String>,
10332}
10333
10334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10336#[cfg_attr(feature = "bindings", derive(TS))]
10337pub struct TryToDecfloat {
10338 pub this: Box<Expression>,
10339 #[serde(default)]
10340 pub format: Option<String>,
10341}
10342
10343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10345#[cfg_attr(feature = "bindings", derive(TS))]
10346pub struct ToFile {
10347 pub this: Box<Expression>,
10348 #[serde(default)]
10349 pub path: Option<Box<Expression>>,
10350 #[serde(default)]
10351 pub safe: Option<Box<Expression>>,
10352}
10353
10354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10356#[cfg_attr(feature = "bindings", derive(TS))]
10357pub struct Columns {
10358 pub this: Box<Expression>,
10359 #[serde(default)]
10360 pub unpack: Option<Box<Expression>>,
10361}
10362
10363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10365#[cfg_attr(feature = "bindings", derive(TS))]
10366pub struct ConvertToCharset {
10367 pub this: Box<Expression>,
10368 #[serde(default)]
10369 pub dest: Option<Box<Expression>>,
10370 #[serde(default)]
10371 pub source: Option<Box<Expression>>,
10372}
10373
10374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10376#[cfg_attr(feature = "bindings", derive(TS))]
10377pub struct ConvertTimezone {
10378 #[serde(default)]
10379 pub source_tz: Option<Box<Expression>>,
10380 #[serde(default)]
10381 pub target_tz: Option<Box<Expression>>,
10382 #[serde(default)]
10383 pub timestamp: Option<Box<Expression>>,
10384 #[serde(default)]
10385 pub options: Vec<Expression>,
10386}
10387
10388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10390#[cfg_attr(feature = "bindings", derive(TS))]
10391pub struct GenerateSeries {
10392 #[serde(default)]
10393 pub start: Option<Box<Expression>>,
10394 #[serde(default)]
10395 pub end: Option<Box<Expression>>,
10396 #[serde(default)]
10397 pub step: Option<Box<Expression>>,
10398 #[serde(default)]
10399 pub is_end_exclusive: Option<Box<Expression>>,
10400}
10401
10402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10404#[cfg_attr(feature = "bindings", derive(TS))]
10405pub struct AIAgg {
10406 pub this: Box<Expression>,
10407 pub expression: Box<Expression>,
10408}
10409
10410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10412#[cfg_attr(feature = "bindings", derive(TS))]
10413pub struct AIClassify {
10414 pub this: Box<Expression>,
10415 #[serde(default)]
10416 pub categories: Option<Box<Expression>>,
10417 #[serde(default)]
10418 pub config: Option<Box<Expression>>,
10419}
10420
10421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10423#[cfg_attr(feature = "bindings", derive(TS))]
10424pub struct ArrayAll {
10425 pub this: Box<Expression>,
10426 pub expression: Box<Expression>,
10427}
10428
10429#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10431#[cfg_attr(feature = "bindings", derive(TS))]
10432pub struct ArrayAny {
10433 pub this: Box<Expression>,
10434 pub expression: Box<Expression>,
10435}
10436
10437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10439#[cfg_attr(feature = "bindings", derive(TS))]
10440pub struct ArrayConstructCompact {
10441 #[serde(default)]
10442 pub expressions: Vec<Expression>,
10443}
10444
10445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10447#[cfg_attr(feature = "bindings", derive(TS))]
10448pub struct StPoint {
10449 pub this: Box<Expression>,
10450 pub expression: Box<Expression>,
10451 #[serde(default)]
10452 pub null: Option<Box<Expression>>,
10453}
10454
10455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10457#[cfg_attr(feature = "bindings", derive(TS))]
10458pub struct StDistance {
10459 pub this: Box<Expression>,
10460 pub expression: Box<Expression>,
10461 #[serde(default)]
10462 pub use_spheroid: Option<Box<Expression>>,
10463}
10464
10465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10467#[cfg_attr(feature = "bindings", derive(TS))]
10468pub struct StringToArray {
10469 pub this: Box<Expression>,
10470 #[serde(default)]
10471 pub expression: Option<Box<Expression>>,
10472 #[serde(default)]
10473 pub null: Option<Box<Expression>>,
10474}
10475
10476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10478#[cfg_attr(feature = "bindings", derive(TS))]
10479pub struct ArraySum {
10480 pub this: Box<Expression>,
10481 #[serde(default)]
10482 pub expression: Option<Box<Expression>>,
10483}
10484
10485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10487#[cfg_attr(feature = "bindings", derive(TS))]
10488pub struct ObjectAgg {
10489 pub this: Box<Expression>,
10490 pub expression: Box<Expression>,
10491}
10492
10493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10495#[cfg_attr(feature = "bindings", derive(TS))]
10496pub struct CastToStrType {
10497 pub this: Box<Expression>,
10498 #[serde(default)]
10499 pub to: Option<Box<Expression>>,
10500}
10501
10502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10504#[cfg_attr(feature = "bindings", derive(TS))]
10505pub struct CheckJson {
10506 pub this: Box<Expression>,
10507}
10508
10509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10511#[cfg_attr(feature = "bindings", derive(TS))]
10512pub struct CheckXml {
10513 pub this: Box<Expression>,
10514 #[serde(default)]
10515 pub disable_auto_convert: Option<Box<Expression>>,
10516}
10517
10518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10520#[cfg_attr(feature = "bindings", derive(TS))]
10521pub struct TranslateCharacters {
10522 pub this: Box<Expression>,
10523 pub expression: Box<Expression>,
10524 #[serde(default)]
10525 pub with_error: Option<Box<Expression>>,
10526}
10527
10528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10530#[cfg_attr(feature = "bindings", derive(TS))]
10531pub struct CurrentSchemas {
10532 #[serde(default)]
10533 pub this: Option<Box<Expression>>,
10534}
10535
10536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10538#[cfg_attr(feature = "bindings", derive(TS))]
10539pub struct CurrentDatetime {
10540 #[serde(default)]
10541 pub this: Option<Box<Expression>>,
10542}
10543
10544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10546#[cfg_attr(feature = "bindings", derive(TS))]
10547pub struct Localtime {
10548 #[serde(default)]
10549 pub this: Option<Box<Expression>>,
10550}
10551
10552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10554#[cfg_attr(feature = "bindings", derive(TS))]
10555pub struct Localtimestamp {
10556 #[serde(default)]
10557 pub this: Option<Box<Expression>>,
10558}
10559
10560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10562#[cfg_attr(feature = "bindings", derive(TS))]
10563pub struct Systimestamp {
10564 #[serde(default)]
10565 pub this: Option<Box<Expression>>,
10566}
10567
10568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10570#[cfg_attr(feature = "bindings", derive(TS))]
10571pub struct CurrentSchema {
10572 #[serde(default)]
10573 pub this: Option<Box<Expression>>,
10574}
10575
10576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10578#[cfg_attr(feature = "bindings", derive(TS))]
10579pub struct CurrentUser {
10580 #[serde(default)]
10581 pub this: Option<Box<Expression>>,
10582}
10583
10584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10586#[cfg_attr(feature = "bindings", derive(TS))]
10587pub struct SessionUser;
10588
10589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10591#[cfg_attr(feature = "bindings", derive(TS))]
10592pub struct JSONPathRoot;
10593
10594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10596#[cfg_attr(feature = "bindings", derive(TS))]
10597pub struct UtcTime {
10598 #[serde(default)]
10599 pub this: Option<Box<Expression>>,
10600}
10601
10602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10604#[cfg_attr(feature = "bindings", derive(TS))]
10605pub struct UtcTimestamp {
10606 #[serde(default)]
10607 pub this: Option<Box<Expression>>,
10608}
10609
10610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10612#[cfg_attr(feature = "bindings", derive(TS))]
10613pub struct TimestampFunc {
10614 #[serde(default)]
10615 pub this: Option<Box<Expression>>,
10616 #[serde(default)]
10617 pub zone: Option<Box<Expression>>,
10618 #[serde(default)]
10619 pub with_tz: Option<bool>,
10620 #[serde(default)]
10621 pub safe: Option<bool>,
10622}
10623
10624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10626#[cfg_attr(feature = "bindings", derive(TS))]
10627pub struct DateBin {
10628 pub this: Box<Expression>,
10629 pub expression: Box<Expression>,
10630 #[serde(default)]
10631 pub unit: Option<String>,
10632 #[serde(default)]
10633 pub zone: Option<Box<Expression>>,
10634 #[serde(default)]
10635 pub origin: Option<Box<Expression>>,
10636}
10637
10638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10640#[cfg_attr(feature = "bindings", derive(TS))]
10641pub struct Datetime {
10642 pub this: Box<Expression>,
10643 #[serde(default)]
10644 pub expression: Option<Box<Expression>>,
10645}
10646
10647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10649#[cfg_attr(feature = "bindings", derive(TS))]
10650pub struct DatetimeAdd {
10651 pub this: Box<Expression>,
10652 pub expression: Box<Expression>,
10653 #[serde(default)]
10654 pub unit: Option<String>,
10655}
10656
10657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10659#[cfg_attr(feature = "bindings", derive(TS))]
10660pub struct DatetimeSub {
10661 pub this: Box<Expression>,
10662 pub expression: Box<Expression>,
10663 #[serde(default)]
10664 pub unit: Option<String>,
10665}
10666
10667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10669#[cfg_attr(feature = "bindings", derive(TS))]
10670pub struct DatetimeDiff {
10671 pub this: Box<Expression>,
10672 pub expression: Box<Expression>,
10673 #[serde(default)]
10674 pub unit: Option<String>,
10675}
10676
10677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10679#[cfg_attr(feature = "bindings", derive(TS))]
10680pub struct DatetimeTrunc {
10681 pub this: Box<Expression>,
10682 pub unit: String,
10683 #[serde(default)]
10684 pub zone: Option<Box<Expression>>,
10685}
10686
10687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10689#[cfg_attr(feature = "bindings", derive(TS))]
10690pub struct Dayname {
10691 pub this: Box<Expression>,
10692 #[serde(default)]
10693 pub abbreviated: Option<Box<Expression>>,
10694}
10695
10696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10698#[cfg_attr(feature = "bindings", derive(TS))]
10699pub struct MakeInterval {
10700 #[serde(default)]
10701 pub year: Option<Box<Expression>>,
10702 #[serde(default)]
10703 pub month: Option<Box<Expression>>,
10704 #[serde(default)]
10705 pub week: Option<Box<Expression>>,
10706 #[serde(default)]
10707 pub day: Option<Box<Expression>>,
10708 #[serde(default)]
10709 pub hour: Option<Box<Expression>>,
10710 #[serde(default)]
10711 pub minute: Option<Box<Expression>>,
10712 #[serde(default)]
10713 pub second: Option<Box<Expression>>,
10714}
10715
10716#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10718#[cfg_attr(feature = "bindings", derive(TS))]
10719pub struct PreviousDay {
10720 pub this: Box<Expression>,
10721 pub expression: Box<Expression>,
10722}
10723
10724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10726#[cfg_attr(feature = "bindings", derive(TS))]
10727pub struct Elt {
10728 pub this: Box<Expression>,
10729 #[serde(default)]
10730 pub expressions: Vec<Expression>,
10731}
10732
10733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10735#[cfg_attr(feature = "bindings", derive(TS))]
10736pub struct TimestampAdd {
10737 pub this: Box<Expression>,
10738 pub expression: Box<Expression>,
10739 #[serde(default)]
10740 pub unit: Option<String>,
10741}
10742
10743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10745#[cfg_attr(feature = "bindings", derive(TS))]
10746pub struct TimestampSub {
10747 pub this: Box<Expression>,
10748 pub expression: Box<Expression>,
10749 #[serde(default)]
10750 pub unit: Option<String>,
10751}
10752
10753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10755#[cfg_attr(feature = "bindings", derive(TS))]
10756pub struct TimestampDiff {
10757 pub this: Box<Expression>,
10758 pub expression: Box<Expression>,
10759 #[serde(default)]
10760 pub unit: Option<String>,
10761}
10762
10763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10765#[cfg_attr(feature = "bindings", derive(TS))]
10766pub struct TimeSlice {
10767 pub this: Box<Expression>,
10768 pub expression: Box<Expression>,
10769 pub unit: String,
10770 #[serde(default)]
10771 pub kind: Option<String>,
10772}
10773
10774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10776#[cfg_attr(feature = "bindings", derive(TS))]
10777pub struct TimeAdd {
10778 pub this: Box<Expression>,
10779 pub expression: Box<Expression>,
10780 #[serde(default)]
10781 pub unit: Option<String>,
10782}
10783
10784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10786#[cfg_attr(feature = "bindings", derive(TS))]
10787pub struct TimeSub {
10788 pub this: Box<Expression>,
10789 pub expression: Box<Expression>,
10790 #[serde(default)]
10791 pub unit: Option<String>,
10792}
10793
10794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10796#[cfg_attr(feature = "bindings", derive(TS))]
10797pub struct TimeDiff {
10798 pub this: Box<Expression>,
10799 pub expression: Box<Expression>,
10800 #[serde(default)]
10801 pub unit: Option<String>,
10802}
10803
10804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10806#[cfg_attr(feature = "bindings", derive(TS))]
10807pub struct TimeTrunc {
10808 pub this: Box<Expression>,
10809 pub unit: String,
10810 #[serde(default)]
10811 pub zone: Option<Box<Expression>>,
10812}
10813
10814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10816#[cfg_attr(feature = "bindings", derive(TS))]
10817pub struct DateFromParts {
10818 #[serde(default)]
10819 pub year: Option<Box<Expression>>,
10820 #[serde(default)]
10821 pub month: Option<Box<Expression>>,
10822 #[serde(default)]
10823 pub day: Option<Box<Expression>>,
10824 #[serde(default)]
10825 pub allow_overflow: Option<Box<Expression>>,
10826}
10827
10828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10830#[cfg_attr(feature = "bindings", derive(TS))]
10831pub struct TimeFromParts {
10832 #[serde(default)]
10833 pub hour: Option<Box<Expression>>,
10834 #[serde(default)]
10835 pub min: Option<Box<Expression>>,
10836 #[serde(default)]
10837 pub sec: Option<Box<Expression>>,
10838 #[serde(default)]
10839 pub nano: Option<Box<Expression>>,
10840 #[serde(default)]
10841 pub fractions: Option<Box<Expression>>,
10842 #[serde(default)]
10843 pub precision: Option<i64>,
10844}
10845
10846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10848#[cfg_attr(feature = "bindings", derive(TS))]
10849pub struct DecodeCase {
10850 #[serde(default)]
10851 pub expressions: Vec<Expression>,
10852}
10853
10854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10856#[cfg_attr(feature = "bindings", derive(TS))]
10857pub struct Decrypt {
10858 pub this: Box<Expression>,
10859 #[serde(default)]
10860 pub passphrase: Option<Box<Expression>>,
10861 #[serde(default)]
10862 pub aad: Option<Box<Expression>>,
10863 #[serde(default)]
10864 pub encryption_method: Option<Box<Expression>>,
10865 #[serde(default)]
10866 pub safe: Option<Box<Expression>>,
10867}
10868
10869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10871#[cfg_attr(feature = "bindings", derive(TS))]
10872pub struct DecryptRaw {
10873 pub this: Box<Expression>,
10874 #[serde(default)]
10875 pub key: Option<Box<Expression>>,
10876 #[serde(default)]
10877 pub iv: Option<Box<Expression>>,
10878 #[serde(default)]
10879 pub aad: Option<Box<Expression>>,
10880 #[serde(default)]
10881 pub encryption_method: Option<Box<Expression>>,
10882 #[serde(default)]
10883 pub aead: Option<Box<Expression>>,
10884 #[serde(default)]
10885 pub safe: Option<Box<Expression>>,
10886}
10887
10888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10890#[cfg_attr(feature = "bindings", derive(TS))]
10891pub struct Encode {
10892 pub this: Box<Expression>,
10893 #[serde(default)]
10894 pub charset: Option<Box<Expression>>,
10895}
10896
10897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10899#[cfg_attr(feature = "bindings", derive(TS))]
10900pub struct Encrypt {
10901 pub this: Box<Expression>,
10902 #[serde(default)]
10903 pub passphrase: Option<Box<Expression>>,
10904 #[serde(default)]
10905 pub aad: Option<Box<Expression>>,
10906 #[serde(default)]
10907 pub encryption_method: Option<Box<Expression>>,
10908}
10909
10910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10912#[cfg_attr(feature = "bindings", derive(TS))]
10913pub struct EncryptRaw {
10914 pub this: Box<Expression>,
10915 #[serde(default)]
10916 pub key: Option<Box<Expression>>,
10917 #[serde(default)]
10918 pub iv: Option<Box<Expression>>,
10919 #[serde(default)]
10920 pub aad: Option<Box<Expression>>,
10921 #[serde(default)]
10922 pub encryption_method: Option<Box<Expression>>,
10923}
10924
10925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10927#[cfg_attr(feature = "bindings", derive(TS))]
10928pub struct EqualNull {
10929 pub this: Box<Expression>,
10930 pub expression: Box<Expression>,
10931}
10932
10933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10935#[cfg_attr(feature = "bindings", derive(TS))]
10936pub struct ToBinary {
10937 pub this: Box<Expression>,
10938 #[serde(default)]
10939 pub format: Option<String>,
10940 #[serde(default)]
10941 pub safe: Option<Box<Expression>>,
10942}
10943
10944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10946#[cfg_attr(feature = "bindings", derive(TS))]
10947pub struct Base64DecodeBinary {
10948 pub this: Box<Expression>,
10949 #[serde(default)]
10950 pub alphabet: Option<Box<Expression>>,
10951}
10952
10953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10955#[cfg_attr(feature = "bindings", derive(TS))]
10956pub struct Base64DecodeString {
10957 pub this: Box<Expression>,
10958 #[serde(default)]
10959 pub alphabet: Option<Box<Expression>>,
10960}
10961
10962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10964#[cfg_attr(feature = "bindings", derive(TS))]
10965pub struct Base64Encode {
10966 pub this: Box<Expression>,
10967 #[serde(default)]
10968 pub max_line_length: Option<Box<Expression>>,
10969 #[serde(default)]
10970 pub alphabet: Option<Box<Expression>>,
10971}
10972
10973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10975#[cfg_attr(feature = "bindings", derive(TS))]
10976pub struct TryBase64DecodeBinary {
10977 pub this: Box<Expression>,
10978 #[serde(default)]
10979 pub alphabet: Option<Box<Expression>>,
10980}
10981
10982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10984#[cfg_attr(feature = "bindings", derive(TS))]
10985pub struct TryBase64DecodeString {
10986 pub this: Box<Expression>,
10987 #[serde(default)]
10988 pub alphabet: Option<Box<Expression>>,
10989}
10990
10991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10993#[cfg_attr(feature = "bindings", derive(TS))]
10994pub struct GapFill {
10995 pub this: Box<Expression>,
10996 #[serde(default)]
10997 pub ts_column: Option<Box<Expression>>,
10998 #[serde(default)]
10999 pub bucket_width: Option<Box<Expression>>,
11000 #[serde(default)]
11001 pub partitioning_columns: Option<Box<Expression>>,
11002 #[serde(default)]
11003 pub value_columns: Option<Box<Expression>>,
11004 #[serde(default)]
11005 pub origin: Option<Box<Expression>>,
11006 #[serde(default)]
11007 pub ignore_nulls: Option<Box<Expression>>,
11008}
11009
11010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11012#[cfg_attr(feature = "bindings", derive(TS))]
11013pub struct GenerateDateArray {
11014 #[serde(default)]
11015 pub start: Option<Box<Expression>>,
11016 #[serde(default)]
11017 pub end: Option<Box<Expression>>,
11018 #[serde(default)]
11019 pub step: Option<Box<Expression>>,
11020}
11021
11022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11024#[cfg_attr(feature = "bindings", derive(TS))]
11025pub struct GenerateTimestampArray {
11026 #[serde(default)]
11027 pub start: Option<Box<Expression>>,
11028 #[serde(default)]
11029 pub end: Option<Box<Expression>>,
11030 #[serde(default)]
11031 pub step: Option<Box<Expression>>,
11032}
11033
11034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11036#[cfg_attr(feature = "bindings", derive(TS))]
11037pub struct GetExtract {
11038 pub this: Box<Expression>,
11039 pub expression: Box<Expression>,
11040}
11041
11042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11044#[cfg_attr(feature = "bindings", derive(TS))]
11045pub struct Getbit {
11046 pub this: Box<Expression>,
11047 pub expression: Box<Expression>,
11048 #[serde(default)]
11049 pub zero_is_msb: Option<Box<Expression>>,
11050}
11051
11052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11054#[cfg_attr(feature = "bindings", derive(TS))]
11055pub struct OverflowTruncateBehavior {
11056 #[serde(default)]
11057 pub this: Option<Box<Expression>>,
11058 #[serde(default)]
11059 pub with_count: Option<Box<Expression>>,
11060}
11061
11062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11064#[cfg_attr(feature = "bindings", derive(TS))]
11065pub struct HexEncode {
11066 pub this: Box<Expression>,
11067 #[serde(default)]
11068 pub case: Option<Box<Expression>>,
11069}
11070
11071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11073#[cfg_attr(feature = "bindings", derive(TS))]
11074pub struct Compress {
11075 pub this: Box<Expression>,
11076 #[serde(default)]
11077 pub method: Option<String>,
11078}
11079
11080#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11082#[cfg_attr(feature = "bindings", derive(TS))]
11083pub struct DecompressBinary {
11084 pub this: Box<Expression>,
11085 pub method: String,
11086}
11087
11088#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11090#[cfg_attr(feature = "bindings", derive(TS))]
11091pub struct DecompressString {
11092 pub this: Box<Expression>,
11093 pub method: String,
11094}
11095
11096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11098#[cfg_attr(feature = "bindings", derive(TS))]
11099pub struct Xor {
11100 #[serde(default)]
11101 pub this: Option<Box<Expression>>,
11102 #[serde(default)]
11103 pub expression: Option<Box<Expression>>,
11104 #[serde(default)]
11105 pub expressions: Vec<Expression>,
11106}
11107
11108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11110#[cfg_attr(feature = "bindings", derive(TS))]
11111pub struct Nullif {
11112 pub this: Box<Expression>,
11113 pub expression: Box<Expression>,
11114}
11115
11116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11118#[cfg_attr(feature = "bindings", derive(TS))]
11119pub struct JSON {
11120 #[serde(default)]
11121 pub this: Option<Box<Expression>>,
11122 #[serde(default)]
11123 pub with_: Option<Box<Expression>>,
11124 #[serde(default)]
11125 pub unique: bool,
11126}
11127
11128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11130#[cfg_attr(feature = "bindings", derive(TS))]
11131pub struct JSONPath {
11132 #[serde(default)]
11133 pub expressions: Vec<Expression>,
11134 #[serde(default)]
11135 pub escape: Option<Box<Expression>>,
11136}
11137
11138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11140#[cfg_attr(feature = "bindings", derive(TS))]
11141pub struct JSONPathFilter {
11142 pub this: Box<Expression>,
11143}
11144
11145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11147#[cfg_attr(feature = "bindings", derive(TS))]
11148pub struct JSONPathKey {
11149 pub this: Box<Expression>,
11150}
11151
11152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11154#[cfg_attr(feature = "bindings", derive(TS))]
11155pub struct JSONPathRecursive {
11156 #[serde(default)]
11157 pub this: Option<Box<Expression>>,
11158}
11159
11160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11162#[cfg_attr(feature = "bindings", derive(TS))]
11163pub struct JSONPathScript {
11164 pub this: Box<Expression>,
11165}
11166
11167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11169#[cfg_attr(feature = "bindings", derive(TS))]
11170pub struct JSONPathSlice {
11171 #[serde(default)]
11172 pub start: Option<Box<Expression>>,
11173 #[serde(default)]
11174 pub end: Option<Box<Expression>>,
11175 #[serde(default)]
11176 pub step: Option<Box<Expression>>,
11177}
11178
11179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11181#[cfg_attr(feature = "bindings", derive(TS))]
11182pub struct JSONPathSelector {
11183 pub this: Box<Expression>,
11184}
11185
11186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11188#[cfg_attr(feature = "bindings", derive(TS))]
11189pub struct JSONPathSubscript {
11190 pub this: Box<Expression>,
11191}
11192
11193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11195#[cfg_attr(feature = "bindings", derive(TS))]
11196pub struct JSONPathUnion {
11197 #[serde(default)]
11198 pub expressions: Vec<Expression>,
11199}
11200
11201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11203#[cfg_attr(feature = "bindings", derive(TS))]
11204pub struct Format {
11205 pub this: Box<Expression>,
11206 #[serde(default)]
11207 pub expressions: Vec<Expression>,
11208}
11209
11210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11212#[cfg_attr(feature = "bindings", derive(TS))]
11213pub struct JSONKeys {
11214 pub this: Box<Expression>,
11215 #[serde(default)]
11216 pub expression: Option<Box<Expression>>,
11217 #[serde(default)]
11218 pub expressions: Vec<Expression>,
11219}
11220
11221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11223#[cfg_attr(feature = "bindings", derive(TS))]
11224pub struct JSONKeyValue {
11225 pub this: Box<Expression>,
11226 pub expression: Box<Expression>,
11227}
11228
11229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11231#[cfg_attr(feature = "bindings", derive(TS))]
11232pub struct JSONKeysAtDepth {
11233 pub this: Box<Expression>,
11234 #[serde(default)]
11235 pub expression: Option<Box<Expression>>,
11236 #[serde(default)]
11237 pub mode: Option<Box<Expression>>,
11238}
11239
11240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11242#[cfg_attr(feature = "bindings", derive(TS))]
11243pub struct JSONObject {
11244 #[serde(default)]
11245 pub expressions: Vec<Expression>,
11246 #[serde(default)]
11247 pub null_handling: Option<Box<Expression>>,
11248 #[serde(default)]
11249 pub unique_keys: Option<Box<Expression>>,
11250 #[serde(default)]
11251 pub return_type: Option<Box<Expression>>,
11252 #[serde(default)]
11253 pub encoding: Option<Box<Expression>>,
11254}
11255
11256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11258#[cfg_attr(feature = "bindings", derive(TS))]
11259pub struct JSONObjectAgg {
11260 #[serde(default)]
11261 pub expressions: Vec<Expression>,
11262 #[serde(default)]
11263 pub null_handling: Option<Box<Expression>>,
11264 #[serde(default)]
11265 pub unique_keys: Option<Box<Expression>>,
11266 #[serde(default)]
11267 pub return_type: Option<Box<Expression>>,
11268 #[serde(default)]
11269 pub encoding: Option<Box<Expression>>,
11270}
11271
11272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11274#[cfg_attr(feature = "bindings", derive(TS))]
11275pub struct JSONBObjectAgg {
11276 pub this: Box<Expression>,
11277 pub expression: Box<Expression>,
11278}
11279
11280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11282#[cfg_attr(feature = "bindings", derive(TS))]
11283pub struct JSONArray {
11284 #[serde(default)]
11285 pub expressions: Vec<Expression>,
11286 #[serde(default)]
11287 pub null_handling: Option<Box<Expression>>,
11288 #[serde(default)]
11289 pub return_type: Option<Box<Expression>>,
11290 #[serde(default)]
11291 pub strict: Option<Box<Expression>>,
11292}
11293
11294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11296#[cfg_attr(feature = "bindings", derive(TS))]
11297pub struct JSONArrayAgg {
11298 pub this: Box<Expression>,
11299 #[serde(default)]
11300 pub order: Option<Box<Expression>>,
11301 #[serde(default)]
11302 pub null_handling: Option<Box<Expression>>,
11303 #[serde(default)]
11304 pub return_type: Option<Box<Expression>>,
11305 #[serde(default)]
11306 pub strict: Option<Box<Expression>>,
11307}
11308
11309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11311#[cfg_attr(feature = "bindings", derive(TS))]
11312pub struct JSONExists {
11313 pub this: Box<Expression>,
11314 #[serde(default)]
11315 pub path: Option<Box<Expression>>,
11316 #[serde(default)]
11317 pub passing: Option<Box<Expression>>,
11318 #[serde(default)]
11319 pub on_condition: Option<Box<Expression>>,
11320 #[serde(default)]
11321 pub from_dcolonqmark: Option<Box<Expression>>,
11322}
11323
11324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11326#[cfg_attr(feature = "bindings", derive(TS))]
11327pub struct JSONColumnDef {
11328 #[serde(default)]
11329 pub this: Option<Box<Expression>>,
11330 #[serde(default)]
11331 pub kind: Option<String>,
11332 #[serde(default)]
11333 pub path: Option<Box<Expression>>,
11334 #[serde(default)]
11335 pub nested_schema: Option<Box<Expression>>,
11336 #[serde(default)]
11337 pub ordinality: Option<Box<Expression>>,
11338}
11339
11340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11342#[cfg_attr(feature = "bindings", derive(TS))]
11343pub struct JSONSchema {
11344 #[serde(default)]
11345 pub expressions: Vec<Expression>,
11346}
11347
11348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11350#[cfg_attr(feature = "bindings", derive(TS))]
11351pub struct JSONSet {
11352 pub this: Box<Expression>,
11353 #[serde(default)]
11354 pub expressions: Vec<Expression>,
11355}
11356
11357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11359#[cfg_attr(feature = "bindings", derive(TS))]
11360pub struct JSONStripNulls {
11361 pub this: Box<Expression>,
11362 #[serde(default)]
11363 pub expression: Option<Box<Expression>>,
11364 #[serde(default)]
11365 pub include_arrays: Option<Box<Expression>>,
11366 #[serde(default)]
11367 pub remove_empty: Option<Box<Expression>>,
11368}
11369
11370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11372#[cfg_attr(feature = "bindings", derive(TS))]
11373pub struct JSONValue {
11374 pub this: Box<Expression>,
11375 #[serde(default)]
11376 pub path: Option<Box<Expression>>,
11377 #[serde(default)]
11378 pub returning: Option<Box<Expression>>,
11379 #[serde(default)]
11380 pub on_condition: Option<Box<Expression>>,
11381}
11382
11383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11385#[cfg_attr(feature = "bindings", derive(TS))]
11386pub struct JSONValueArray {
11387 pub this: Box<Expression>,
11388 #[serde(default)]
11389 pub expression: Option<Box<Expression>>,
11390}
11391
11392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11394#[cfg_attr(feature = "bindings", derive(TS))]
11395pub struct JSONRemove {
11396 pub this: Box<Expression>,
11397 #[serde(default)]
11398 pub expressions: Vec<Expression>,
11399}
11400
11401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11403#[cfg_attr(feature = "bindings", derive(TS))]
11404pub struct JSONTable {
11405 pub this: Box<Expression>,
11406 #[serde(default)]
11407 pub schema: Option<Box<Expression>>,
11408 #[serde(default)]
11409 pub path: Option<Box<Expression>>,
11410 #[serde(default)]
11411 pub error_handling: Option<Box<Expression>>,
11412 #[serde(default)]
11413 pub empty_handling: Option<Box<Expression>>,
11414}
11415
11416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11418#[cfg_attr(feature = "bindings", derive(TS))]
11419pub struct JSONType {
11420 pub this: Box<Expression>,
11421 #[serde(default)]
11422 pub expression: Option<Box<Expression>>,
11423}
11424
11425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11427#[cfg_attr(feature = "bindings", derive(TS))]
11428pub struct ObjectInsert {
11429 pub this: Box<Expression>,
11430 #[serde(default)]
11431 pub key: Option<Box<Expression>>,
11432 #[serde(default)]
11433 pub value: Option<Box<Expression>>,
11434 #[serde(default)]
11435 pub update_flag: Option<Box<Expression>>,
11436}
11437
11438#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11440#[cfg_attr(feature = "bindings", derive(TS))]
11441pub struct OpenJSONColumnDef {
11442 pub this: Box<Expression>,
11443 pub kind: String,
11444 #[serde(default)]
11445 pub path: Option<Box<Expression>>,
11446 #[serde(default)]
11447 pub as_json: Option<Box<Expression>>,
11448 #[serde(default, skip_serializing_if = "Option::is_none")]
11450 pub data_type: Option<DataType>,
11451}
11452
11453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11455#[cfg_attr(feature = "bindings", derive(TS))]
11456pub struct OpenJSON {
11457 pub this: Box<Expression>,
11458 #[serde(default)]
11459 pub path: Option<Box<Expression>>,
11460 #[serde(default)]
11461 pub expressions: Vec<Expression>,
11462}
11463
11464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11466#[cfg_attr(feature = "bindings", derive(TS))]
11467pub struct JSONBExists {
11468 pub this: Box<Expression>,
11469 #[serde(default)]
11470 pub path: Option<Box<Expression>>,
11471}
11472
11473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11475#[cfg_attr(feature = "bindings", derive(TS))]
11476pub struct JSONCast {
11477 pub this: Box<Expression>,
11478 pub to: DataType,
11479}
11480
11481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11483#[cfg_attr(feature = "bindings", derive(TS))]
11484pub struct JSONExtract {
11485 pub this: Box<Expression>,
11486 pub expression: Box<Expression>,
11487 #[serde(default)]
11488 pub only_json_types: Option<Box<Expression>>,
11489 #[serde(default)]
11490 pub expressions: Vec<Expression>,
11491 #[serde(default)]
11492 pub variant_extract: Option<Box<Expression>>,
11493 #[serde(default)]
11494 pub json_query: Option<Box<Expression>>,
11495 #[serde(default)]
11496 pub option: Option<Box<Expression>>,
11497 #[serde(default)]
11498 pub quote: Option<Box<Expression>>,
11499 #[serde(default)]
11500 pub on_condition: Option<Box<Expression>>,
11501 #[serde(default)]
11502 pub requires_json: Option<Box<Expression>>,
11503}
11504
11505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11507#[cfg_attr(feature = "bindings", derive(TS))]
11508pub struct JSONExtractQuote {
11509 #[serde(default)]
11510 pub option: Option<Box<Expression>>,
11511 #[serde(default)]
11512 pub scalar: Option<Box<Expression>>,
11513}
11514
11515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11517#[cfg_attr(feature = "bindings", derive(TS))]
11518pub struct JSONExtractArray {
11519 pub this: Box<Expression>,
11520 #[serde(default)]
11521 pub expression: Option<Box<Expression>>,
11522}
11523
11524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11526#[cfg_attr(feature = "bindings", derive(TS))]
11527pub struct JSONExtractScalar {
11528 pub this: Box<Expression>,
11529 pub expression: Box<Expression>,
11530 #[serde(default)]
11531 pub only_json_types: Option<Box<Expression>>,
11532 #[serde(default)]
11533 pub expressions: Vec<Expression>,
11534 #[serde(default)]
11535 pub json_type: Option<Box<Expression>>,
11536 #[serde(default)]
11537 pub scalar_only: Option<Box<Expression>>,
11538}
11539
11540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11542#[cfg_attr(feature = "bindings", derive(TS))]
11543pub struct JSONBExtractScalar {
11544 pub this: Box<Expression>,
11545 pub expression: Box<Expression>,
11546 #[serde(default)]
11547 pub json_type: Option<Box<Expression>>,
11548}
11549
11550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11552#[cfg_attr(feature = "bindings", derive(TS))]
11553pub struct JSONFormat {
11554 #[serde(default)]
11555 pub this: Option<Box<Expression>>,
11556 #[serde(default)]
11557 pub options: Vec<Expression>,
11558 #[serde(default)]
11559 pub is_json: Option<Box<Expression>>,
11560 #[serde(default)]
11561 pub to_json: Option<Box<Expression>>,
11562}
11563
11564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11566#[cfg_attr(feature = "bindings", derive(TS))]
11567pub struct JSONArrayAppend {
11568 pub this: Box<Expression>,
11569 #[serde(default)]
11570 pub expressions: Vec<Expression>,
11571}
11572
11573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11575#[cfg_attr(feature = "bindings", derive(TS))]
11576pub struct JSONArrayContains {
11577 pub this: Box<Expression>,
11578 pub expression: Box<Expression>,
11579 #[serde(default)]
11580 pub json_type: Option<Box<Expression>>,
11581}
11582
11583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11585#[cfg_attr(feature = "bindings", derive(TS))]
11586pub struct JSONArrayInsert {
11587 pub this: Box<Expression>,
11588 #[serde(default)]
11589 pub expressions: Vec<Expression>,
11590}
11591
11592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11594#[cfg_attr(feature = "bindings", derive(TS))]
11595pub struct ParseJSON {
11596 pub this: Box<Expression>,
11597 #[serde(default)]
11598 pub expression: Option<Box<Expression>>,
11599 #[serde(default)]
11600 pub safe: Option<Box<Expression>>,
11601}
11602
11603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11605#[cfg_attr(feature = "bindings", derive(TS))]
11606pub struct ParseUrl {
11607 pub this: Box<Expression>,
11608 #[serde(default)]
11609 pub part_to_extract: Option<Box<Expression>>,
11610 #[serde(default)]
11611 pub key: Option<Box<Expression>>,
11612 #[serde(default)]
11613 pub permissive: Option<Box<Expression>>,
11614}
11615
11616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11618#[cfg_attr(feature = "bindings", derive(TS))]
11619pub struct ParseIp {
11620 pub this: Box<Expression>,
11621 #[serde(default)]
11622 pub type_: Option<Box<Expression>>,
11623 #[serde(default)]
11624 pub permissive: Option<Box<Expression>>,
11625}
11626
11627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11629#[cfg_attr(feature = "bindings", derive(TS))]
11630pub struct ParseTime {
11631 pub this: Box<Expression>,
11632 pub format: String,
11633}
11634
11635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11637#[cfg_attr(feature = "bindings", derive(TS))]
11638pub struct ParseDatetime {
11639 pub this: Box<Expression>,
11640 #[serde(default)]
11641 pub format: Option<String>,
11642 #[serde(default)]
11643 pub zone: Option<Box<Expression>>,
11644}
11645
11646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11648#[cfg_attr(feature = "bindings", derive(TS))]
11649pub struct Map {
11650 #[serde(default)]
11651 pub keys: Vec<Expression>,
11652 #[serde(default)]
11653 pub values: Vec<Expression>,
11654}
11655
11656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11658#[cfg_attr(feature = "bindings", derive(TS))]
11659pub struct MapCat {
11660 pub this: Box<Expression>,
11661 pub expression: Box<Expression>,
11662}
11663
11664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11666#[cfg_attr(feature = "bindings", derive(TS))]
11667pub struct MapDelete {
11668 pub this: Box<Expression>,
11669 #[serde(default)]
11670 pub expressions: Vec<Expression>,
11671}
11672
11673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11675#[cfg_attr(feature = "bindings", derive(TS))]
11676pub struct MapInsert {
11677 pub this: Box<Expression>,
11678 #[serde(default)]
11679 pub key: Option<Box<Expression>>,
11680 #[serde(default)]
11681 pub value: Option<Box<Expression>>,
11682 #[serde(default)]
11683 pub update_flag: Option<Box<Expression>>,
11684}
11685
11686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11688#[cfg_attr(feature = "bindings", derive(TS))]
11689pub struct MapPick {
11690 pub this: Box<Expression>,
11691 #[serde(default)]
11692 pub expressions: Vec<Expression>,
11693}
11694
11695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11697#[cfg_attr(feature = "bindings", derive(TS))]
11698pub struct ScopeResolution {
11699 #[serde(default)]
11700 pub this: Option<Box<Expression>>,
11701 pub expression: Box<Expression>,
11702}
11703
11704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11706#[cfg_attr(feature = "bindings", derive(TS))]
11707pub struct Slice {
11708 #[serde(default)]
11709 pub this: Option<Box<Expression>>,
11710 #[serde(default)]
11711 pub expression: Option<Box<Expression>>,
11712 #[serde(default)]
11713 pub step: Option<Box<Expression>>,
11714}
11715
11716#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11718#[cfg_attr(feature = "bindings", derive(TS))]
11719pub struct VarMap {
11720 #[serde(default)]
11721 pub keys: Vec<Expression>,
11722 #[serde(default)]
11723 pub values: Vec<Expression>,
11724}
11725
11726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11728#[cfg_attr(feature = "bindings", derive(TS))]
11729pub struct MatchAgainst {
11730 pub this: Box<Expression>,
11731 #[serde(default)]
11732 pub expressions: Vec<Expression>,
11733 #[serde(default)]
11734 pub modifier: Option<Box<Expression>>,
11735}
11736
11737#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11739#[cfg_attr(feature = "bindings", derive(TS))]
11740pub struct MD5Digest {
11741 pub this: Box<Expression>,
11742 #[serde(default)]
11743 pub expressions: Vec<Expression>,
11744}
11745
11746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11748#[cfg_attr(feature = "bindings", derive(TS))]
11749pub struct Monthname {
11750 pub this: Box<Expression>,
11751 #[serde(default)]
11752 pub abbreviated: Option<Box<Expression>>,
11753}
11754
11755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11757#[cfg_attr(feature = "bindings", derive(TS))]
11758pub struct Ntile {
11759 #[serde(default)]
11760 pub this: Option<Box<Expression>>,
11761}
11762
11763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11765#[cfg_attr(feature = "bindings", derive(TS))]
11766pub struct Normalize {
11767 pub this: Box<Expression>,
11768 #[serde(default)]
11769 pub form: Option<Box<Expression>>,
11770 #[serde(default)]
11771 pub is_casefold: Option<Box<Expression>>,
11772}
11773
11774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11776#[cfg_attr(feature = "bindings", derive(TS))]
11777pub struct Normal {
11778 pub this: Box<Expression>,
11779 #[serde(default)]
11780 pub stddev: Option<Box<Expression>>,
11781 #[serde(default)]
11782 pub gen: Option<Box<Expression>>,
11783}
11784
11785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11787#[cfg_attr(feature = "bindings", derive(TS))]
11788pub struct Predict {
11789 pub this: Box<Expression>,
11790 pub expression: Box<Expression>,
11791 #[serde(default)]
11792 pub params_struct: Option<Box<Expression>>,
11793}
11794
11795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11797#[cfg_attr(feature = "bindings", derive(TS))]
11798pub struct MLTranslate {
11799 pub this: Box<Expression>,
11800 pub expression: Box<Expression>,
11801 #[serde(default)]
11802 pub params_struct: Option<Box<Expression>>,
11803}
11804
11805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11807#[cfg_attr(feature = "bindings", derive(TS))]
11808pub struct FeaturesAtTime {
11809 pub this: Box<Expression>,
11810 #[serde(default)]
11811 pub time: Option<Box<Expression>>,
11812 #[serde(default)]
11813 pub num_rows: Option<Box<Expression>>,
11814 #[serde(default)]
11815 pub ignore_feature_nulls: Option<Box<Expression>>,
11816}
11817
11818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11820#[cfg_attr(feature = "bindings", derive(TS))]
11821pub struct GenerateEmbedding {
11822 pub this: Box<Expression>,
11823 pub expression: Box<Expression>,
11824 #[serde(default)]
11825 pub params_struct: Option<Box<Expression>>,
11826 #[serde(default)]
11827 pub is_text: Option<Box<Expression>>,
11828}
11829
11830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11832#[cfg_attr(feature = "bindings", derive(TS))]
11833pub struct MLForecast {
11834 pub this: Box<Expression>,
11835 #[serde(default)]
11836 pub expression: Option<Box<Expression>>,
11837 #[serde(default)]
11838 pub params_struct: Option<Box<Expression>>,
11839}
11840
11841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11843#[cfg_attr(feature = "bindings", derive(TS))]
11844pub struct ModelAttribute {
11845 pub this: Box<Expression>,
11846 pub expression: Box<Expression>,
11847}
11848
11849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11851#[cfg_attr(feature = "bindings", derive(TS))]
11852pub struct VectorSearch {
11853 pub this: Box<Expression>,
11854 #[serde(default)]
11855 pub column_to_search: Option<Box<Expression>>,
11856 #[serde(default)]
11857 pub query_table: Option<Box<Expression>>,
11858 #[serde(default)]
11859 pub query_column_to_search: Option<Box<Expression>>,
11860 #[serde(default)]
11861 pub top_k: Option<Box<Expression>>,
11862 #[serde(default)]
11863 pub distance_type: Option<Box<Expression>>,
11864 #[serde(default)]
11865 pub options: Vec<Expression>,
11866}
11867
11868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11870#[cfg_attr(feature = "bindings", derive(TS))]
11871pub struct Quantile {
11872 pub this: Box<Expression>,
11873 #[serde(default)]
11874 pub quantile: Option<Box<Expression>>,
11875}
11876
11877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11879#[cfg_attr(feature = "bindings", derive(TS))]
11880pub struct ApproxQuantile {
11881 pub this: Box<Expression>,
11882 #[serde(default)]
11883 pub quantile: Option<Box<Expression>>,
11884 #[serde(default)]
11885 pub accuracy: Option<Box<Expression>>,
11886 #[serde(default)]
11887 pub weight: Option<Box<Expression>>,
11888 #[serde(default)]
11889 pub error_tolerance: Option<Box<Expression>>,
11890}
11891
11892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11894#[cfg_attr(feature = "bindings", derive(TS))]
11895pub struct ApproxPercentileEstimate {
11896 pub this: Box<Expression>,
11897 #[serde(default)]
11898 pub percentile: Option<Box<Expression>>,
11899}
11900
11901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11903#[cfg_attr(feature = "bindings", derive(TS))]
11904pub struct Randn {
11905 #[serde(default)]
11906 pub this: Option<Box<Expression>>,
11907}
11908
11909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11911#[cfg_attr(feature = "bindings", derive(TS))]
11912pub struct Randstr {
11913 pub this: Box<Expression>,
11914 #[serde(default)]
11915 pub generator: Option<Box<Expression>>,
11916}
11917
11918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11920#[cfg_attr(feature = "bindings", derive(TS))]
11921pub struct RangeN {
11922 pub this: Box<Expression>,
11923 #[serde(default)]
11924 pub expressions: Vec<Expression>,
11925 #[serde(default)]
11926 pub each: Option<Box<Expression>>,
11927}
11928
11929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11931#[cfg_attr(feature = "bindings", derive(TS))]
11932pub struct RangeBucket {
11933 pub this: Box<Expression>,
11934 pub expression: Box<Expression>,
11935}
11936
11937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11939#[cfg_attr(feature = "bindings", derive(TS))]
11940pub struct ReadCSV {
11941 pub this: Box<Expression>,
11942 #[serde(default)]
11943 pub expressions: Vec<Expression>,
11944}
11945
11946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11948#[cfg_attr(feature = "bindings", derive(TS))]
11949pub struct ReadParquet {
11950 #[serde(default)]
11951 pub expressions: Vec<Expression>,
11952}
11953
11954#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11956#[cfg_attr(feature = "bindings", derive(TS))]
11957pub struct Reduce {
11958 pub this: Box<Expression>,
11959 #[serde(default)]
11960 pub initial: Option<Box<Expression>>,
11961 #[serde(default)]
11962 pub merge: Option<Box<Expression>>,
11963 #[serde(default)]
11964 pub finish: Option<Box<Expression>>,
11965}
11966
11967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11969#[cfg_attr(feature = "bindings", derive(TS))]
11970pub struct RegexpExtractAll {
11971 pub this: Box<Expression>,
11972 pub expression: Box<Expression>,
11973 #[serde(default)]
11974 pub group: Option<Box<Expression>>,
11975 #[serde(default)]
11976 pub parameters: Option<Box<Expression>>,
11977 #[serde(default)]
11978 pub position: Option<Box<Expression>>,
11979 #[serde(default)]
11980 pub occurrence: Option<Box<Expression>>,
11981}
11982
11983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11985#[cfg_attr(feature = "bindings", derive(TS))]
11986pub struct RegexpILike {
11987 pub this: Box<Expression>,
11988 pub expression: Box<Expression>,
11989 #[serde(default)]
11990 pub flag: Option<Box<Expression>>,
11991}
11992
11993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11995#[cfg_attr(feature = "bindings", derive(TS))]
11996pub struct RegexpFullMatch {
11997 pub this: Box<Expression>,
11998 pub expression: Box<Expression>,
11999 #[serde(default)]
12000 pub options: Vec<Expression>,
12001}
12002
12003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12005#[cfg_attr(feature = "bindings", derive(TS))]
12006pub struct RegexpInstr {
12007 pub this: Box<Expression>,
12008 pub expression: Box<Expression>,
12009 #[serde(default)]
12010 pub position: Option<Box<Expression>>,
12011 #[serde(default)]
12012 pub occurrence: Option<Box<Expression>>,
12013 #[serde(default)]
12014 pub option: Option<Box<Expression>>,
12015 #[serde(default)]
12016 pub parameters: Option<Box<Expression>>,
12017 #[serde(default)]
12018 pub group: Option<Box<Expression>>,
12019}
12020
12021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12023#[cfg_attr(feature = "bindings", derive(TS))]
12024pub struct RegexpSplit {
12025 pub this: Box<Expression>,
12026 pub expression: Box<Expression>,
12027 #[serde(default)]
12028 pub limit: Option<Box<Expression>>,
12029}
12030
12031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12033#[cfg_attr(feature = "bindings", derive(TS))]
12034pub struct RegexpCount {
12035 pub this: Box<Expression>,
12036 pub expression: Box<Expression>,
12037 #[serde(default)]
12038 pub position: Option<Box<Expression>>,
12039 #[serde(default)]
12040 pub parameters: Option<Box<Expression>>,
12041}
12042
12043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12045#[cfg_attr(feature = "bindings", derive(TS))]
12046pub struct RegrValx {
12047 pub this: Box<Expression>,
12048 pub expression: Box<Expression>,
12049}
12050
12051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12053#[cfg_attr(feature = "bindings", derive(TS))]
12054pub struct RegrValy {
12055 pub this: Box<Expression>,
12056 pub expression: Box<Expression>,
12057}
12058
12059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12061#[cfg_attr(feature = "bindings", derive(TS))]
12062pub struct RegrAvgy {
12063 pub this: Box<Expression>,
12064 pub expression: Box<Expression>,
12065}
12066
12067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12069#[cfg_attr(feature = "bindings", derive(TS))]
12070pub struct RegrAvgx {
12071 pub this: Box<Expression>,
12072 pub expression: Box<Expression>,
12073}
12074
12075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12077#[cfg_attr(feature = "bindings", derive(TS))]
12078pub struct RegrCount {
12079 pub this: Box<Expression>,
12080 pub expression: Box<Expression>,
12081}
12082
12083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12085#[cfg_attr(feature = "bindings", derive(TS))]
12086pub struct RegrIntercept {
12087 pub this: Box<Expression>,
12088 pub expression: Box<Expression>,
12089}
12090
12091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12093#[cfg_attr(feature = "bindings", derive(TS))]
12094pub struct RegrR2 {
12095 pub this: Box<Expression>,
12096 pub expression: Box<Expression>,
12097}
12098
12099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12101#[cfg_attr(feature = "bindings", derive(TS))]
12102pub struct RegrSxx {
12103 pub this: Box<Expression>,
12104 pub expression: Box<Expression>,
12105}
12106
12107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12109#[cfg_attr(feature = "bindings", derive(TS))]
12110pub struct RegrSxy {
12111 pub this: Box<Expression>,
12112 pub expression: Box<Expression>,
12113}
12114
12115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12117#[cfg_attr(feature = "bindings", derive(TS))]
12118pub struct RegrSyy {
12119 pub this: Box<Expression>,
12120 pub expression: Box<Expression>,
12121}
12122
12123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12125#[cfg_attr(feature = "bindings", derive(TS))]
12126pub struct RegrSlope {
12127 pub this: Box<Expression>,
12128 pub expression: Box<Expression>,
12129}
12130
12131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12133#[cfg_attr(feature = "bindings", derive(TS))]
12134pub struct SafeAdd {
12135 pub this: Box<Expression>,
12136 pub expression: Box<Expression>,
12137}
12138
12139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12141#[cfg_attr(feature = "bindings", derive(TS))]
12142pub struct SafeDivide {
12143 pub this: Box<Expression>,
12144 pub expression: Box<Expression>,
12145}
12146
12147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12149#[cfg_attr(feature = "bindings", derive(TS))]
12150pub struct SafeMultiply {
12151 pub this: Box<Expression>,
12152 pub expression: Box<Expression>,
12153}
12154
12155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12157#[cfg_attr(feature = "bindings", derive(TS))]
12158pub struct SafeSubtract {
12159 pub this: Box<Expression>,
12160 pub expression: Box<Expression>,
12161}
12162
12163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12165#[cfg_attr(feature = "bindings", derive(TS))]
12166pub struct SHA2 {
12167 pub this: Box<Expression>,
12168 #[serde(default)]
12169 pub length: Option<i64>,
12170}
12171
12172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12174#[cfg_attr(feature = "bindings", derive(TS))]
12175pub struct SHA2Digest {
12176 pub this: Box<Expression>,
12177 #[serde(default)]
12178 pub length: Option<i64>,
12179}
12180
12181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12183#[cfg_attr(feature = "bindings", derive(TS))]
12184pub struct SortArray {
12185 pub this: Box<Expression>,
12186 #[serde(default)]
12187 pub asc: Option<Box<Expression>>,
12188 #[serde(default)]
12189 pub nulls_first: Option<Box<Expression>>,
12190}
12191
12192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12194#[cfg_attr(feature = "bindings", derive(TS))]
12195pub struct SplitPart {
12196 pub this: Box<Expression>,
12197 #[serde(default)]
12198 pub delimiter: Option<Box<Expression>>,
12199 #[serde(default)]
12200 pub part_index: Option<Box<Expression>>,
12201}
12202
12203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12205#[cfg_attr(feature = "bindings", derive(TS))]
12206pub struct SubstringIndex {
12207 pub this: Box<Expression>,
12208 #[serde(default)]
12209 pub delimiter: Option<Box<Expression>>,
12210 #[serde(default)]
12211 pub count: Option<Box<Expression>>,
12212}
12213
12214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12216#[cfg_attr(feature = "bindings", derive(TS))]
12217pub struct StandardHash {
12218 pub this: Box<Expression>,
12219 #[serde(default)]
12220 pub expression: Option<Box<Expression>>,
12221}
12222
12223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12225#[cfg_attr(feature = "bindings", derive(TS))]
12226pub struct StrPosition {
12227 pub this: Box<Expression>,
12228 #[serde(default)]
12229 pub substr: Option<Box<Expression>>,
12230 #[serde(default)]
12231 pub position: Option<Box<Expression>>,
12232 #[serde(default)]
12233 pub occurrence: Option<Box<Expression>>,
12234}
12235
12236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12238#[cfg_attr(feature = "bindings", derive(TS))]
12239pub struct Search {
12240 pub this: Box<Expression>,
12241 pub expression: Box<Expression>,
12242 #[serde(default)]
12243 pub json_scope: Option<Box<Expression>>,
12244 #[serde(default)]
12245 pub analyzer: Option<Box<Expression>>,
12246 #[serde(default)]
12247 pub analyzer_options: Option<Box<Expression>>,
12248 #[serde(default)]
12249 pub search_mode: Option<Box<Expression>>,
12250}
12251
12252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12254#[cfg_attr(feature = "bindings", derive(TS))]
12255pub struct SearchIp {
12256 pub this: Box<Expression>,
12257 pub expression: Box<Expression>,
12258}
12259
12260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12262#[cfg_attr(feature = "bindings", derive(TS))]
12263pub struct StrToDate {
12264 pub this: Box<Expression>,
12265 #[serde(default)]
12266 pub format: Option<String>,
12267 #[serde(default)]
12268 pub safe: Option<Box<Expression>>,
12269}
12270
12271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12273#[cfg_attr(feature = "bindings", derive(TS))]
12274pub struct StrToTime {
12275 pub this: Box<Expression>,
12276 pub format: String,
12277 #[serde(default)]
12278 pub zone: Option<Box<Expression>>,
12279 #[serde(default)]
12280 pub safe: Option<Box<Expression>>,
12281 #[serde(default)]
12282 pub target_type: Option<Box<Expression>>,
12283}
12284
12285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12287#[cfg_attr(feature = "bindings", derive(TS))]
12288pub struct StrToUnix {
12289 #[serde(default)]
12290 pub this: Option<Box<Expression>>,
12291 #[serde(default)]
12292 pub format: Option<String>,
12293}
12294
12295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12297#[cfg_attr(feature = "bindings", derive(TS))]
12298pub struct StrToMap {
12299 pub this: Box<Expression>,
12300 #[serde(default)]
12301 pub pair_delim: Option<Box<Expression>>,
12302 #[serde(default)]
12303 pub key_value_delim: Option<Box<Expression>>,
12304 #[serde(default)]
12305 pub duplicate_resolution_callback: Option<Box<Expression>>,
12306}
12307
12308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12310#[cfg_attr(feature = "bindings", derive(TS))]
12311pub struct NumberToStr {
12312 pub this: Box<Expression>,
12313 pub format: String,
12314 #[serde(default)]
12315 pub culture: Option<Box<Expression>>,
12316}
12317
12318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12320#[cfg_attr(feature = "bindings", derive(TS))]
12321pub struct FromBase {
12322 pub this: Box<Expression>,
12323 pub expression: Box<Expression>,
12324}
12325
12326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12328#[cfg_attr(feature = "bindings", derive(TS))]
12329pub struct Stuff {
12330 pub this: Box<Expression>,
12331 #[serde(default)]
12332 pub start: Option<Box<Expression>>,
12333 #[serde(default)]
12334 pub length: Option<i64>,
12335 pub expression: Box<Expression>,
12336}
12337
12338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12340#[cfg_attr(feature = "bindings", derive(TS))]
12341pub struct TimeToStr {
12342 pub this: Box<Expression>,
12343 pub format: String,
12344 #[serde(default)]
12345 pub culture: Option<Box<Expression>>,
12346 #[serde(default)]
12347 pub zone: Option<Box<Expression>>,
12348}
12349
12350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12352#[cfg_attr(feature = "bindings", derive(TS))]
12353pub struct TimeStrToTime {
12354 pub this: Box<Expression>,
12355 #[serde(default)]
12356 pub zone: Option<Box<Expression>>,
12357}
12358
12359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12361#[cfg_attr(feature = "bindings", derive(TS))]
12362pub struct TsOrDsAdd {
12363 pub this: Box<Expression>,
12364 pub expression: Box<Expression>,
12365 #[serde(default)]
12366 pub unit: Option<String>,
12367 #[serde(default)]
12368 pub return_type: Option<Box<Expression>>,
12369}
12370
12371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12373#[cfg_attr(feature = "bindings", derive(TS))]
12374pub struct TsOrDsDiff {
12375 pub this: Box<Expression>,
12376 pub expression: Box<Expression>,
12377 #[serde(default)]
12378 pub unit: Option<String>,
12379}
12380
12381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12383#[cfg_attr(feature = "bindings", derive(TS))]
12384pub struct TsOrDsToDate {
12385 pub this: Box<Expression>,
12386 #[serde(default)]
12387 pub format: Option<String>,
12388 #[serde(default)]
12389 pub safe: Option<Box<Expression>>,
12390}
12391
12392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12394#[cfg_attr(feature = "bindings", derive(TS))]
12395pub struct TsOrDsToTime {
12396 pub this: Box<Expression>,
12397 #[serde(default)]
12398 pub format: Option<String>,
12399 #[serde(default)]
12400 pub safe: Option<Box<Expression>>,
12401}
12402
12403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12405#[cfg_attr(feature = "bindings", derive(TS))]
12406pub struct Unhex {
12407 pub this: Box<Expression>,
12408 #[serde(default)]
12409 pub expression: Option<Box<Expression>>,
12410}
12411
12412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12414#[cfg_attr(feature = "bindings", derive(TS))]
12415pub struct Uniform {
12416 pub this: Box<Expression>,
12417 pub expression: Box<Expression>,
12418 #[serde(default)]
12419 pub gen: Option<Box<Expression>>,
12420 #[serde(default)]
12421 pub seed: Option<Box<Expression>>,
12422}
12423
12424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12426#[cfg_attr(feature = "bindings", derive(TS))]
12427pub struct UnixToStr {
12428 pub this: Box<Expression>,
12429 #[serde(default)]
12430 pub format: Option<String>,
12431}
12432
12433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12435#[cfg_attr(feature = "bindings", derive(TS))]
12436pub struct UnixToTime {
12437 pub this: Box<Expression>,
12438 #[serde(default)]
12439 pub scale: Option<i64>,
12440 #[serde(default)]
12441 pub zone: Option<Box<Expression>>,
12442 #[serde(default)]
12443 pub hours: Option<Box<Expression>>,
12444 #[serde(default)]
12445 pub minutes: Option<Box<Expression>>,
12446 #[serde(default)]
12447 pub format: Option<String>,
12448 #[serde(default)]
12449 pub target_type: Option<Box<Expression>>,
12450}
12451
12452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12454#[cfg_attr(feature = "bindings", derive(TS))]
12455pub struct Uuid {
12456 #[serde(default)]
12457 pub this: Option<Box<Expression>>,
12458 #[serde(default)]
12459 pub name: Option<String>,
12460 #[serde(default)]
12461 pub is_string: Option<Box<Expression>>,
12462}
12463
12464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12466#[cfg_attr(feature = "bindings", derive(TS))]
12467pub struct TimestampFromParts {
12468 #[serde(default)]
12469 pub zone: Option<Box<Expression>>,
12470 #[serde(default)]
12471 pub milli: Option<Box<Expression>>,
12472 #[serde(default)]
12473 pub this: Option<Box<Expression>>,
12474 #[serde(default)]
12475 pub expression: Option<Box<Expression>>,
12476}
12477
12478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12480#[cfg_attr(feature = "bindings", derive(TS))]
12481pub struct TimestampTzFromParts {
12482 #[serde(default)]
12483 pub zone: Option<Box<Expression>>,
12484}
12485
12486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12488#[cfg_attr(feature = "bindings", derive(TS))]
12489pub struct Corr {
12490 pub this: Box<Expression>,
12491 pub expression: Box<Expression>,
12492 #[serde(default)]
12493 pub null_on_zero_variance: Option<Box<Expression>>,
12494}
12495
12496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12498#[cfg_attr(feature = "bindings", derive(TS))]
12499pub struct WidthBucket {
12500 pub this: Box<Expression>,
12501 #[serde(default)]
12502 pub min_value: Option<Box<Expression>>,
12503 #[serde(default)]
12504 pub max_value: Option<Box<Expression>>,
12505 #[serde(default)]
12506 pub num_buckets: Option<Box<Expression>>,
12507 #[serde(default)]
12508 pub threshold: Option<Box<Expression>>,
12509}
12510
12511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12513#[cfg_attr(feature = "bindings", derive(TS))]
12514pub struct CovarSamp {
12515 pub this: Box<Expression>,
12516 pub expression: Box<Expression>,
12517}
12518
12519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12521#[cfg_attr(feature = "bindings", derive(TS))]
12522pub struct CovarPop {
12523 pub this: Box<Expression>,
12524 pub expression: Box<Expression>,
12525}
12526
12527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12529#[cfg_attr(feature = "bindings", derive(TS))]
12530pub struct Week {
12531 pub this: Box<Expression>,
12532 #[serde(default)]
12533 pub mode: Option<Box<Expression>>,
12534}
12535
12536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12538#[cfg_attr(feature = "bindings", derive(TS))]
12539pub struct XMLElement {
12540 pub this: Box<Expression>,
12541 #[serde(default)]
12542 pub expressions: Vec<Expression>,
12543 #[serde(default)]
12544 pub evalname: Option<Box<Expression>>,
12545}
12546
12547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12549#[cfg_attr(feature = "bindings", derive(TS))]
12550pub struct XMLGet {
12551 pub this: Box<Expression>,
12552 pub expression: Box<Expression>,
12553 #[serde(default)]
12554 pub instance: Option<Box<Expression>>,
12555}
12556
12557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12559#[cfg_attr(feature = "bindings", derive(TS))]
12560pub struct XMLTable {
12561 pub this: Box<Expression>,
12562 #[serde(default)]
12563 pub namespaces: Option<Box<Expression>>,
12564 #[serde(default)]
12565 pub passing: Option<Box<Expression>>,
12566 #[serde(default)]
12567 pub columns: Vec<Expression>,
12568 #[serde(default)]
12569 pub by_ref: Option<Box<Expression>>,
12570}
12571
12572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12574#[cfg_attr(feature = "bindings", derive(TS))]
12575pub struct XMLKeyValueOption {
12576 pub this: Box<Expression>,
12577 #[serde(default)]
12578 pub expression: Option<Box<Expression>>,
12579}
12580
12581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12583#[cfg_attr(feature = "bindings", derive(TS))]
12584pub struct Zipf {
12585 pub this: Box<Expression>,
12586 #[serde(default)]
12587 pub elementcount: Option<Box<Expression>>,
12588 #[serde(default)]
12589 pub gen: Option<Box<Expression>>,
12590}
12591
12592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12594#[cfg_attr(feature = "bindings", derive(TS))]
12595pub struct Merge {
12596 pub this: Box<Expression>,
12597 pub using: Box<Expression>,
12598 #[serde(default)]
12599 pub on: Option<Box<Expression>>,
12600 #[serde(default)]
12601 pub using_cond: Option<Box<Expression>>,
12602 #[serde(default)]
12603 pub whens: Option<Box<Expression>>,
12604 #[serde(default)]
12605 pub with_: Option<Box<Expression>>,
12606 #[serde(default)]
12607 pub returning: Option<Box<Expression>>,
12608}
12609
12610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12612#[cfg_attr(feature = "bindings", derive(TS))]
12613pub struct When {
12614 #[serde(default)]
12615 pub matched: Option<Box<Expression>>,
12616 #[serde(default)]
12617 pub source: Option<Box<Expression>>,
12618 #[serde(default)]
12619 pub condition: Option<Box<Expression>>,
12620 pub then: Box<Expression>,
12621}
12622
12623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12625#[cfg_attr(feature = "bindings", derive(TS))]
12626pub struct Whens {
12627 #[serde(default)]
12628 pub expressions: Vec<Expression>,
12629}
12630
12631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12633#[cfg_attr(feature = "bindings", derive(TS))]
12634pub struct NextValueFor {
12635 pub this: Box<Expression>,
12636 #[serde(default)]
12637 pub order: Option<Box<Expression>>,
12638}
12639
12640#[cfg(test)]
12641mod tests {
12642 use super::*;
12643
12644 #[test]
12645 #[cfg(feature = "bindings")]
12646 fn export_typescript_types() {
12647 Expression::export_all(&ts_rs::Config::default())
12650 .expect("Failed to export Expression types");
12651 }
12652
12653 #[test]
12654 fn test_simple_select_builder() {
12655 let select = Select::new()
12656 .column(Expression::star())
12657 .from(Expression::Table(TableRef::new("users")));
12658
12659 assert_eq!(select.expressions.len(), 1);
12660 assert!(select.from.is_some());
12661 }
12662
12663 #[test]
12664 fn test_expression_alias() {
12665 let expr = Expression::column("id").alias("user_id");
12666
12667 match expr {
12668 Expression::Alias(a) => {
12669 assert_eq!(a.alias.name, "user_id");
12670 }
12671 _ => panic!("Expected Alias"),
12672 }
12673 }
12674
12675 #[test]
12676 fn test_literal_creation() {
12677 let num = Expression::number(42);
12678 let str = Expression::string("hello");
12679
12680 match num {
12681 Expression::Literal(Literal::Number(n)) => assert_eq!(n, "42"),
12682 _ => panic!("Expected Number"),
12683 }
12684
12685 match str {
12686 Expression::Literal(Literal::String(s)) => assert_eq!(s, "hello"),
12687 _ => panic!("Expected String"),
12688 }
12689 }
12690
12691 #[test]
12692 fn test_expression_sql() {
12693 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
12694 assert_eq!(expr.sql(), "SELECT 1 + 2");
12695 }
12696
12697 #[test]
12698 fn test_expression_sql_for() {
12699 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
12700 let sql = expr.sql_for(crate::DialectType::Generic);
12701 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
12703 }
12704}