1use serde::{Deserialize, Serialize};
34use std::fmt;
35#[cfg(feature = "bindings")]
36use ts_rs::TS;
37
38fn default_true() -> bool {
40 true
41}
42
43fn is_true(v: &bool) -> bool {
44 *v
45}
46
47#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
76#[cfg_attr(feature = "bindings", derive(TS))]
77#[serde(rename_all = "snake_case")]
78#[cfg_attr(feature = "bindings", ts(export))]
79pub enum Expression {
80 Literal(Literal),
82 Boolean(BooleanLiteral),
83 Null(Null),
84
85 Identifier(Identifier),
87 Column(Column),
88 Table(TableRef),
89 Star(Star),
90 BracedWildcard(Box<Expression>),
92
93 Select(Box<Select>),
95 Union(Box<Union>),
96 Intersect(Box<Intersect>),
97 Except(Box<Except>),
98 Subquery(Box<Subquery>),
99 PipeOperator(Box<PipeOperator>),
100 Pivot(Box<Pivot>),
101 PivotAlias(Box<PivotAlias>),
102 Unpivot(Box<Unpivot>),
103 Values(Box<Values>),
104 PreWhere(Box<PreWhere>),
105 Stream(Box<Stream>),
106 UsingData(Box<UsingData>),
107 XmlNamespace(Box<XmlNamespace>),
108
109 Insert(Box<Insert>),
111 Update(Box<Update>),
112 Delete(Box<Delete>),
113 Copy(Box<CopyStmt>),
114 Put(Box<PutStmt>),
115 StageReference(Box<StageReference>),
116
117 Alias(Box<Alias>),
119 Cast(Box<Cast>),
120 Collation(Box<CollationExpr>),
121 Case(Box<Case>),
122
123 And(Box<BinaryOp>),
125 Or(Box<BinaryOp>),
126 Add(Box<BinaryOp>),
127 Sub(Box<BinaryOp>),
128 Mul(Box<BinaryOp>),
129 Div(Box<BinaryOp>),
130 Mod(Box<BinaryOp>),
131 Eq(Box<BinaryOp>),
132 Neq(Box<BinaryOp>),
133 Lt(Box<BinaryOp>),
134 Lte(Box<BinaryOp>),
135 Gt(Box<BinaryOp>),
136 Gte(Box<BinaryOp>),
137 Like(Box<LikeOp>),
138 ILike(Box<LikeOp>),
139 Match(Box<BinaryOp>),
141 BitwiseAnd(Box<BinaryOp>),
142 BitwiseOr(Box<BinaryOp>),
143 BitwiseXor(Box<BinaryOp>),
144 Concat(Box<BinaryOp>),
145 Adjacent(Box<BinaryOp>), TsMatch(Box<BinaryOp>), PropertyEQ(Box<BinaryOp>), ArrayContainsAll(Box<BinaryOp>), ArrayContainedBy(Box<BinaryOp>), ArrayOverlaps(Box<BinaryOp>), JSONBContainsAllTopKeys(Box<BinaryOp>), JSONBContainsAnyTopKeys(Box<BinaryOp>), JSONBDeleteAtPath(Box<BinaryOp>), ExtendsLeft(Box<BinaryOp>), ExtendsRight(Box<BinaryOp>), Not(Box<UnaryOp>),
161 Neg(Box<UnaryOp>),
162 BitwiseNot(Box<UnaryOp>),
163
164 In(Box<In>),
166 Between(Box<Between>),
167 IsNull(Box<IsNull>),
168 IsTrue(Box<IsTrueFalse>),
169 IsFalse(Box<IsTrueFalse>),
170 IsJson(Box<IsJson>),
171 Is(Box<BinaryOp>), Exists(Box<Exists>),
173 MemberOf(Box<BinaryOp>),
175
176 Function(Box<Function>),
178 AggregateFunction(Box<AggregateFunction>),
179 WindowFunction(Box<WindowFunction>),
180
181 From(Box<From>),
183 Join(Box<Join>),
184 JoinedTable(Box<JoinedTable>),
185 Where(Box<Where>),
186 GroupBy(Box<GroupBy>),
187 Having(Box<Having>),
188 OrderBy(Box<OrderBy>),
189 Limit(Box<Limit>),
190 Offset(Box<Offset>),
191 Qualify(Box<Qualify>),
192 With(Box<With>),
193 Cte(Box<Cte>),
194 DistributeBy(Box<DistributeBy>),
195 ClusterBy(Box<ClusterBy>),
196 SortBy(Box<SortBy>),
197 LateralView(Box<LateralView>),
198 Hint(Box<Hint>),
199 Pseudocolumn(Pseudocolumn),
200
201 Connect(Box<Connect>),
203 Prior(Box<Prior>),
204 ConnectByRoot(Box<ConnectByRoot>),
205
206 MatchRecognize(Box<MatchRecognize>),
208
209 Ordered(Box<Ordered>),
211
212 Window(Box<WindowSpec>),
214 Over(Box<Over>),
215 WithinGroup(Box<WithinGroup>),
216
217 DataType(DataType),
219
220 Array(Box<Array>),
222 Struct(Box<Struct>),
223 Tuple(Box<Tuple>),
224
225 Interval(Box<Interval>),
227
228 ConcatWs(Box<ConcatWs>),
230 Substring(Box<SubstringFunc>),
231 Upper(Box<UnaryFunc>),
232 Lower(Box<UnaryFunc>),
233 Length(Box<UnaryFunc>),
234 Trim(Box<TrimFunc>),
235 LTrim(Box<UnaryFunc>),
236 RTrim(Box<UnaryFunc>),
237 Replace(Box<ReplaceFunc>),
238 Reverse(Box<UnaryFunc>),
239 Left(Box<LeftRightFunc>),
240 Right(Box<LeftRightFunc>),
241 Repeat(Box<RepeatFunc>),
242 Lpad(Box<PadFunc>),
243 Rpad(Box<PadFunc>),
244 Split(Box<SplitFunc>),
245 RegexpLike(Box<RegexpFunc>),
246 RegexpReplace(Box<RegexpReplaceFunc>),
247 RegexpExtract(Box<RegexpExtractFunc>),
248 Overlay(Box<OverlayFunc>),
249
250 Abs(Box<UnaryFunc>),
252 Round(Box<RoundFunc>),
253 Floor(Box<FloorFunc>),
254 Ceil(Box<CeilFunc>),
255 Power(Box<BinaryFunc>),
256 Sqrt(Box<UnaryFunc>),
257 Cbrt(Box<UnaryFunc>),
258 Ln(Box<UnaryFunc>),
259 Log(Box<LogFunc>),
260 Exp(Box<UnaryFunc>),
261 Sign(Box<UnaryFunc>),
262 Greatest(Box<VarArgFunc>),
263 Least(Box<VarArgFunc>),
264
265 CurrentDate(CurrentDate),
267 CurrentTime(CurrentTime),
268 CurrentTimestamp(CurrentTimestamp),
269 CurrentTimestampLTZ(CurrentTimestampLTZ),
270 AtTimeZone(Box<AtTimeZone>),
271 DateAdd(Box<DateAddFunc>),
272 DateSub(Box<DateAddFunc>),
273 DateDiff(Box<DateDiffFunc>),
274 DateTrunc(Box<DateTruncFunc>),
275 Extract(Box<ExtractFunc>),
276 ToDate(Box<ToDateFunc>),
277 ToTimestamp(Box<ToTimestampFunc>),
278 Date(Box<UnaryFunc>),
279 Time(Box<UnaryFunc>),
280 DateFromUnixDate(Box<UnaryFunc>),
281 UnixDate(Box<UnaryFunc>),
282 UnixSeconds(Box<UnaryFunc>),
283 UnixMillis(Box<UnaryFunc>),
284 UnixMicros(Box<UnaryFunc>),
285 UnixToTimeStr(Box<BinaryFunc>),
286 TimeStrToDate(Box<UnaryFunc>),
287 DateToDi(Box<UnaryFunc>),
288 DiToDate(Box<UnaryFunc>),
289 TsOrDiToDi(Box<UnaryFunc>),
290 TsOrDsToDatetime(Box<UnaryFunc>),
291 TsOrDsToTimestamp(Box<UnaryFunc>),
292 YearOfWeek(Box<UnaryFunc>),
293 YearOfWeekIso(Box<UnaryFunc>),
294
295 Coalesce(Box<VarArgFunc>),
297 NullIf(Box<BinaryFunc>),
298 IfFunc(Box<IfFunc>),
299 IfNull(Box<BinaryFunc>),
300 Nvl(Box<BinaryFunc>),
301 Nvl2(Box<Nvl2Func>),
302
303 TryCast(Box<Cast>),
305 SafeCast(Box<Cast>),
306
307 Count(Box<CountFunc>),
309 Sum(Box<AggFunc>),
310 Avg(Box<AggFunc>),
311 Min(Box<AggFunc>),
312 Max(Box<AggFunc>),
313 GroupConcat(Box<GroupConcatFunc>),
314 StringAgg(Box<StringAggFunc>),
315 ListAgg(Box<ListAggFunc>),
316 ArrayAgg(Box<AggFunc>),
317 CountIf(Box<AggFunc>),
318 SumIf(Box<SumIfFunc>),
319 Stddev(Box<AggFunc>),
320 StddevPop(Box<AggFunc>),
321 StddevSamp(Box<AggFunc>),
322 Variance(Box<AggFunc>),
323 VarPop(Box<AggFunc>),
324 VarSamp(Box<AggFunc>),
325 Median(Box<AggFunc>),
326 Mode(Box<AggFunc>),
327 First(Box<AggFunc>),
328 Last(Box<AggFunc>),
329 AnyValue(Box<AggFunc>),
330 ApproxDistinct(Box<AggFunc>),
331 ApproxCountDistinct(Box<AggFunc>),
332 ApproxPercentile(Box<ApproxPercentileFunc>),
333 Percentile(Box<PercentileFunc>),
334 LogicalAnd(Box<AggFunc>),
335 LogicalOr(Box<AggFunc>),
336 Skewness(Box<AggFunc>),
337 BitwiseCount(Box<UnaryFunc>),
338 ArrayConcatAgg(Box<AggFunc>),
339 ArrayUniqueAgg(Box<AggFunc>),
340 BoolXorAgg(Box<AggFunc>),
341
342 RowNumber(RowNumber),
344 Rank(Rank),
345 DenseRank(DenseRank),
346 NTile(Box<NTileFunc>),
347 Lead(Box<LeadLagFunc>),
348 Lag(Box<LeadLagFunc>),
349 FirstValue(Box<ValueFunc>),
350 LastValue(Box<ValueFunc>),
351 NthValue(Box<NthValueFunc>),
352 PercentRank(PercentRank),
353 CumeDist(CumeDist),
354 PercentileCont(Box<PercentileFunc>),
355 PercentileDisc(Box<PercentileFunc>),
356
357 Contains(Box<BinaryFunc>),
359 StartsWith(Box<BinaryFunc>),
360 EndsWith(Box<BinaryFunc>),
361 Position(Box<PositionFunc>),
362 Initcap(Box<UnaryFunc>),
363 Ascii(Box<UnaryFunc>),
364 Chr(Box<UnaryFunc>),
365 CharFunc(Box<CharFunc>),
367 Soundex(Box<UnaryFunc>),
368 Levenshtein(Box<BinaryFunc>),
369 ByteLength(Box<UnaryFunc>),
370 Hex(Box<UnaryFunc>),
371 LowerHex(Box<UnaryFunc>),
372 Unicode(Box<UnaryFunc>),
373
374 ModFunc(Box<BinaryFunc>),
376 Random(Random),
377 Rand(Box<Rand>),
378 TruncFunc(Box<TruncateFunc>),
379 Pi(Pi),
380 Radians(Box<UnaryFunc>),
381 Degrees(Box<UnaryFunc>),
382 Sin(Box<UnaryFunc>),
383 Cos(Box<UnaryFunc>),
384 Tan(Box<UnaryFunc>),
385 Asin(Box<UnaryFunc>),
386 Acos(Box<UnaryFunc>),
387 Atan(Box<UnaryFunc>),
388 Atan2(Box<BinaryFunc>),
389 IsNan(Box<UnaryFunc>),
390 IsInf(Box<UnaryFunc>),
391 IntDiv(Box<BinaryFunc>),
392
393 Decode(Box<DecodeFunc>),
395
396 DateFormat(Box<DateFormatFunc>),
398 FormatDate(Box<DateFormatFunc>),
399 Year(Box<UnaryFunc>),
400 Month(Box<UnaryFunc>),
401 Day(Box<UnaryFunc>),
402 Hour(Box<UnaryFunc>),
403 Minute(Box<UnaryFunc>),
404 Second(Box<UnaryFunc>),
405 DayOfWeek(Box<UnaryFunc>),
406 DayOfWeekIso(Box<UnaryFunc>),
407 DayOfMonth(Box<UnaryFunc>),
408 DayOfYear(Box<UnaryFunc>),
409 WeekOfYear(Box<UnaryFunc>),
410 Quarter(Box<UnaryFunc>),
411 AddMonths(Box<BinaryFunc>),
412 MonthsBetween(Box<BinaryFunc>),
413 LastDay(Box<LastDayFunc>),
414 NextDay(Box<BinaryFunc>),
415 Epoch(Box<UnaryFunc>),
416 EpochMs(Box<UnaryFunc>),
417 FromUnixtime(Box<FromUnixtimeFunc>),
418 UnixTimestamp(Box<UnixTimestampFunc>),
419 MakeDate(Box<MakeDateFunc>),
420 MakeTimestamp(Box<MakeTimestampFunc>),
421 TimestampTrunc(Box<DateTruncFunc>),
422 TimeStrToUnix(Box<UnaryFunc>),
423
424 SessionUser(SessionUser),
426
427 SHA(Box<UnaryFunc>),
429 SHA1Digest(Box<UnaryFunc>),
430
431 TimeToUnix(Box<UnaryFunc>),
433
434 ArrayFunc(Box<ArrayConstructor>),
436 ArrayLength(Box<UnaryFunc>),
437 ArraySize(Box<UnaryFunc>),
438 Cardinality(Box<UnaryFunc>),
439 ArrayContains(Box<BinaryFunc>),
440 ArrayPosition(Box<BinaryFunc>),
441 ArrayAppend(Box<BinaryFunc>),
442 ArrayPrepend(Box<BinaryFunc>),
443 ArrayConcat(Box<VarArgFunc>),
444 ArraySort(Box<ArraySortFunc>),
445 ArrayReverse(Box<UnaryFunc>),
446 ArrayDistinct(Box<UnaryFunc>),
447 ArrayJoin(Box<ArrayJoinFunc>),
448 ArrayToString(Box<ArrayJoinFunc>),
449 Unnest(Box<UnnestFunc>),
450 Explode(Box<UnaryFunc>),
451 ExplodeOuter(Box<UnaryFunc>),
452 ArrayFilter(Box<ArrayFilterFunc>),
453 ArrayTransform(Box<ArrayTransformFunc>),
454 ArrayFlatten(Box<UnaryFunc>),
455 ArrayCompact(Box<UnaryFunc>),
456 ArrayIntersect(Box<BinaryFunc>),
457 ArrayUnion(Box<BinaryFunc>),
458 ArrayExcept(Box<BinaryFunc>),
459 ArrayRemove(Box<BinaryFunc>),
460 ArrayZip(Box<VarArgFunc>),
461 Sequence(Box<SequenceFunc>),
462 Generate(Box<SequenceFunc>),
463 ExplodingGenerateSeries(Box<SequenceFunc>),
464 ToArray(Box<UnaryFunc>),
465 StarMap(Box<BinaryFunc>),
466
467 StructFunc(Box<StructConstructor>),
469 StructExtract(Box<StructExtractFunc>),
470 NamedStruct(Box<NamedStructFunc>),
471
472 MapFunc(Box<MapConstructor>),
474 MapFromEntries(Box<UnaryFunc>),
475 MapFromArrays(Box<BinaryFunc>),
476 MapKeys(Box<UnaryFunc>),
477 MapValues(Box<UnaryFunc>),
478 MapContainsKey(Box<BinaryFunc>),
479 MapConcat(Box<VarArgFunc>),
480 ElementAt(Box<BinaryFunc>),
481 TransformKeys(Box<TransformFunc>),
482 TransformValues(Box<TransformFunc>),
483
484 JsonExtract(Box<JsonExtractFunc>),
486 JsonExtractScalar(Box<JsonExtractFunc>),
487 JsonExtractPath(Box<JsonPathFunc>),
488 JsonArray(Box<VarArgFunc>),
489 JsonObject(Box<JsonObjectFunc>),
490 JsonQuery(Box<JsonExtractFunc>),
491 JsonValue(Box<JsonExtractFunc>),
492 JsonArrayLength(Box<UnaryFunc>),
493 JsonKeys(Box<UnaryFunc>),
494 JsonType(Box<UnaryFunc>),
495 ParseJson(Box<UnaryFunc>),
496 ToJson(Box<UnaryFunc>),
497 JsonSet(Box<JsonModifyFunc>),
498 JsonInsert(Box<JsonModifyFunc>),
499 JsonRemove(Box<JsonPathFunc>),
500 JsonMergePatch(Box<BinaryFunc>),
501 JsonArrayAgg(Box<JsonArrayAggFunc>),
502 JsonObjectAgg(Box<JsonObjectAggFunc>),
503
504 Convert(Box<ConvertFunc>),
506 Typeof(Box<UnaryFunc>),
507
508 Lambda(Box<LambdaExpr>),
510 Parameter(Box<Parameter>),
511 Placeholder(Placeholder),
512 NamedArgument(Box<NamedArgument>),
513 TableArgument(Box<TableArgument>),
516 SqlComment(Box<SqlComment>),
517
518 NullSafeEq(Box<BinaryOp>),
520 NullSafeNeq(Box<BinaryOp>),
521 Glob(Box<BinaryOp>),
522 SimilarTo(Box<SimilarToExpr>),
523 Any(Box<QuantifiedExpr>),
524 All(Box<QuantifiedExpr>),
525 Overlaps(Box<OverlapsExpr>),
526
527 BitwiseLeftShift(Box<BinaryOp>),
529 BitwiseRightShift(Box<BinaryOp>),
530 BitwiseAndAgg(Box<AggFunc>),
531 BitwiseOrAgg(Box<AggFunc>),
532 BitwiseXorAgg(Box<AggFunc>),
533
534 Subscript(Box<Subscript>),
536 Dot(Box<DotAccess>),
537 MethodCall(Box<MethodCall>),
538 ArraySlice(Box<ArraySlice>),
539
540 CreateTable(Box<CreateTable>),
542 DropTable(Box<DropTable>),
543 AlterTable(Box<AlterTable>),
544 CreateIndex(Box<CreateIndex>),
545 DropIndex(Box<DropIndex>),
546 CreateView(Box<CreateView>),
547 DropView(Box<DropView>),
548 AlterView(Box<AlterView>),
549 AlterIndex(Box<AlterIndex>),
550 Truncate(Box<Truncate>),
551 Use(Box<Use>),
552 Cache(Box<Cache>),
553 Uncache(Box<Uncache>),
554 LoadData(Box<LoadData>),
555 Pragma(Box<Pragma>),
556 Grant(Box<Grant>),
557 Revoke(Box<Revoke>),
558 Comment(Box<Comment>),
559 SetStatement(Box<SetStatement>),
560 CreateSchema(Box<CreateSchema>),
562 DropSchema(Box<DropSchema>),
563 DropNamespace(Box<DropNamespace>),
564 CreateDatabase(Box<CreateDatabase>),
565 DropDatabase(Box<DropDatabase>),
566 CreateFunction(Box<CreateFunction>),
567 DropFunction(Box<DropFunction>),
568 CreateProcedure(Box<CreateProcedure>),
569 DropProcedure(Box<DropProcedure>),
570 CreateSequence(Box<CreateSequence>),
571 DropSequence(Box<DropSequence>),
572 AlterSequence(Box<AlterSequence>),
573 CreateTrigger(Box<CreateTrigger>),
574 DropTrigger(Box<DropTrigger>),
575 CreateType(Box<CreateType>),
576 DropType(Box<DropType>),
577 Describe(Box<Describe>),
578 Show(Box<Show>),
579
580 Command(Box<Command>),
582 Kill(Box<Kill>),
583 Execute(Box<ExecuteStatement>),
585
586 Raw(Raw),
588
589 Paren(Box<Paren>),
591
592 Annotated(Box<Annotated>),
594
595 Refresh(Box<Refresh>),
598 LockingStatement(Box<LockingStatement>),
599 SequenceProperties(Box<SequenceProperties>),
600 TruncateTable(Box<TruncateTable>),
601 Clone(Box<Clone>),
602 Attach(Box<Attach>),
603 Detach(Box<Detach>),
604 Install(Box<Install>),
605 Summarize(Box<Summarize>),
606 Declare(Box<Declare>),
607 DeclareItem(Box<DeclareItem>),
608 Set(Box<Set>),
609 Heredoc(Box<Heredoc>),
610 SetItem(Box<SetItem>),
611 QueryBand(Box<QueryBand>),
612 UserDefinedFunction(Box<UserDefinedFunction>),
613 RecursiveWithSearch(Box<RecursiveWithSearch>),
614 ProjectionDef(Box<ProjectionDef>),
615 TableAlias(Box<TableAlias>),
616 ByteString(Box<ByteString>),
617 HexStringExpr(Box<HexStringExpr>),
618 UnicodeString(Box<UnicodeString>),
619 ColumnPosition(Box<ColumnPosition>),
620 ColumnDef(Box<ColumnDef>),
621 AlterColumn(Box<AlterColumn>),
622 AlterSortKey(Box<AlterSortKey>),
623 AlterSet(Box<AlterSet>),
624 RenameColumn(Box<RenameColumn>),
625 Comprehension(Box<Comprehension>),
626 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
627 MergeTreeTTL(Box<MergeTreeTTL>),
628 IndexConstraintOption(Box<IndexConstraintOption>),
629 ColumnConstraint(Box<ColumnConstraint>),
630 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
631 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
632 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
633 CheckColumnConstraint(Box<CheckColumnConstraint>),
634 CompressColumnConstraint(Box<CompressColumnConstraint>),
635 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
636 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
637 WithOperator(Box<WithOperator>),
638 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
639 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
640 CommentColumnConstraint(CommentColumnConstraint),
641 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
642 IndexColumnConstraint(Box<IndexColumnConstraint>),
643 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
644 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
645 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
646 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
647 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
648 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
649 InOutColumnConstraint(Box<InOutColumnConstraint>),
650 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
651 PathColumnConstraint(Box<PathColumnConstraint>),
652 Constraint(Box<Constraint>),
653 Export(Box<Export>),
654 Filter(Box<Filter>),
655 Changes(Box<Changes>),
656 CopyParameter(Box<CopyParameter>),
657 Credentials(Box<Credentials>),
658 Directory(Box<Directory>),
659 ForeignKey(Box<ForeignKey>),
660 ColumnPrefix(Box<ColumnPrefix>),
661 PrimaryKey(Box<PrimaryKey>),
662 IntoClause(Box<IntoClause>),
663 JoinHint(Box<JoinHint>),
664 Opclass(Box<Opclass>),
665 Index(Box<Index>),
666 IndexParameters(Box<IndexParameters>),
667 ConditionalInsert(Box<ConditionalInsert>),
668 MultitableInserts(Box<MultitableInserts>),
669 OnConflict(Box<OnConflict>),
670 OnCondition(Box<OnCondition>),
671 Returning(Box<Returning>),
672 Introducer(Box<Introducer>),
673 PartitionRange(Box<PartitionRange>),
674 Fetch(Box<Fetch>),
675 Group(Box<Group>),
676 Cube(Box<Cube>),
677 Rollup(Box<Rollup>),
678 GroupingSets(Box<GroupingSets>),
679 LimitOptions(Box<LimitOptions>),
680 Lateral(Box<Lateral>),
681 TableFromRows(Box<TableFromRows>),
682 RowsFrom(Box<RowsFrom>),
683 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
684 WithFill(Box<WithFill>),
685 Property(Box<Property>),
686 GrantPrivilege(Box<GrantPrivilege>),
687 GrantPrincipal(Box<GrantPrincipal>),
688 AllowedValuesProperty(Box<AllowedValuesProperty>),
689 AlgorithmProperty(Box<AlgorithmProperty>),
690 AutoIncrementProperty(Box<AutoIncrementProperty>),
691 AutoRefreshProperty(Box<AutoRefreshProperty>),
692 BackupProperty(Box<BackupProperty>),
693 BuildProperty(Box<BuildProperty>),
694 BlockCompressionProperty(Box<BlockCompressionProperty>),
695 CharacterSetProperty(Box<CharacterSetProperty>),
696 ChecksumProperty(Box<ChecksumProperty>),
697 CollateProperty(Box<CollateProperty>),
698 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
699 DataDeletionProperty(Box<DataDeletionProperty>),
700 DefinerProperty(Box<DefinerProperty>),
701 DistKeyProperty(Box<DistKeyProperty>),
702 DistributedByProperty(Box<DistributedByProperty>),
703 DistStyleProperty(Box<DistStyleProperty>),
704 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
705 EngineProperty(Box<EngineProperty>),
706 ToTableProperty(Box<ToTableProperty>),
707 ExecuteAsProperty(Box<ExecuteAsProperty>),
708 ExternalProperty(Box<ExternalProperty>),
709 FallbackProperty(Box<FallbackProperty>),
710 FileFormatProperty(Box<FileFormatProperty>),
711 CredentialsProperty(Box<CredentialsProperty>),
712 FreespaceProperty(Box<FreespaceProperty>),
713 InheritsProperty(Box<InheritsProperty>),
714 InputModelProperty(Box<InputModelProperty>),
715 OutputModelProperty(Box<OutputModelProperty>),
716 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
717 JournalProperty(Box<JournalProperty>),
718 LanguageProperty(Box<LanguageProperty>),
719 EnviromentProperty(Box<EnviromentProperty>),
720 ClusteredByProperty(Box<ClusteredByProperty>),
721 DictProperty(Box<DictProperty>),
722 DictRange(Box<DictRange>),
723 OnCluster(Box<OnCluster>),
724 LikeProperty(Box<LikeProperty>),
725 LocationProperty(Box<LocationProperty>),
726 LockProperty(Box<LockProperty>),
727 LockingProperty(Box<LockingProperty>),
728 LogProperty(Box<LogProperty>),
729 MaterializedProperty(Box<MaterializedProperty>),
730 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
731 OnProperty(Box<OnProperty>),
732 OnCommitProperty(Box<OnCommitProperty>),
733 PartitionedByProperty(Box<PartitionedByProperty>),
734 PartitionedByBucket(Box<PartitionedByBucket>),
735 PartitionByTruncate(Box<PartitionByTruncate>),
736 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
737 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
738 PartitionByListProperty(Box<PartitionByListProperty>),
739 PartitionList(Box<PartitionList>),
740 Partition(Box<Partition>),
741 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
742 UniqueKeyProperty(Box<UniqueKeyProperty>),
743 RollupProperty(Box<RollupProperty>),
744 PartitionBoundSpec(Box<PartitionBoundSpec>),
745 PartitionedOfProperty(Box<PartitionedOfProperty>),
746 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
747 ReturnsProperty(Box<ReturnsProperty>),
748 RowFormatProperty(Box<RowFormatProperty>),
749 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
750 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
751 QueryTransform(Box<QueryTransform>),
752 SampleProperty(Box<SampleProperty>),
753 SecurityProperty(Box<SecurityProperty>),
754 SchemaCommentProperty(Box<SchemaCommentProperty>),
755 SemanticView(Box<SemanticView>),
756 SerdeProperties(Box<SerdeProperties>),
757 SetProperty(Box<SetProperty>),
758 SharingProperty(Box<SharingProperty>),
759 SetConfigProperty(Box<SetConfigProperty>),
760 SettingsProperty(Box<SettingsProperty>),
761 SortKeyProperty(Box<SortKeyProperty>),
762 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
763 SqlSecurityProperty(Box<SqlSecurityProperty>),
764 StabilityProperty(Box<StabilityProperty>),
765 StorageHandlerProperty(Box<StorageHandlerProperty>),
766 TemporaryProperty(Box<TemporaryProperty>),
767 Tags(Box<Tags>),
768 TransformModelProperty(Box<TransformModelProperty>),
769 TransientProperty(Box<TransientProperty>),
770 UsingTemplateProperty(Box<UsingTemplateProperty>),
771 ViewAttributeProperty(Box<ViewAttributeProperty>),
772 VolatileProperty(Box<VolatileProperty>),
773 WithDataProperty(Box<WithDataProperty>),
774 WithJournalTableProperty(Box<WithJournalTableProperty>),
775 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
776 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
777 WithProcedureOptions(Box<WithProcedureOptions>),
778 EncodeProperty(Box<EncodeProperty>),
779 IncludeProperty(Box<IncludeProperty>),
780 Properties(Box<Properties>),
781 InputOutputFormat(Box<InputOutputFormat>),
782 Reference(Box<Reference>),
783 QueryOption(Box<QueryOption>),
784 WithTableHint(Box<WithTableHint>),
785 IndexTableHint(Box<IndexTableHint>),
786 HistoricalData(Box<HistoricalData>),
787 Get(Box<Get>),
788 SetOperation(Box<SetOperation>),
789 Var(Box<Var>),
790 Version(Box<Version>),
791 Schema(Box<Schema>),
792 Lock(Box<Lock>),
793 TableSample(Box<TableSample>),
794 Tag(Box<Tag>),
795 UnpivotColumns(Box<UnpivotColumns>),
796 WindowSpec(Box<WindowSpec>),
797 SessionParameter(Box<SessionParameter>),
798 PseudoType(Box<PseudoType>),
799 ObjectIdentifier(Box<ObjectIdentifier>),
800 Transaction(Box<Transaction>),
801 Commit(Box<Commit>),
802 Rollback(Box<Rollback>),
803 AlterSession(Box<AlterSession>),
804 Analyze(Box<Analyze>),
805 AnalyzeStatistics(Box<AnalyzeStatistics>),
806 AnalyzeHistogram(Box<AnalyzeHistogram>),
807 AnalyzeSample(Box<AnalyzeSample>),
808 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
809 AnalyzeDelete(Box<AnalyzeDelete>),
810 AnalyzeWith(Box<AnalyzeWith>),
811 AnalyzeValidate(Box<AnalyzeValidate>),
812 AddPartition(Box<AddPartition>),
813 AttachOption(Box<AttachOption>),
814 DropPartition(Box<DropPartition>),
815 ReplacePartition(Box<ReplacePartition>),
816 DPipe(Box<DPipe>),
817 Operator(Box<Operator>),
818 PivotAny(Box<PivotAny>),
819 Aliases(Box<Aliases>),
820 AtIndex(Box<AtIndex>),
821 FromTimeZone(Box<FromTimeZone>),
822 FormatPhrase(Box<FormatPhrase>),
823 ForIn(Box<ForIn>),
824 TimeUnit(Box<TimeUnit>),
825 IntervalOp(Box<IntervalOp>),
826 IntervalSpan(Box<IntervalSpan>),
827 HavingMax(Box<HavingMax>),
828 CosineDistance(Box<CosineDistance>),
829 DotProduct(Box<DotProduct>),
830 EuclideanDistance(Box<EuclideanDistance>),
831 ManhattanDistance(Box<ManhattanDistance>),
832 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
833 Booland(Box<Booland>),
834 Boolor(Box<Boolor>),
835 ParameterizedAgg(Box<ParameterizedAgg>),
836 ArgMax(Box<ArgMax>),
837 ArgMin(Box<ArgMin>),
838 ApproxTopK(Box<ApproxTopK>),
839 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
840 ApproxTopKCombine(Box<ApproxTopKCombine>),
841 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
842 ApproxTopSum(Box<ApproxTopSum>),
843 ApproxQuantiles(Box<ApproxQuantiles>),
844 Minhash(Box<Minhash>),
845 FarmFingerprint(Box<FarmFingerprint>),
846 Float64(Box<Float64>),
847 Transform(Box<Transform>),
848 Translate(Box<Translate>),
849 Grouping(Box<Grouping>),
850 GroupingId(Box<GroupingId>),
851 Anonymous(Box<Anonymous>),
852 AnonymousAggFunc(Box<AnonymousAggFunc>),
853 CombinedAggFunc(Box<CombinedAggFunc>),
854 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
855 HashAgg(Box<HashAgg>),
856 Hll(Box<Hll>),
857 Apply(Box<Apply>),
858 ToBoolean(Box<ToBoolean>),
859 List(Box<List>),
860 ToMap(Box<ToMap>),
861 Pad(Box<Pad>),
862 ToChar(Box<ToChar>),
863 ToNumber(Box<ToNumber>),
864 ToDouble(Box<ToDouble>),
865 Int64(Box<UnaryFunc>),
866 StringFunc(Box<StringFunc>),
867 ToDecfloat(Box<ToDecfloat>),
868 TryToDecfloat(Box<TryToDecfloat>),
869 ToFile(Box<ToFile>),
870 Columns(Box<Columns>),
871 ConvertToCharset(Box<ConvertToCharset>),
872 ConvertTimezone(Box<ConvertTimezone>),
873 GenerateSeries(Box<GenerateSeries>),
874 AIAgg(Box<AIAgg>),
875 AIClassify(Box<AIClassify>),
876 ArrayAll(Box<ArrayAll>),
877 ArrayAny(Box<ArrayAny>),
878 ArrayConstructCompact(Box<ArrayConstructCompact>),
879 StPoint(Box<StPoint>),
880 StDistance(Box<StDistance>),
881 StringToArray(Box<StringToArray>),
882 ArraySum(Box<ArraySum>),
883 ObjectAgg(Box<ObjectAgg>),
884 CastToStrType(Box<CastToStrType>),
885 CheckJson(Box<CheckJson>),
886 CheckXml(Box<CheckXml>),
887 TranslateCharacters(Box<TranslateCharacters>),
888 CurrentSchemas(Box<CurrentSchemas>),
889 CurrentDatetime(Box<CurrentDatetime>),
890 Localtime(Box<Localtime>),
891 Localtimestamp(Box<Localtimestamp>),
892 Systimestamp(Box<Systimestamp>),
893 CurrentSchema(Box<CurrentSchema>),
894 CurrentUser(Box<CurrentUser>),
895 UtcTime(Box<UtcTime>),
896 UtcTimestamp(Box<UtcTimestamp>),
897 Timestamp(Box<TimestampFunc>),
898 DateBin(Box<DateBin>),
899 Datetime(Box<Datetime>),
900 DatetimeAdd(Box<DatetimeAdd>),
901 DatetimeSub(Box<DatetimeSub>),
902 DatetimeDiff(Box<DatetimeDiff>),
903 DatetimeTrunc(Box<DatetimeTrunc>),
904 Dayname(Box<Dayname>),
905 MakeInterval(Box<MakeInterval>),
906 PreviousDay(Box<PreviousDay>),
907 Elt(Box<Elt>),
908 TimestampAdd(Box<TimestampAdd>),
909 TimestampSub(Box<TimestampSub>),
910 TimestampDiff(Box<TimestampDiff>),
911 TimeSlice(Box<TimeSlice>),
912 TimeAdd(Box<TimeAdd>),
913 TimeSub(Box<TimeSub>),
914 TimeDiff(Box<TimeDiff>),
915 TimeTrunc(Box<TimeTrunc>),
916 DateFromParts(Box<DateFromParts>),
917 TimeFromParts(Box<TimeFromParts>),
918 DecodeCase(Box<DecodeCase>),
919 Decrypt(Box<Decrypt>),
920 DecryptRaw(Box<DecryptRaw>),
921 Encode(Box<Encode>),
922 Encrypt(Box<Encrypt>),
923 EncryptRaw(Box<EncryptRaw>),
924 EqualNull(Box<EqualNull>),
925 ToBinary(Box<ToBinary>),
926 Base64DecodeBinary(Box<Base64DecodeBinary>),
927 Base64DecodeString(Box<Base64DecodeString>),
928 Base64Encode(Box<Base64Encode>),
929 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
930 TryBase64DecodeString(Box<TryBase64DecodeString>),
931 GapFill(Box<GapFill>),
932 GenerateDateArray(Box<GenerateDateArray>),
933 GenerateTimestampArray(Box<GenerateTimestampArray>),
934 GetExtract(Box<GetExtract>),
935 Getbit(Box<Getbit>),
936 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
937 HexEncode(Box<HexEncode>),
938 Compress(Box<Compress>),
939 DecompressBinary(Box<DecompressBinary>),
940 DecompressString(Box<DecompressString>),
941 Xor(Box<Xor>),
942 Nullif(Box<Nullif>),
943 JSON(Box<JSON>),
944 JSONPath(Box<JSONPath>),
945 JSONPathFilter(Box<JSONPathFilter>),
946 JSONPathKey(Box<JSONPathKey>),
947 JSONPathRecursive(Box<JSONPathRecursive>),
948 JSONPathScript(Box<JSONPathScript>),
949 JSONPathSlice(Box<JSONPathSlice>),
950 JSONPathSelector(Box<JSONPathSelector>),
951 JSONPathSubscript(Box<JSONPathSubscript>),
952 JSONPathUnion(Box<JSONPathUnion>),
953 Format(Box<Format>),
954 JSONKeys(Box<JSONKeys>),
955 JSONKeyValue(Box<JSONKeyValue>),
956 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
957 JSONObject(Box<JSONObject>),
958 JSONObjectAgg(Box<JSONObjectAgg>),
959 JSONBObjectAgg(Box<JSONBObjectAgg>),
960 JSONArray(Box<JSONArray>),
961 JSONArrayAgg(Box<JSONArrayAgg>),
962 JSONExists(Box<JSONExists>),
963 JSONColumnDef(Box<JSONColumnDef>),
964 JSONSchema(Box<JSONSchema>),
965 JSONSet(Box<JSONSet>),
966 JSONStripNulls(Box<JSONStripNulls>),
967 JSONValue(Box<JSONValue>),
968 JSONValueArray(Box<JSONValueArray>),
969 JSONRemove(Box<JSONRemove>),
970 JSONTable(Box<JSONTable>),
971 JSONType(Box<JSONType>),
972 ObjectInsert(Box<ObjectInsert>),
973 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
974 OpenJSON(Box<OpenJSON>),
975 JSONBExists(Box<JSONBExists>),
976 JSONBContains(Box<BinaryFunc>),
977 JSONBExtract(Box<BinaryFunc>),
978 JSONCast(Box<JSONCast>),
979 JSONExtract(Box<JSONExtract>),
980 JSONExtractQuote(Box<JSONExtractQuote>),
981 JSONExtractArray(Box<JSONExtractArray>),
982 JSONExtractScalar(Box<JSONExtractScalar>),
983 JSONBExtractScalar(Box<JSONBExtractScalar>),
984 JSONFormat(Box<JSONFormat>),
985 JSONBool(Box<UnaryFunc>),
986 JSONPathRoot(JSONPathRoot),
987 JSONArrayAppend(Box<JSONArrayAppend>),
988 JSONArrayContains(Box<JSONArrayContains>),
989 JSONArrayInsert(Box<JSONArrayInsert>),
990 ParseJSON(Box<ParseJSON>),
991 ParseUrl(Box<ParseUrl>),
992 ParseIp(Box<ParseIp>),
993 ParseTime(Box<ParseTime>),
994 ParseDatetime(Box<ParseDatetime>),
995 Map(Box<Map>),
996 MapCat(Box<MapCat>),
997 MapDelete(Box<MapDelete>),
998 MapInsert(Box<MapInsert>),
999 MapPick(Box<MapPick>),
1000 ScopeResolution(Box<ScopeResolution>),
1001 Slice(Box<Slice>),
1002 VarMap(Box<VarMap>),
1003 MatchAgainst(Box<MatchAgainst>),
1004 MD5Digest(Box<MD5Digest>),
1005 MD5NumberLower64(Box<UnaryFunc>),
1006 MD5NumberUpper64(Box<UnaryFunc>),
1007 Monthname(Box<Monthname>),
1008 Ntile(Box<Ntile>),
1009 Normalize(Box<Normalize>),
1010 Normal(Box<Normal>),
1011 Predict(Box<Predict>),
1012 MLTranslate(Box<MLTranslate>),
1013 FeaturesAtTime(Box<FeaturesAtTime>),
1014 GenerateEmbedding(Box<GenerateEmbedding>),
1015 MLForecast(Box<MLForecast>),
1016 ModelAttribute(Box<ModelAttribute>),
1017 VectorSearch(Box<VectorSearch>),
1018 Quantile(Box<Quantile>),
1019 ApproxQuantile(Box<ApproxQuantile>),
1020 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1021 Randn(Box<Randn>),
1022 Randstr(Box<Randstr>),
1023 RangeN(Box<RangeN>),
1024 RangeBucket(Box<RangeBucket>),
1025 ReadCSV(Box<ReadCSV>),
1026 ReadParquet(Box<ReadParquet>),
1027 Reduce(Box<Reduce>),
1028 RegexpExtractAll(Box<RegexpExtractAll>),
1029 RegexpILike(Box<RegexpILike>),
1030 RegexpFullMatch(Box<RegexpFullMatch>),
1031 RegexpInstr(Box<RegexpInstr>),
1032 RegexpSplit(Box<RegexpSplit>),
1033 RegexpCount(Box<RegexpCount>),
1034 RegrValx(Box<RegrValx>),
1035 RegrValy(Box<RegrValy>),
1036 RegrAvgy(Box<RegrAvgy>),
1037 RegrAvgx(Box<RegrAvgx>),
1038 RegrCount(Box<RegrCount>),
1039 RegrIntercept(Box<RegrIntercept>),
1040 RegrR2(Box<RegrR2>),
1041 RegrSxx(Box<RegrSxx>),
1042 RegrSxy(Box<RegrSxy>),
1043 RegrSyy(Box<RegrSyy>),
1044 RegrSlope(Box<RegrSlope>),
1045 SafeAdd(Box<SafeAdd>),
1046 SafeDivide(Box<SafeDivide>),
1047 SafeMultiply(Box<SafeMultiply>),
1048 SafeSubtract(Box<SafeSubtract>),
1049 SHA2(Box<SHA2>),
1050 SHA2Digest(Box<SHA2Digest>),
1051 SortArray(Box<SortArray>),
1052 SplitPart(Box<SplitPart>),
1053 SubstringIndex(Box<SubstringIndex>),
1054 StandardHash(Box<StandardHash>),
1055 StrPosition(Box<StrPosition>),
1056 Search(Box<Search>),
1057 SearchIp(Box<SearchIp>),
1058 StrToDate(Box<StrToDate>),
1059 DateStrToDate(Box<UnaryFunc>),
1060 DateToDateStr(Box<UnaryFunc>),
1061 StrToTime(Box<StrToTime>),
1062 StrToUnix(Box<StrToUnix>),
1063 StrToMap(Box<StrToMap>),
1064 NumberToStr(Box<NumberToStr>),
1065 FromBase(Box<FromBase>),
1066 Stuff(Box<Stuff>),
1067 TimeToStr(Box<TimeToStr>),
1068 TimeStrToTime(Box<TimeStrToTime>),
1069 TsOrDsAdd(Box<TsOrDsAdd>),
1070 TsOrDsDiff(Box<TsOrDsDiff>),
1071 TsOrDsToDate(Box<TsOrDsToDate>),
1072 TsOrDsToTime(Box<TsOrDsToTime>),
1073 Unhex(Box<Unhex>),
1074 Uniform(Box<Uniform>),
1075 UnixToStr(Box<UnixToStr>),
1076 UnixToTime(Box<UnixToTime>),
1077 Uuid(Box<Uuid>),
1078 TimestampFromParts(Box<TimestampFromParts>),
1079 TimestampTzFromParts(Box<TimestampTzFromParts>),
1080 Corr(Box<Corr>),
1081 WidthBucket(Box<WidthBucket>),
1082 CovarSamp(Box<CovarSamp>),
1083 CovarPop(Box<CovarPop>),
1084 Week(Box<Week>),
1085 XMLElement(Box<XMLElement>),
1086 XMLGet(Box<XMLGet>),
1087 XMLTable(Box<XMLTable>),
1088 XMLKeyValueOption(Box<XMLKeyValueOption>),
1089 Zipf(Box<Zipf>),
1090 Merge(Box<Merge>),
1091 When(Box<When>),
1092 Whens(Box<Whens>),
1093 NextValueFor(Box<NextValueFor>),
1094 ReturnStmt(Box<Expression>),
1096}
1097
1098impl Expression {
1099 pub fn number(n: i64) -> Self {
1101 Expression::Literal(Literal::Number(n.to_string()))
1102 }
1103
1104 pub fn string(s: impl Into<String>) -> Self {
1106 Expression::Literal(Literal::String(s.into()))
1107 }
1108
1109 pub fn float(f: f64) -> Self {
1111 Expression::Literal(Literal::Number(f.to_string()))
1112 }
1113
1114 pub fn column(name: impl Into<String>) -> Self {
1116 Expression::Column(Column {
1117 name: Identifier::new(name),
1118 table: None,
1119 join_mark: false,
1120 trailing_comments: Vec::new(),
1121 })
1122 }
1123
1124 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1126 Expression::Column(Column {
1127 name: Identifier::new(column),
1128 table: Some(Identifier::new(table)),
1129 join_mark: false,
1130 trailing_comments: Vec::new(),
1131 })
1132 }
1133
1134 pub fn identifier(name: impl Into<String>) -> Self {
1136 Expression::Identifier(Identifier::new(name))
1137 }
1138
1139 pub fn null() -> Self {
1141 Expression::Null(Null)
1142 }
1143
1144 pub fn true_() -> Self {
1146 Expression::Boolean(BooleanLiteral { value: true })
1147 }
1148
1149 pub fn false_() -> Self {
1151 Expression::Boolean(BooleanLiteral { value: false })
1152 }
1153
1154 pub fn star() -> Self {
1156 Expression::Star(Star {
1157 table: None,
1158 except: None,
1159 replace: None,
1160 rename: None,
1161 trailing_comments: Vec::new(),
1162 })
1163 }
1164
1165 pub fn alias(self, name: impl Into<String>) -> Self {
1167 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1168 }
1169
1170 pub fn is_select(&self) -> bool {
1172 matches!(self, Expression::Select(_))
1173 }
1174
1175 pub fn as_select(&self) -> Option<&Select> {
1177 match self {
1178 Expression::Select(s) => Some(s),
1179 _ => None,
1180 }
1181 }
1182
1183 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1185 match self {
1186 Expression::Select(s) => Some(s),
1187 _ => None,
1188 }
1189 }
1190
1191 pub fn sql(&self) -> String {
1196 crate::generator::Generator::sql(self).unwrap_or_default()
1197 }
1198
1199 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1205 crate::generate(self, dialect).unwrap_or_default()
1206 }
1207
1208}
1209
1210impl fmt::Display for Expression {
1211 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1212 match self {
1214 Expression::Literal(lit) => write!(f, "{}", lit),
1215 Expression::Identifier(id) => write!(f, "{}", id),
1216 Expression::Column(col) => write!(f, "{}", col),
1217 Expression::Star(_) => write!(f, "*"),
1218 Expression::Null(_) => write!(f, "NULL"),
1219 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
1220 Expression::Select(_) => write!(f, "SELECT ..."),
1221 _ => write!(f, "{:?}", self),
1222 }
1223 }
1224}
1225
1226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1236#[cfg_attr(feature = "bindings", derive(TS))]
1237#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
1238pub enum Literal {
1239 String(String),
1241 Number(String),
1243 HexString(String),
1245 HexNumber(String),
1247 BitString(String),
1248 ByteString(String),
1250 NationalString(String),
1252 Date(String),
1254 Time(String),
1256 Timestamp(String),
1258 Datetime(String),
1260 TripleQuotedString(String, char),
1263 EscapeString(String),
1265 DollarString(String),
1267 RawString(String),
1271}
1272
1273impl fmt::Display for Literal {
1274 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1275 match self {
1276 Literal::String(s) => write!(f, "'{}'", s),
1277 Literal::Number(n) => write!(f, "{}", n),
1278 Literal::HexString(h) => write!(f, "X'{}'", h),
1279 Literal::HexNumber(h) => write!(f, "0x{}", h),
1280 Literal::BitString(b) => write!(f, "B'{}'", b),
1281 Literal::ByteString(b) => write!(f, "b'{}'", b),
1282 Literal::NationalString(s) => write!(f, "N'{}'", s),
1283 Literal::Date(d) => write!(f, "DATE '{}'", d),
1284 Literal::Time(t) => write!(f, "TIME '{}'", t),
1285 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
1286 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
1287 Literal::TripleQuotedString(s, q) => {
1288 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
1289 }
1290 Literal::EscapeString(s) => write!(f, "E'{}'", s),
1291 Literal::DollarString(s) => write!(f, "$${}$$", s),
1292 Literal::RawString(s) => write!(f, "r'{}'", s),
1293 }
1294 }
1295}
1296
1297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1299#[cfg_attr(feature = "bindings", derive(TS))]
1300pub struct BooleanLiteral {
1301 pub value: bool,
1302}
1303
1304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1306#[cfg_attr(feature = "bindings", derive(TS))]
1307pub struct Null;
1308
1309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1316#[cfg_attr(feature = "bindings", derive(TS))]
1317pub struct Identifier {
1318 pub name: String,
1320 pub quoted: bool,
1322 #[serde(default)]
1323 pub trailing_comments: Vec<String>,
1324}
1325
1326impl Identifier {
1327 pub fn new(name: impl Into<String>) -> Self {
1328 Self {
1329 name: name.into(),
1330 quoted: false,
1331 trailing_comments: Vec::new(),
1332 }
1333 }
1334
1335 pub fn quoted(name: impl Into<String>) -> Self {
1336 Self {
1337 name: name.into(),
1338 quoted: true,
1339 trailing_comments: Vec::new(),
1340 }
1341 }
1342
1343 pub fn empty() -> Self {
1344 Self {
1345 name: String::new(),
1346 quoted: false,
1347 trailing_comments: Vec::new(),
1348 }
1349 }
1350
1351 pub fn is_empty(&self) -> bool {
1352 self.name.is_empty()
1353 }
1354}
1355
1356impl fmt::Display for Identifier {
1357 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1358 if self.quoted {
1359 write!(f, "\"{}\"", self.name)
1360 } else {
1361 write!(f, "{}", self.name)
1362 }
1363 }
1364}
1365
1366#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1372#[cfg_attr(feature = "bindings", derive(TS))]
1373pub struct Column {
1374 pub name: Identifier,
1376 pub table: Option<Identifier>,
1378 #[serde(default)]
1380 pub join_mark: bool,
1381 #[serde(default)]
1383 pub trailing_comments: Vec<String>,
1384}
1385
1386impl fmt::Display for Column {
1387 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1388 if let Some(table) = &self.table {
1389 write!(f, "{}.{}", table, self.name)
1390 } else {
1391 write!(f, "{}", self.name)
1392 }
1393 }
1394}
1395
1396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1403#[cfg_attr(feature = "bindings", derive(TS))]
1404pub struct TableRef {
1405 pub name: Identifier,
1407 pub schema: Option<Identifier>,
1409 pub catalog: Option<Identifier>,
1411 pub alias: Option<Identifier>,
1413 #[serde(default)]
1415 pub alias_explicit_as: bool,
1416 #[serde(default)]
1418 pub column_aliases: Vec<Identifier>,
1419 #[serde(default)]
1421 pub trailing_comments: Vec<String>,
1422 #[serde(default)]
1424 pub when: Option<Box<HistoricalData>>,
1425 #[serde(default)]
1427 pub only: bool,
1428 #[serde(default)]
1430 pub final_: bool,
1431 #[serde(default, skip_serializing_if = "Option::is_none")]
1433 pub table_sample: Option<Box<Sample>>,
1434 #[serde(default)]
1436 pub hints: Vec<Expression>,
1437 #[serde(default, skip_serializing_if = "Option::is_none")]
1440 pub system_time: Option<String>,
1441 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1443 pub partitions: Vec<Identifier>,
1444 #[serde(default, skip_serializing_if = "Option::is_none")]
1447 pub identifier_func: Option<Box<Expression>>,
1448 #[serde(default, skip_serializing_if = "Option::is_none")]
1450 pub changes: Option<Box<Changes>>,
1451 #[serde(default, skip_serializing_if = "Option::is_none")]
1453 pub version: Option<Box<Version>>,
1454}
1455
1456impl TableRef {
1457 pub fn new(name: impl Into<String>) -> Self {
1458 Self {
1459 name: Identifier::new(name),
1460 schema: None,
1461 catalog: None,
1462 alias: None,
1463 alias_explicit_as: false,
1464 column_aliases: Vec::new(),
1465 trailing_comments: Vec::new(),
1466 when: None,
1467 only: false,
1468 final_: false,
1469 table_sample: None,
1470 hints: Vec::new(),
1471 system_time: None,
1472 partitions: Vec::new(),
1473 identifier_func: None,
1474 changes: None,
1475 version: None,
1476 }
1477 }
1478
1479 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
1481 let mut t = Self::new(name);
1482 t.schema = Some(Identifier::new(schema));
1483 t
1484 }
1485
1486 pub fn new_with_catalog(
1488 name: impl Into<String>,
1489 schema: impl Into<String>,
1490 catalog: impl Into<String>,
1491 ) -> Self {
1492 let mut t = Self::new(name);
1493 t.schema = Some(Identifier::new(schema));
1494 t.catalog = Some(Identifier::new(catalog));
1495 t
1496 }
1497
1498 pub fn from_identifier(name: Identifier) -> Self {
1500 Self {
1501 name,
1502 schema: None,
1503 catalog: None,
1504 alias: None,
1505 alias_explicit_as: false,
1506 column_aliases: Vec::new(),
1507 trailing_comments: Vec::new(),
1508 when: None,
1509 only: false,
1510 final_: false,
1511 table_sample: None,
1512 hints: Vec::new(),
1513 system_time: None,
1514 partitions: Vec::new(),
1515 identifier_func: None,
1516 changes: None,
1517 version: None,
1518 }
1519 }
1520
1521 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
1522 self.alias = Some(Identifier::new(alias));
1523 self
1524 }
1525
1526 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
1527 self.schema = Some(Identifier::new(schema));
1528 self
1529 }
1530}
1531
1532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1537#[cfg_attr(feature = "bindings", derive(TS))]
1538pub struct Star {
1539 pub table: Option<Identifier>,
1541 pub except: Option<Vec<Identifier>>,
1543 pub replace: Option<Vec<Alias>>,
1545 pub rename: Option<Vec<(Identifier, Identifier)>>,
1547 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1549 pub trailing_comments: Vec<String>,
1550}
1551
1552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1576#[cfg_attr(feature = "bindings", derive(TS))]
1577pub struct Select {
1578 pub expressions: Vec<Expression>,
1580 pub from: Option<From>,
1582 pub joins: Vec<Join>,
1584 pub lateral_views: Vec<LateralView>,
1585 #[serde(default, skip_serializing_if = "Option::is_none")]
1587 pub prewhere: Option<Expression>,
1588 pub where_clause: Option<Where>,
1589 pub group_by: Option<GroupBy>,
1590 pub having: Option<Having>,
1591 pub qualify: Option<Qualify>,
1592 pub order_by: Option<OrderBy>,
1593 pub distribute_by: Option<DistributeBy>,
1594 pub cluster_by: Option<ClusterBy>,
1595 pub sort_by: Option<SortBy>,
1596 pub limit: Option<Limit>,
1597 pub offset: Option<Offset>,
1598 #[serde(default, skip_serializing_if = "Option::is_none")]
1600 pub limit_by: Option<Vec<Expression>>,
1601 pub fetch: Option<Fetch>,
1602 pub distinct: bool,
1603 pub distinct_on: Option<Vec<Expression>>,
1604 pub top: Option<Top>,
1605 pub with: Option<With>,
1606 pub sample: Option<Sample>,
1607 #[serde(default, skip_serializing_if = "Option::is_none")]
1609 pub settings: Option<Vec<Expression>>,
1610 #[serde(default, skip_serializing_if = "Option::is_none")]
1612 pub format: Option<Expression>,
1613 pub windows: Option<Vec<NamedWindow>>,
1614 pub hint: Option<Hint>,
1615 pub connect: Option<Connect>,
1617 pub into: Option<SelectInto>,
1619 #[serde(default)]
1621 pub locks: Vec<Lock>,
1622 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1624 pub for_xml: Vec<Expression>,
1625 #[serde(default)]
1627 pub leading_comments: Vec<String>,
1628 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1631 pub post_select_comments: Vec<String>,
1632 #[serde(default, skip_serializing_if = "Option::is_none")]
1634 pub kind: Option<String>,
1635 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1637 pub operation_modifiers: Vec<String>,
1638 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
1640 pub qualify_after_window: bool,
1641 #[serde(default, skip_serializing_if = "Option::is_none")]
1643 pub option: Option<String>,
1644}
1645
1646impl Select {
1647 pub fn new() -> Self {
1648 Self {
1649 expressions: Vec::new(),
1650 from: None,
1651 joins: Vec::new(),
1652 lateral_views: Vec::new(),
1653 prewhere: None,
1654 where_clause: None,
1655 group_by: None,
1656 having: None,
1657 qualify: None,
1658 order_by: None,
1659 distribute_by: None,
1660 cluster_by: None,
1661 sort_by: None,
1662 limit: None,
1663 offset: None,
1664 limit_by: None,
1665 fetch: None,
1666 distinct: false,
1667 distinct_on: None,
1668 top: None,
1669 with: None,
1670 sample: None,
1671 settings: None,
1672 format: None,
1673 windows: None,
1674 hint: None,
1675 connect: None,
1676 into: None,
1677 locks: Vec::new(),
1678 for_xml: Vec::new(),
1679 leading_comments: Vec::new(),
1680 post_select_comments: Vec::new(),
1681 kind: None,
1682 operation_modifiers: Vec::new(),
1683 qualify_after_window: false,
1684 option: None,
1685 }
1686 }
1687
1688 pub fn column(mut self, expr: Expression) -> Self {
1690 self.expressions.push(expr);
1691 self
1692 }
1693
1694 pub fn from(mut self, table: Expression) -> Self {
1696 self.from = Some(From {
1697 expressions: vec![table],
1698 });
1699 self
1700 }
1701
1702 pub fn where_(mut self, condition: Expression) -> Self {
1704 self.where_clause = Some(Where { this: condition });
1705 self
1706 }
1707
1708 pub fn distinct(mut self) -> Self {
1710 self.distinct = true;
1711 self
1712 }
1713
1714 pub fn join(mut self, join: Join) -> Self {
1716 self.joins.push(join);
1717 self
1718 }
1719
1720 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
1722 self.order_by = Some(OrderBy { expressions, siblings: false });
1723 self
1724 }
1725
1726 pub fn limit(mut self, n: Expression) -> Self {
1728 self.limit = Some(Limit { this: n, percent: false });
1729 self
1730 }
1731
1732 pub fn offset(mut self, n: Expression) -> Self {
1734 self.offset = Some(Offset { this: n, rows: None });
1735 self
1736 }
1737}
1738
1739impl Default for Select {
1740 fn default() -> Self {
1741 Self::new()
1742 }
1743}
1744
1745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1751#[cfg_attr(feature = "bindings", derive(TS))]
1752pub struct Union {
1753 pub left: Expression,
1755 pub right: Expression,
1757 pub all: bool,
1759 #[serde(default)]
1761 pub distinct: bool,
1762 pub with: Option<With>,
1764 pub order_by: Option<OrderBy>,
1766 pub limit: Option<Box<Expression>>,
1768 pub offset: Option<Box<Expression>>,
1770 #[serde(default, skip_serializing_if = "Option::is_none")]
1772 pub distribute_by: Option<DistributeBy>,
1773 #[serde(default, skip_serializing_if = "Option::is_none")]
1775 pub sort_by: Option<SortBy>,
1776 #[serde(default, skip_serializing_if = "Option::is_none")]
1778 pub cluster_by: Option<ClusterBy>,
1779 #[serde(default)]
1781 pub by_name: bool,
1782 #[serde(default, skip_serializing_if = "Option::is_none")]
1784 pub side: Option<String>,
1785 #[serde(default, skip_serializing_if = "Option::is_none")]
1787 pub kind: Option<String>,
1788 #[serde(default)]
1790 pub corresponding: bool,
1791 #[serde(default)]
1793 pub strict: bool,
1794 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1796 pub on_columns: Vec<Expression>,
1797}
1798
1799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1804#[cfg_attr(feature = "bindings", derive(TS))]
1805pub struct Intersect {
1806 pub left: Expression,
1808 pub right: Expression,
1810 pub all: bool,
1812 #[serde(default)]
1814 pub distinct: bool,
1815 pub with: Option<With>,
1817 pub order_by: Option<OrderBy>,
1819 pub limit: Option<Box<Expression>>,
1821 pub offset: Option<Box<Expression>>,
1823 #[serde(default, skip_serializing_if = "Option::is_none")]
1825 pub distribute_by: Option<DistributeBy>,
1826 #[serde(default, skip_serializing_if = "Option::is_none")]
1828 pub sort_by: Option<SortBy>,
1829 #[serde(default, skip_serializing_if = "Option::is_none")]
1831 pub cluster_by: Option<ClusterBy>,
1832 #[serde(default)]
1834 pub by_name: bool,
1835 #[serde(default, skip_serializing_if = "Option::is_none")]
1837 pub side: Option<String>,
1838 #[serde(default, skip_serializing_if = "Option::is_none")]
1840 pub kind: Option<String>,
1841 #[serde(default)]
1843 pub corresponding: bool,
1844 #[serde(default)]
1846 pub strict: bool,
1847 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1849 pub on_columns: Vec<Expression>,
1850}
1851
1852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1857#[cfg_attr(feature = "bindings", derive(TS))]
1858pub struct Except {
1859 pub left: Expression,
1861 pub right: Expression,
1863 pub all: bool,
1865 #[serde(default)]
1867 pub distinct: bool,
1868 pub with: Option<With>,
1870 pub order_by: Option<OrderBy>,
1872 pub limit: Option<Box<Expression>>,
1874 pub offset: Option<Box<Expression>>,
1876 #[serde(default, skip_serializing_if = "Option::is_none")]
1878 pub distribute_by: Option<DistributeBy>,
1879 #[serde(default, skip_serializing_if = "Option::is_none")]
1881 pub sort_by: Option<SortBy>,
1882 #[serde(default, skip_serializing_if = "Option::is_none")]
1884 pub cluster_by: Option<ClusterBy>,
1885 #[serde(default)]
1887 pub by_name: bool,
1888 #[serde(default, skip_serializing_if = "Option::is_none")]
1890 pub side: Option<String>,
1891 #[serde(default, skip_serializing_if = "Option::is_none")]
1893 pub kind: Option<String>,
1894 #[serde(default)]
1896 pub corresponding: bool,
1897 #[serde(default)]
1899 pub strict: bool,
1900 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1902 pub on_columns: Vec<Expression>,
1903}
1904
1905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1907#[cfg_attr(feature = "bindings", derive(TS))]
1908pub struct SelectInto {
1909 pub this: Expression,
1911 #[serde(default)]
1913 pub temporary: bool,
1914 #[serde(default)]
1916 pub unlogged: bool,
1917 #[serde(default)]
1919 pub bulk_collect: bool,
1920 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1922 pub expressions: Vec<Expression>,
1923}
1924
1925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1935#[cfg_attr(feature = "bindings", derive(TS))]
1936pub struct Subquery {
1937 pub this: Expression,
1939 pub alias: Option<Identifier>,
1941 pub column_aliases: Vec<Identifier>,
1943 pub order_by: Option<OrderBy>,
1945 pub limit: Option<Limit>,
1947 pub offset: Option<Offset>,
1949 #[serde(default, skip_serializing_if = "Option::is_none")]
1951 pub distribute_by: Option<DistributeBy>,
1952 #[serde(default, skip_serializing_if = "Option::is_none")]
1954 pub sort_by: Option<SortBy>,
1955 #[serde(default, skip_serializing_if = "Option::is_none")]
1957 pub cluster_by: Option<ClusterBy>,
1958 #[serde(default)]
1960 pub lateral: bool,
1961 #[serde(default)]
1965 pub modifiers_inside: bool,
1966 #[serde(default)]
1968 pub trailing_comments: Vec<String>,
1969}
1970
1971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1976#[cfg_attr(feature = "bindings", derive(TS))]
1977pub struct PipeOperator {
1978 pub this: Expression,
1980 pub expression: Expression,
1982}
1983
1984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1986#[cfg_attr(feature = "bindings", derive(TS))]
1987pub struct Values {
1988 pub expressions: Vec<Tuple>,
1990 pub alias: Option<Identifier>,
1992 pub column_aliases: Vec<Identifier>,
1994}
1995
1996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2006#[cfg_attr(feature = "bindings", derive(TS))]
2007pub struct Pivot {
2008 pub this: Expression,
2010 #[serde(default)]
2013 pub expressions: Vec<Expression>,
2014 #[serde(default)]
2016 pub fields: Vec<Expression>,
2017 #[serde(default)]
2019 pub using: Vec<Expression>,
2020 #[serde(default)]
2022 pub group: Option<Box<Expression>>,
2023 #[serde(default)]
2025 pub unpivot: bool,
2026 #[serde(default)]
2028 pub into: Option<Box<Expression>>,
2029 #[serde(default)]
2031 pub alias: Option<Identifier>,
2032 #[serde(default)]
2034 pub include_nulls: Option<bool>,
2035 #[serde(default)]
2037 pub default_on_null: Option<Box<Expression>>,
2038 #[serde(default, skip_serializing_if = "Option::is_none")]
2040 pub with: Option<With>,
2041}
2042
2043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2045#[cfg_attr(feature = "bindings", derive(TS))]
2046pub struct Unpivot {
2047 pub this: Expression,
2048 pub value_column: Identifier,
2049 pub name_column: Identifier,
2050 pub columns: Vec<Expression>,
2051 pub alias: Option<Identifier>,
2052 #[serde(default)]
2054 pub value_column_parenthesized: bool,
2055 #[serde(default)]
2057 pub include_nulls: Option<bool>,
2058 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2060 pub extra_value_columns: Vec<Identifier>,
2061}
2062
2063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2066#[cfg_attr(feature = "bindings", derive(TS))]
2067pub struct PivotAlias {
2068 pub this: Expression,
2069 pub alias: Expression,
2070}
2071
2072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2074#[cfg_attr(feature = "bindings", derive(TS))]
2075pub struct PreWhere {
2076 pub this: Expression,
2077}
2078
2079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2081#[cfg_attr(feature = "bindings", derive(TS))]
2082pub struct Stream {
2083 pub this: Expression,
2084 #[serde(skip_serializing_if = "Option::is_none")]
2085 pub on: Option<Expression>,
2086 #[serde(skip_serializing_if = "Option::is_none")]
2087 pub show_initial_rows: Option<bool>,
2088}
2089
2090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2092#[cfg_attr(feature = "bindings", derive(TS))]
2093pub struct UsingData {
2094 pub this: Expression,
2095}
2096
2097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2099#[cfg_attr(feature = "bindings", derive(TS))]
2100pub struct XmlNamespace {
2101 pub this: Expression,
2102 #[serde(skip_serializing_if = "Option::is_none")]
2103 pub alias: Option<Identifier>,
2104}
2105
2106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2108#[cfg_attr(feature = "bindings", derive(TS))]
2109pub struct RowFormat {
2110 pub delimited: bool,
2111 pub fields_terminated_by: Option<String>,
2112 pub collection_items_terminated_by: Option<String>,
2113 pub map_keys_terminated_by: Option<String>,
2114 pub lines_terminated_by: Option<String>,
2115 pub null_defined_as: Option<String>,
2116}
2117
2118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2120#[cfg_attr(feature = "bindings", derive(TS))]
2121pub struct DirectoryInsert {
2122 pub local: bool,
2123 pub path: String,
2124 pub row_format: Option<RowFormat>,
2125 #[serde(default)]
2127 pub stored_as: Option<String>,
2128}
2129
2130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2132#[cfg_attr(feature = "bindings", derive(TS))]
2133pub struct Insert {
2134 pub table: TableRef,
2135 pub columns: Vec<Identifier>,
2136 pub values: Vec<Vec<Expression>>,
2137 pub query: Option<Expression>,
2138 pub overwrite: bool,
2140 pub partition: Vec<(Identifier, Option<Expression>)>,
2142 #[serde(default)]
2144 pub directory: Option<DirectoryInsert>,
2145 #[serde(default)]
2147 pub returning: Vec<Expression>,
2148 #[serde(default)]
2150 pub output: Option<OutputClause>,
2151 #[serde(default)]
2153 pub on_conflict: Option<Box<Expression>>,
2154 #[serde(default)]
2156 pub leading_comments: Vec<String>,
2157 #[serde(default)]
2159 pub if_exists: bool,
2160 #[serde(default)]
2162 pub with: Option<With>,
2163 #[serde(default)]
2165 pub ignore: bool,
2166 #[serde(default)]
2168 pub source_alias: Option<Identifier>,
2169 #[serde(default)]
2171 pub alias: Option<Identifier>,
2172 #[serde(default)]
2174 pub alias_explicit_as: bool,
2175 #[serde(default)]
2177 pub default_values: bool,
2178 #[serde(default)]
2180 pub by_name: bool,
2181 #[serde(default, skip_serializing_if = "Option::is_none")]
2183 pub conflict_action: Option<String>,
2184 #[serde(default)]
2186 pub is_replace: bool,
2187 #[serde(default, skip_serializing_if = "Option::is_none")]
2189 pub hint: Option<Hint>,
2190 #[serde(default)]
2192 pub replace_where: Option<Box<Expression>>,
2193 #[serde(default)]
2195 pub source: Option<Box<Expression>>,
2196 #[serde(default, skip_serializing_if = "Option::is_none")]
2198 pub function_target: Option<Box<Expression>>,
2199 #[serde(default, skip_serializing_if = "Option::is_none")]
2201 pub partition_by: Option<Box<Expression>>,
2202 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2204 pub settings: Vec<Expression>,
2205}
2206
2207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2209#[cfg_attr(feature = "bindings", derive(TS))]
2210pub struct OutputClause {
2211 pub columns: Vec<Expression>,
2213 #[serde(default)]
2215 pub into_table: Option<Expression>,
2216}
2217
2218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2220#[cfg_attr(feature = "bindings", derive(TS))]
2221pub struct Update {
2222 pub table: TableRef,
2223 #[serde(default)]
2225 pub extra_tables: Vec<TableRef>,
2226 #[serde(default)]
2228 pub table_joins: Vec<Join>,
2229 pub set: Vec<(Identifier, Expression)>,
2230 pub from_clause: Option<From>,
2231 #[serde(default)]
2233 pub from_joins: Vec<Join>,
2234 pub where_clause: Option<Where>,
2235 #[serde(default)]
2237 pub returning: Vec<Expression>,
2238 #[serde(default)]
2240 pub output: Option<OutputClause>,
2241 #[serde(default)]
2243 pub with: Option<With>,
2244 #[serde(default)]
2246 pub leading_comments: Vec<String>,
2247 #[serde(default)]
2249 pub limit: Option<Expression>,
2250 #[serde(default)]
2252 pub order_by: Option<OrderBy>,
2253 #[serde(default)]
2255 pub from_before_set: bool,
2256}
2257
2258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2260#[cfg_attr(feature = "bindings", derive(TS))]
2261pub struct Delete {
2262 pub table: TableRef,
2263 #[serde(default, skip_serializing_if = "Option::is_none")]
2265 pub on_cluster: Option<OnCluster>,
2266 pub alias: Option<Identifier>,
2268 #[serde(default)]
2270 pub alias_explicit_as: bool,
2271 pub using: Vec<TableRef>,
2273 pub where_clause: Option<Where>,
2274 #[serde(default)]
2276 pub output: Option<OutputClause>,
2277 #[serde(default)]
2279 pub leading_comments: Vec<String>,
2280 #[serde(default)]
2282 pub with: Option<With>,
2283 #[serde(default)]
2285 pub limit: Option<Expression>,
2286 #[serde(default)]
2288 pub order_by: Option<OrderBy>,
2289 #[serde(default)]
2291 pub returning: Vec<Expression>,
2292 #[serde(default)]
2295 pub tables: Vec<TableRef>,
2296 #[serde(default)]
2299 pub tables_from_using: bool,
2300 #[serde(default)]
2302 pub joins: Vec<Join>,
2303 #[serde(default)]
2305 pub force_index: Option<String>,
2306 #[serde(default)]
2308 pub no_from: bool,
2309}
2310
2311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2313#[cfg_attr(feature = "bindings", derive(TS))]
2314pub struct CopyStmt {
2315 pub this: Expression,
2317 pub kind: bool,
2319 pub files: Vec<Expression>,
2321 #[serde(default)]
2323 pub params: Vec<CopyParameter>,
2324 #[serde(default)]
2326 pub credentials: Option<Box<Credentials>>,
2327 #[serde(default)]
2329 pub is_into: bool,
2330 #[serde(default)]
2332 pub with_wrapped: bool,
2333}
2334
2335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2337#[cfg_attr(feature = "bindings", derive(TS))]
2338pub struct CopyParameter {
2339 pub name: String,
2340 pub value: Option<Expression>,
2341 pub values: Vec<Expression>,
2342 #[serde(default)]
2344 pub eq: bool,
2345}
2346
2347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2349#[cfg_attr(feature = "bindings", derive(TS))]
2350pub struct Credentials {
2351 pub credentials: Vec<(String, String)>,
2352 pub encryption: Option<String>,
2353 pub storage: Option<String>,
2354}
2355
2356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2358#[cfg_attr(feature = "bindings", derive(TS))]
2359pub struct PutStmt {
2360 pub source: String,
2362 #[serde(default)]
2364 pub source_quoted: bool,
2365 pub target: Expression,
2367 #[serde(default)]
2369 pub params: Vec<CopyParameter>,
2370}
2371
2372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2374#[cfg_attr(feature = "bindings", derive(TS))]
2375pub struct StageReference {
2376 pub name: String,
2378 #[serde(default)]
2380 pub path: Option<String>,
2381 #[serde(default)]
2383 pub file_format: Option<Expression>,
2384 #[serde(default)]
2386 pub pattern: Option<String>,
2387 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2389 pub quoted: bool,
2390}
2391
2392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2394#[cfg_attr(feature = "bindings", derive(TS))]
2395pub struct HistoricalData {
2396 pub this: Box<Expression>,
2398 pub kind: String,
2400 pub expression: Box<Expression>,
2402}
2403
2404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2409#[cfg_attr(feature = "bindings", derive(TS))]
2410pub struct Alias {
2411 pub this: Expression,
2413 pub alias: Identifier,
2415 #[serde(default)]
2417 pub column_aliases: Vec<Identifier>,
2418 #[serde(default)]
2420 pub pre_alias_comments: Vec<String>,
2421 #[serde(default)]
2423 pub trailing_comments: Vec<String>,
2424}
2425
2426impl Alias {
2427 pub fn new(this: Expression, alias: Identifier) -> Self {
2429 Self {
2430 this,
2431 alias,
2432 column_aliases: Vec::new(),
2433 pre_alias_comments: Vec::new(),
2434 trailing_comments: Vec::new(),
2435 }
2436 }
2437
2438 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
2440 Self {
2441 this,
2442 alias: Identifier::empty(),
2443 column_aliases,
2444 pre_alias_comments: Vec::new(),
2445 trailing_comments: Vec::new(),
2446 }
2447 }
2448}
2449
2450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2457#[cfg_attr(feature = "bindings", derive(TS))]
2458pub struct Cast {
2459 pub this: Expression,
2461 pub to: DataType,
2463 #[serde(default)]
2464 pub trailing_comments: Vec<String>,
2465 #[serde(default)]
2467 pub double_colon_syntax: bool,
2468 #[serde(skip_serializing_if = "Option::is_none", default)]
2470 pub format: Option<Box<Expression>>,
2471 #[serde(skip_serializing_if = "Option::is_none", default)]
2473 pub default: Option<Box<Expression>>,
2474}
2475
2476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2478#[cfg_attr(feature = "bindings", derive(TS))]
2479pub struct CollationExpr {
2480 pub this: Expression,
2481 pub collation: String,
2482 #[serde(default)]
2484 pub quoted: bool,
2485 #[serde(default)]
2487 pub double_quoted: bool,
2488}
2489
2490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2496#[cfg_attr(feature = "bindings", derive(TS))]
2497pub struct Case {
2498 pub operand: Option<Expression>,
2500 pub whens: Vec<(Expression, Expression)>,
2502 pub else_: Option<Expression>,
2504}
2505
2506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2514#[cfg_attr(feature = "bindings", derive(TS))]
2515pub struct BinaryOp {
2516 pub left: Expression,
2517 pub right: Expression,
2518 #[serde(default)]
2520 pub left_comments: Vec<String>,
2521 #[serde(default)]
2523 pub operator_comments: Vec<String>,
2524 #[serde(default)]
2526 pub trailing_comments: Vec<String>,
2527}
2528
2529impl BinaryOp {
2530 pub fn new(left: Expression, right: Expression) -> Self {
2531 Self {
2532 left,
2533 right,
2534 left_comments: Vec::new(),
2535 operator_comments: Vec::new(),
2536 trailing_comments: Vec::new(),
2537 }
2538 }
2539}
2540
2541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2543#[cfg_attr(feature = "bindings", derive(TS))]
2544pub struct LikeOp {
2545 pub left: Expression,
2546 pub right: Expression,
2547 #[serde(default)]
2549 pub escape: Option<Expression>,
2550 #[serde(default)]
2552 pub quantifier: Option<String>,
2553}
2554
2555impl LikeOp {
2556 pub fn new(left: Expression, right: Expression) -> Self {
2557 Self {
2558 left,
2559 right,
2560 escape: None,
2561 quantifier: None,
2562 }
2563 }
2564
2565 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
2566 Self {
2567 left,
2568 right,
2569 escape: Some(escape),
2570 quantifier: None,
2571 }
2572 }
2573}
2574
2575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2579#[cfg_attr(feature = "bindings", derive(TS))]
2580pub struct UnaryOp {
2581 pub this: Expression,
2583}
2584
2585impl UnaryOp {
2586 pub fn new(this: Expression) -> Self {
2587 Self { this }
2588 }
2589}
2590
2591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2596#[cfg_attr(feature = "bindings", derive(TS))]
2597pub struct In {
2598 pub this: Expression,
2600 pub expressions: Vec<Expression>,
2602 pub query: Option<Expression>,
2604 pub not: bool,
2606 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2607 pub global: bool,
2608 #[serde(default, skip_serializing_if = "Option::is_none")]
2610 pub unnest: Option<Box<Expression>>,
2611}
2612
2613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2615#[cfg_attr(feature = "bindings", derive(TS))]
2616pub struct Between {
2617 pub this: Expression,
2619 pub low: Expression,
2621 pub high: Expression,
2623 pub not: bool,
2625}
2626
2627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2629#[cfg_attr(feature = "bindings", derive(TS))]
2630pub struct IsNull {
2631 pub this: Expression,
2632 pub not: bool,
2633 #[serde(default)]
2635 pub postfix_form: bool,
2636}
2637
2638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2640#[cfg_attr(feature = "bindings", derive(TS))]
2641pub struct IsTrueFalse {
2642 pub this: Expression,
2643 pub not: bool,
2644}
2645
2646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2649#[cfg_attr(feature = "bindings", derive(TS))]
2650pub struct IsJson {
2651 pub this: Expression,
2652 pub json_type: Option<String>,
2654 pub unique_keys: Option<JsonUniqueKeys>,
2656 pub negated: bool,
2658}
2659
2660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2662#[cfg_attr(feature = "bindings", derive(TS))]
2663pub enum JsonUniqueKeys {
2664 With,
2666 Without,
2668 Shorthand,
2670}
2671
2672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2674#[cfg_attr(feature = "bindings", derive(TS))]
2675pub struct Exists {
2676 pub this: Expression,
2678 pub not: bool,
2680}
2681
2682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2689#[cfg_attr(feature = "bindings", derive(TS))]
2690pub struct Function {
2691 pub name: String,
2693 pub args: Vec<Expression>,
2695 pub distinct: bool,
2697 #[serde(default)]
2698 pub trailing_comments: Vec<String>,
2699 #[serde(default)]
2701 pub use_bracket_syntax: bool,
2702 #[serde(default)]
2704 pub no_parens: bool,
2705 #[serde(default)]
2707 pub quoted: bool,
2708}
2709
2710impl Default for Function {
2711 fn default() -> Self {
2712 Self {
2713 name: String::new(),
2714 args: Vec::new(),
2715 distinct: false,
2716 trailing_comments: Vec::new(),
2717 use_bracket_syntax: false,
2718 no_parens: false,
2719 quoted: false,
2720 }
2721 }
2722}
2723
2724impl Function {
2725 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
2726 Self {
2727 name: name.into(),
2728 args,
2729 distinct: false,
2730 trailing_comments: Vec::new(),
2731 use_bracket_syntax: false,
2732 no_parens: false,
2733 quoted: false,
2734 }
2735 }
2736}
2737
2738#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
2745#[cfg_attr(feature = "bindings", derive(TS))]
2746pub struct AggregateFunction {
2747 pub name: String,
2749 pub args: Vec<Expression>,
2751 pub distinct: bool,
2753 pub filter: Option<Expression>,
2755 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2757 pub order_by: Vec<Ordered>,
2758 #[serde(default, skip_serializing_if = "Option::is_none")]
2760 pub limit: Option<Box<Expression>>,
2761 #[serde(default, skip_serializing_if = "Option::is_none")]
2763 pub ignore_nulls: Option<bool>,
2764}
2765
2766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2773#[cfg_attr(feature = "bindings", derive(TS))]
2774pub struct WindowFunction {
2775 pub this: Expression,
2777 pub over: Over,
2779 #[serde(default, skip_serializing_if = "Option::is_none")]
2781 pub keep: Option<Keep>,
2782}
2783
2784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2787#[cfg_attr(feature = "bindings", derive(TS))]
2788pub struct Keep {
2789 pub first: bool,
2791 pub order_by: Vec<Ordered>,
2793}
2794
2795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2797#[cfg_attr(feature = "bindings", derive(TS))]
2798pub struct WithinGroup {
2799 pub this: Expression,
2801 pub order_by: Vec<Ordered>,
2803}
2804
2805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2810#[cfg_attr(feature = "bindings", derive(TS))]
2811pub struct From {
2812 pub expressions: Vec<Expression>,
2814}
2815
2816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2822#[cfg_attr(feature = "bindings", derive(TS))]
2823pub struct Join {
2824 pub this: Expression,
2826 pub on: Option<Expression>,
2828 pub using: Vec<Identifier>,
2830 pub kind: JoinKind,
2832 pub use_inner_keyword: bool,
2834 pub use_outer_keyword: bool,
2836 pub deferred_condition: bool,
2838 #[serde(default, skip_serializing_if = "Option::is_none")]
2840 pub join_hint: Option<String>,
2841 #[serde(default, skip_serializing_if = "Option::is_none")]
2843 pub match_condition: Option<Expression>,
2844 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2846 pub pivots: Vec<Expression>,
2847}
2848
2849#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2856#[cfg_attr(feature = "bindings", derive(TS))]
2857pub enum JoinKind {
2858 Inner,
2859 Left,
2860 Right,
2861 Full,
2862 Outer, Cross,
2864 Natural,
2865 NaturalLeft,
2866 NaturalRight,
2867 NaturalFull,
2868 Semi,
2869 Anti,
2870 LeftSemi,
2872 LeftAnti,
2873 RightSemi,
2874 RightAnti,
2875 CrossApply,
2877 OuterApply,
2878 AsOf,
2880 AsOfLeft,
2881 AsOfRight,
2882 Lateral,
2884 LeftLateral,
2885 Straight,
2887 Implicit,
2889 Array,
2891 LeftArray,
2892}
2893
2894impl Default for JoinKind {
2895 fn default() -> Self {
2896 JoinKind::Inner
2897 }
2898}
2899
2900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2903#[cfg_attr(feature = "bindings", derive(TS))]
2904pub struct JoinedTable {
2905 pub left: Expression,
2907 pub joins: Vec<Join>,
2909 pub lateral_views: Vec<LateralView>,
2911 pub alias: Option<Identifier>,
2913}
2914
2915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2917#[cfg_attr(feature = "bindings", derive(TS))]
2918pub struct Where {
2919 pub this: Expression,
2921}
2922
2923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2928#[cfg_attr(feature = "bindings", derive(TS))]
2929pub struct GroupBy {
2930 pub expressions: Vec<Expression>,
2932 #[serde(default)]
2934 pub all: Option<bool>,
2935 #[serde(default)]
2937 pub totals: bool,
2938}
2939
2940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2942#[cfg_attr(feature = "bindings", derive(TS))]
2943pub struct Having {
2944 pub this: Expression,
2946}
2947
2948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2950#[cfg_attr(feature = "bindings", derive(TS))]
2951pub struct OrderBy {
2952 pub expressions: Vec<Ordered>,
2954 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2956 pub siblings: bool,
2957}
2958
2959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2966#[cfg_attr(feature = "bindings", derive(TS))]
2967pub struct Ordered {
2968 pub this: Expression,
2970 pub desc: bool,
2972 pub nulls_first: Option<bool>,
2974 #[serde(default)]
2976 pub explicit_asc: bool,
2977 #[serde(default, skip_serializing_if = "Option::is_none")]
2979 pub with_fill: Option<Box<WithFill>>,
2980}
2981
2982impl Ordered {
2983 pub fn asc(expr: Expression) -> Self {
2984 Self {
2985 this: expr,
2986 desc: false,
2987 nulls_first: None,
2988 explicit_asc: false,
2989 with_fill: None,
2990 }
2991 }
2992
2993 pub fn desc(expr: Expression) -> Self {
2994 Self {
2995 this: expr,
2996 desc: true,
2997 nulls_first: None,
2998 explicit_asc: false,
2999 with_fill: None,
3000 }
3001 }
3002}
3003
3004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3007#[cfg_attr(feature = "bindings", derive(TS))]
3008#[cfg_attr(feature = "bindings", ts(export))]
3009pub struct DistributeBy {
3010 pub expressions: Vec<Expression>,
3011}
3012
3013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3016#[cfg_attr(feature = "bindings", derive(TS))]
3017#[cfg_attr(feature = "bindings", ts(export))]
3018pub struct ClusterBy {
3019 pub expressions: Vec<Ordered>,
3020}
3021
3022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3025#[cfg_attr(feature = "bindings", derive(TS))]
3026#[cfg_attr(feature = "bindings", ts(export))]
3027pub struct SortBy {
3028 pub expressions: Vec<Ordered>,
3029}
3030
3031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3034#[cfg_attr(feature = "bindings", derive(TS))]
3035#[cfg_attr(feature = "bindings", ts(export))]
3036pub struct LateralView {
3037 pub this: Expression,
3039 pub table_alias: Option<Identifier>,
3041 pub column_aliases: Vec<Identifier>,
3043 pub outer: bool,
3045}
3046
3047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3049#[cfg_attr(feature = "bindings", derive(TS))]
3050#[cfg_attr(feature = "bindings", ts(export))]
3051pub struct Hint {
3052 pub expressions: Vec<HintExpression>,
3053}
3054
3055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3057#[cfg_attr(feature = "bindings", derive(TS))]
3058#[cfg_attr(feature = "bindings", ts(export))]
3059pub enum HintExpression {
3060 Function { name: String, args: Vec<Expression> },
3062 Identifier(String),
3064 Raw(String),
3066}
3067
3068#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3070#[cfg_attr(feature = "bindings", derive(TS))]
3071#[cfg_attr(feature = "bindings", ts(export))]
3072pub enum PseudocolumnType {
3073 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
3080
3081impl PseudocolumnType {
3082 pub fn as_str(&self) -> &'static str {
3083 match self {
3084 PseudocolumnType::Rownum => "ROWNUM",
3085 PseudocolumnType::Rowid => "ROWID",
3086 PseudocolumnType::Level => "LEVEL",
3087 PseudocolumnType::Sysdate => "SYSDATE",
3088 PseudocolumnType::ObjectId => "OBJECT_ID",
3089 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
3090 }
3091 }
3092
3093 pub fn from_str(s: &str) -> Option<Self> {
3094 match s.to_uppercase().as_str() {
3095 "ROWNUM" => Some(PseudocolumnType::Rownum),
3096 "ROWID" => Some(PseudocolumnType::Rowid),
3097 "LEVEL" => Some(PseudocolumnType::Level),
3098 "SYSDATE" => Some(PseudocolumnType::Sysdate),
3099 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
3100 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
3101 _ => None,
3102 }
3103 }
3104}
3105
3106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3109#[cfg_attr(feature = "bindings", derive(TS))]
3110#[cfg_attr(feature = "bindings", ts(export))]
3111pub struct Pseudocolumn {
3112 pub kind: PseudocolumnType,
3113}
3114
3115impl Pseudocolumn {
3116 pub fn rownum() -> Self {
3117 Self { kind: PseudocolumnType::Rownum }
3118 }
3119
3120 pub fn rowid() -> Self {
3121 Self { kind: PseudocolumnType::Rowid }
3122 }
3123
3124 pub fn level() -> Self {
3125 Self { kind: PseudocolumnType::Level }
3126 }
3127}
3128
3129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3131#[cfg_attr(feature = "bindings", derive(TS))]
3132#[cfg_attr(feature = "bindings", ts(export))]
3133pub struct Connect {
3134 pub start: Option<Expression>,
3136 pub connect: Expression,
3138 pub nocycle: bool,
3140}
3141
3142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3144#[cfg_attr(feature = "bindings", derive(TS))]
3145#[cfg_attr(feature = "bindings", ts(export))]
3146pub struct Prior {
3147 pub this: Expression,
3148}
3149
3150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3152#[cfg_attr(feature = "bindings", derive(TS))]
3153#[cfg_attr(feature = "bindings", ts(export))]
3154pub struct ConnectByRoot {
3155 pub this: Expression,
3156}
3157
3158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3160#[cfg_attr(feature = "bindings", derive(TS))]
3161#[cfg_attr(feature = "bindings", ts(export))]
3162pub struct MatchRecognize {
3163 pub this: Option<Box<Expression>>,
3165 pub partition_by: Option<Vec<Expression>>,
3167 pub order_by: Option<Vec<Ordered>>,
3169 pub measures: Option<Vec<MatchRecognizeMeasure>>,
3171 pub rows: Option<MatchRecognizeRows>,
3173 pub after: Option<MatchRecognizeAfter>,
3175 pub pattern: Option<String>,
3177 pub define: Option<Vec<(Identifier, Expression)>>,
3179 pub alias: Option<Identifier>,
3181 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3183 pub alias_explicit_as: bool,
3184}
3185
3186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3188#[cfg_attr(feature = "bindings", derive(TS))]
3189#[cfg_attr(feature = "bindings", ts(export))]
3190pub struct MatchRecognizeMeasure {
3191 pub this: Expression,
3193 pub window_frame: Option<MatchRecognizeSemantics>,
3195}
3196
3197#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3199#[cfg_attr(feature = "bindings", derive(TS))]
3200#[cfg_attr(feature = "bindings", ts(export))]
3201pub enum MatchRecognizeSemantics {
3202 Running,
3203 Final,
3204}
3205
3206#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3208#[cfg_attr(feature = "bindings", derive(TS))]
3209#[cfg_attr(feature = "bindings", ts(export))]
3210pub enum MatchRecognizeRows {
3211 OneRowPerMatch,
3212 AllRowsPerMatch,
3213 AllRowsPerMatchShowEmptyMatches,
3214 AllRowsPerMatchOmitEmptyMatches,
3215 AllRowsPerMatchWithUnmatchedRows,
3216}
3217
3218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3220#[cfg_attr(feature = "bindings", derive(TS))]
3221#[cfg_attr(feature = "bindings", ts(export))]
3222pub enum MatchRecognizeAfter {
3223 PastLastRow,
3224 ToNextRow,
3225 ToFirst(Identifier),
3226 ToLast(Identifier),
3227}
3228
3229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3231#[cfg_attr(feature = "bindings", derive(TS))]
3232pub struct Limit {
3233 pub this: Expression,
3235 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3237 pub percent: bool,
3238}
3239
3240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3242#[cfg_attr(feature = "bindings", derive(TS))]
3243pub struct Offset {
3244 pub this: Expression,
3245 #[serde(skip_serializing_if = "Option::is_none", default)]
3247 pub rows: Option<bool>,
3248}
3249
3250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3252#[cfg_attr(feature = "bindings", derive(TS))]
3253pub struct Top {
3254 pub this: Expression,
3255 pub percent: bool,
3256 pub with_ties: bool,
3257 #[serde(default)]
3259 pub parenthesized: bool,
3260}
3261
3262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3264#[cfg_attr(feature = "bindings", derive(TS))]
3265pub struct Fetch {
3266 pub direction: String,
3268 pub count: Option<Expression>,
3270 pub percent: bool,
3272 pub rows: bool,
3274 pub with_ties: bool,
3276}
3277
3278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3284#[cfg_attr(feature = "bindings", derive(TS))]
3285pub struct Qualify {
3286 pub this: Expression,
3288}
3289
3290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3292#[cfg_attr(feature = "bindings", derive(TS))]
3293pub struct Sample {
3294 pub method: SampleMethod,
3295 pub size: Expression,
3296 pub seed: Option<Expression>,
3297 #[serde(default)]
3299 pub offset: Option<Expression>,
3300 pub unit_after_size: bool,
3302 #[serde(default)]
3304 pub use_sample_keyword: bool,
3305 #[serde(default)]
3307 pub explicit_method: bool,
3308 #[serde(default)]
3310 pub method_before_size: bool,
3311 #[serde(default)]
3313 pub use_seed_keyword: bool,
3314 pub bucket_numerator: Option<Box<Expression>>,
3316 pub bucket_denominator: Option<Box<Expression>>,
3318 pub bucket_field: Option<Box<Expression>>,
3320 #[serde(default)]
3322 pub is_using_sample: bool,
3323 #[serde(default)]
3325 pub is_percent: bool,
3326 #[serde(default)]
3328 pub suppress_method_output: bool,
3329}
3330
3331#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3333#[cfg_attr(feature = "bindings", derive(TS))]
3334pub enum SampleMethod {
3335 Bernoulli,
3336 System,
3337 Block,
3338 Row,
3339 Percent,
3340 Bucket,
3342 Reservoir,
3344}
3345
3346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3348#[cfg_attr(feature = "bindings", derive(TS))]
3349pub struct NamedWindow {
3350 pub name: Identifier,
3351 pub spec: Over,
3352}
3353
3354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3360#[cfg_attr(feature = "bindings", derive(TS))]
3361pub struct With {
3362 pub ctes: Vec<Cte>,
3364 pub recursive: bool,
3366 #[serde(default)]
3368 pub leading_comments: Vec<String>,
3369 #[serde(default, skip_serializing_if = "Option::is_none")]
3371 pub search: Option<Box<Expression>>,
3372}
3373
3374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3381#[cfg_attr(feature = "bindings", derive(TS))]
3382pub struct Cte {
3383 pub alias: Identifier,
3385 pub this: Expression,
3387 pub columns: Vec<Identifier>,
3389 pub materialized: Option<bool>,
3391 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3393 pub key_expressions: Vec<Identifier>,
3394 #[serde(default)]
3396 pub alias_first: bool,
3397}
3398
3399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3401#[cfg_attr(feature = "bindings", derive(TS))]
3402pub struct WindowSpec {
3403 pub partition_by: Vec<Expression>,
3404 pub order_by: Vec<Ordered>,
3405 pub frame: Option<WindowFrame>,
3406}
3407
3408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3410#[cfg_attr(feature = "bindings", derive(TS))]
3411pub struct Over {
3412 pub window_name: Option<Identifier>,
3414 pub partition_by: Vec<Expression>,
3415 pub order_by: Vec<Ordered>,
3416 pub frame: Option<WindowFrame>,
3417 pub alias: Option<Identifier>,
3418}
3419
3420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3422#[cfg_attr(feature = "bindings", derive(TS))]
3423pub struct WindowFrame {
3424 pub kind: WindowFrameKind,
3425 pub start: WindowFrameBound,
3426 pub end: Option<WindowFrameBound>,
3427 pub exclude: Option<WindowFrameExclude>,
3428 #[serde(default, skip_serializing_if = "Option::is_none")]
3430 pub kind_text: Option<String>,
3431 #[serde(default, skip_serializing_if = "Option::is_none")]
3433 pub start_side_text: Option<String>,
3434 #[serde(default, skip_serializing_if = "Option::is_none")]
3436 pub end_side_text: Option<String>,
3437}
3438
3439#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3440#[cfg_attr(feature = "bindings", derive(TS))]
3441pub enum WindowFrameKind {
3442 Rows,
3443 Range,
3444 Groups,
3445}
3446
3447#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3449#[cfg_attr(feature = "bindings", derive(TS))]
3450pub enum WindowFrameExclude {
3451 CurrentRow,
3452 Group,
3453 Ties,
3454 NoOthers,
3455}
3456
3457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3458#[cfg_attr(feature = "bindings", derive(TS))]
3459pub enum WindowFrameBound {
3460 CurrentRow,
3461 UnboundedPreceding,
3462 UnboundedFollowing,
3463 Preceding(Box<Expression>),
3464 Following(Box<Expression>),
3465 BarePreceding,
3467 BareFollowing,
3469 Value(Box<Expression>),
3471}
3472
3473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3475#[cfg_attr(feature = "bindings", derive(TS))]
3476pub struct StructField {
3477 pub name: String,
3478 pub data_type: DataType,
3479 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3480 pub options: Vec<Expression>,
3481 #[serde(default, skip_serializing_if = "Option::is_none")]
3482 pub comment: Option<String>,
3483}
3484
3485impl StructField {
3486 pub fn new(name: String, data_type: DataType) -> Self {
3488 Self { name, data_type, options: Vec::new(), comment: None }
3489 }
3490
3491 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
3493 Self { name, data_type, options, comment: None }
3494 }
3495
3496 pub fn with_options_and_comment(name: String, data_type: DataType, options: Vec<Expression>, comment: Option<String>) -> Self {
3498 Self { name, data_type, options, comment }
3499 }
3500}
3501
3502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3514#[cfg_attr(feature = "bindings", derive(TS))]
3515#[serde(tag = "data_type", rename_all = "snake_case")]
3516pub enum DataType {
3517 Boolean,
3519 TinyInt { length: Option<u32> },
3520 SmallInt { length: Option<u32> },
3521 Int { length: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] integer_spelling: bool },
3525 BigInt { length: Option<u32> },
3526 Float { precision: Option<u32>, scale: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] real_spelling: bool },
3530 Double { precision: Option<u32>, scale: Option<u32> },
3531 Decimal { precision: Option<u32>, scale: Option<u32> },
3532
3533 Char { length: Option<u32> },
3535 VarChar { length: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] parenthesized_length: bool },
3538 String { length: Option<u32> },
3540 Text,
3541
3542 Binary { length: Option<u32> },
3544 VarBinary { length: Option<u32> },
3545 Blob,
3546
3547 Bit { length: Option<u32> },
3549 VarBit { length: Option<u32> },
3550
3551 Date,
3553 Time { precision: Option<u32>, #[serde(default)] timezone: bool },
3554 Timestamp { precision: Option<u32>, timezone: bool },
3555 Interval {
3556 unit: Option<String>,
3557 #[serde(default, skip_serializing_if = "Option::is_none")]
3559 to: Option<String>,
3560 },
3561
3562 Json,
3564 JsonB,
3565
3566 Uuid,
3568
3569 Array {
3571 element_type: Box<DataType>,
3572 #[serde(default, skip_serializing_if = "Option::is_none")]
3574 dimension: Option<u32>,
3575 },
3576
3577 List {
3580 element_type: Box<DataType>,
3581 },
3582
3583 Struct { fields: Vec<StructField>, nested: bool },
3587 Map { key_type: Box<DataType>, value_type: Box<DataType> },
3588
3589 Enum { values: Vec<String>, #[serde(default, skip_serializing_if = "Vec::is_empty")] assignments: Vec<Option<String>> },
3591
3592 Set { values: Vec<String> },
3594
3595 Union { fields: Vec<(String, DataType)> },
3597
3598 Vector { #[serde(default)] element_type: Option<Box<DataType>>, dimension: Option<u32> },
3600
3601 Object { fields: Vec<(String, DataType, bool)>, modifier: Option<String> },
3604
3605 Custom { name: String },
3607
3608 Geometry {
3610 subtype: Option<String>,
3611 srid: Option<u32>,
3612 },
3613 Geography {
3614 subtype: Option<String>,
3615 srid: Option<u32>,
3616 },
3617
3618 CharacterSet { name: String },
3621
3622 Unknown,
3624}
3625
3626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3628#[cfg_attr(feature = "bindings", derive(TS))]
3629#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
3630pub struct Array {
3631 pub expressions: Vec<Expression>,
3632}
3633
3634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3636#[cfg_attr(feature = "bindings", derive(TS))]
3637pub struct Struct {
3638 pub fields: Vec<(Option<String>, Expression)>,
3639}
3640
3641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3643#[cfg_attr(feature = "bindings", derive(TS))]
3644pub struct Tuple {
3645 pub expressions: Vec<Expression>,
3646}
3647
3648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3650#[cfg_attr(feature = "bindings", derive(TS))]
3651pub struct Interval {
3652 pub this: Option<Expression>,
3654 pub unit: Option<IntervalUnitSpec>,
3656}
3657
3658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3660#[cfg_attr(feature = "bindings", derive(TS))]
3661#[serde(tag = "type", rename_all = "snake_case")]
3662pub enum IntervalUnitSpec {
3663 Simple {
3665 unit: IntervalUnit,
3666 use_plural: bool,
3668 },
3669 Span(IntervalSpan),
3671 ExprSpan(IntervalSpanExpr),
3674 Expr(Box<Expression>),
3676}
3677
3678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3680#[cfg_attr(feature = "bindings", derive(TS))]
3681pub struct IntervalSpan {
3682 pub this: IntervalUnit,
3684 pub expression: IntervalUnit,
3686}
3687
3688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3691#[cfg_attr(feature = "bindings", derive(TS))]
3692pub struct IntervalSpanExpr {
3693 pub this: Box<Expression>,
3695 pub expression: Box<Expression>,
3697}
3698
3699#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3700#[cfg_attr(feature = "bindings", derive(TS))]
3701pub enum IntervalUnit {
3702 Year,
3703 Quarter,
3704 Month,
3705 Week,
3706 Day,
3707 Hour,
3708 Minute,
3709 Second,
3710 Millisecond,
3711 Microsecond,
3712}
3713
3714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3716#[cfg_attr(feature = "bindings", derive(TS))]
3717pub struct Command {
3718 pub this: String,
3720}
3721
3722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3725#[cfg_attr(feature = "bindings", derive(TS))]
3726pub struct ExecuteStatement {
3727 pub this: Expression,
3729 #[serde(default)]
3731 pub parameters: Vec<ExecuteParameter>,
3732}
3733
3734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3736#[cfg_attr(feature = "bindings", derive(TS))]
3737pub struct ExecuteParameter {
3738 pub name: String,
3740 pub value: Expression,
3742}
3743
3744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3747#[cfg_attr(feature = "bindings", derive(TS))]
3748pub struct Kill {
3749 pub this: Expression,
3751 pub kind: Option<String>,
3753}
3754
3755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3757#[cfg_attr(feature = "bindings", derive(TS))]
3758pub struct Raw {
3759 pub sql: String,
3760}
3761
3762#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3768#[cfg_attr(feature = "bindings", derive(TS))]
3769pub struct UnaryFunc {
3770 pub this: Expression,
3771 #[serde(skip_serializing_if = "Option::is_none", default)]
3773 pub original_name: Option<String>,
3774}
3775
3776impl UnaryFunc {
3777 pub fn new(this: Expression) -> Self {
3779 Self { this, original_name: None }
3780 }
3781
3782 pub fn with_name(this: Expression, name: String) -> Self {
3784 Self { this, original_name: Some(name) }
3785 }
3786}
3787
3788#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3792#[cfg_attr(feature = "bindings", derive(TS))]
3793pub struct CharFunc {
3794 pub args: Vec<Expression>,
3795 #[serde(skip_serializing_if = "Option::is_none", default)]
3796 pub charset: Option<String>,
3797 #[serde(skip_serializing_if = "Option::is_none", default)]
3799 pub name: Option<String>,
3800}
3801
3802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3804#[cfg_attr(feature = "bindings", derive(TS))]
3805pub struct BinaryFunc {
3806 pub this: Expression,
3807 pub expression: Expression,
3808 #[serde(skip_serializing_if = "Option::is_none", default)]
3810 pub original_name: Option<String>,
3811}
3812
3813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3815#[cfg_attr(feature = "bindings", derive(TS))]
3816pub struct VarArgFunc {
3817 pub expressions: Vec<Expression>,
3818 #[serde(skip_serializing_if = "Option::is_none", default)]
3820 pub original_name: Option<String>,
3821}
3822
3823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3825#[cfg_attr(feature = "bindings", derive(TS))]
3826pub struct ConcatWs {
3827 pub separator: Expression,
3828 pub expressions: Vec<Expression>,
3829}
3830
3831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3833#[cfg_attr(feature = "bindings", derive(TS))]
3834pub struct SubstringFunc {
3835 pub this: Expression,
3836 pub start: Expression,
3837 pub length: Option<Expression>,
3838 #[serde(default)]
3840 pub from_for_syntax: bool,
3841}
3842
3843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3845#[cfg_attr(feature = "bindings", derive(TS))]
3846pub struct OverlayFunc {
3847 pub this: Expression,
3848 pub replacement: Expression,
3849 pub from: Expression,
3850 pub length: Option<Expression>,
3851}
3852
3853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3855#[cfg_attr(feature = "bindings", derive(TS))]
3856pub struct TrimFunc {
3857 pub this: Expression,
3858 pub characters: Option<Expression>,
3859 pub position: TrimPosition,
3860 #[serde(default)]
3862 pub sql_standard_syntax: bool,
3863 #[serde(default)]
3865 pub position_explicit: bool,
3866}
3867
3868#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3869#[cfg_attr(feature = "bindings", derive(TS))]
3870pub enum TrimPosition {
3871 Both,
3872 Leading,
3873 Trailing,
3874}
3875
3876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3878#[cfg_attr(feature = "bindings", derive(TS))]
3879pub struct ReplaceFunc {
3880 pub this: Expression,
3881 pub old: Expression,
3882 pub new: Expression,
3883}
3884
3885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3887#[cfg_attr(feature = "bindings", derive(TS))]
3888pub struct LeftRightFunc {
3889 pub this: Expression,
3890 pub length: Expression,
3891}
3892
3893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3895#[cfg_attr(feature = "bindings", derive(TS))]
3896pub struct RepeatFunc {
3897 pub this: Expression,
3898 pub times: Expression,
3899}
3900
3901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3903#[cfg_attr(feature = "bindings", derive(TS))]
3904pub struct PadFunc {
3905 pub this: Expression,
3906 pub length: Expression,
3907 pub fill: Option<Expression>,
3908}
3909
3910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3912#[cfg_attr(feature = "bindings", derive(TS))]
3913pub struct SplitFunc {
3914 pub this: Expression,
3915 pub delimiter: Expression,
3916}
3917
3918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3920#[cfg_attr(feature = "bindings", derive(TS))]
3921pub struct RegexpFunc {
3922 pub this: Expression,
3923 pub pattern: Expression,
3924 pub flags: Option<Expression>,
3925}
3926
3927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3929#[cfg_attr(feature = "bindings", derive(TS))]
3930pub struct RegexpReplaceFunc {
3931 pub this: Expression,
3932 pub pattern: Expression,
3933 pub replacement: Expression,
3934 pub flags: Option<Expression>,
3935}
3936
3937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3939#[cfg_attr(feature = "bindings", derive(TS))]
3940pub struct RegexpExtractFunc {
3941 pub this: Expression,
3942 pub pattern: Expression,
3943 pub group: Option<Expression>,
3944}
3945
3946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3948#[cfg_attr(feature = "bindings", derive(TS))]
3949pub struct RoundFunc {
3950 pub this: Expression,
3951 pub decimals: Option<Expression>,
3952}
3953
3954#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3956#[cfg_attr(feature = "bindings", derive(TS))]
3957pub struct FloorFunc {
3958 pub this: Expression,
3959 pub scale: Option<Expression>,
3960 #[serde(skip_serializing_if = "Option::is_none", default)]
3962 pub to: Option<Expression>,
3963}
3964
3965#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3967#[cfg_attr(feature = "bindings", derive(TS))]
3968pub struct CeilFunc {
3969 pub this: Expression,
3970 #[serde(skip_serializing_if = "Option::is_none", default)]
3971 pub decimals: Option<Expression>,
3972 #[serde(skip_serializing_if = "Option::is_none", default)]
3974 pub to: Option<Expression>,
3975}
3976
3977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3979#[cfg_attr(feature = "bindings", derive(TS))]
3980pub struct LogFunc {
3981 pub this: Expression,
3982 pub base: Option<Expression>,
3983}
3984
3985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3987#[cfg_attr(feature = "bindings", derive(TS))]
3988pub struct CurrentDate;
3989
3990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3992#[cfg_attr(feature = "bindings", derive(TS))]
3993pub struct CurrentTime {
3994 pub precision: Option<u32>,
3995}
3996
3997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3999#[cfg_attr(feature = "bindings", derive(TS))]
4000pub struct CurrentTimestamp {
4001 pub precision: Option<u32>,
4002 #[serde(default)]
4004 pub sysdate: bool,
4005}
4006
4007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4009#[cfg_attr(feature = "bindings", derive(TS))]
4010pub struct CurrentTimestampLTZ {
4011 pub precision: Option<u32>,
4012}
4013
4014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4016#[cfg_attr(feature = "bindings", derive(TS))]
4017pub struct AtTimeZone {
4018 pub this: Expression,
4020 pub zone: Expression,
4022}
4023
4024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4026#[cfg_attr(feature = "bindings", derive(TS))]
4027pub struct DateAddFunc {
4028 pub this: Expression,
4029 pub interval: Expression,
4030 pub unit: IntervalUnit,
4031}
4032
4033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4035#[cfg_attr(feature = "bindings", derive(TS))]
4036pub struct DateDiffFunc {
4037 pub this: Expression,
4038 pub expression: Expression,
4039 pub unit: Option<IntervalUnit>,
4040}
4041
4042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4044#[cfg_attr(feature = "bindings", derive(TS))]
4045pub struct DateTruncFunc {
4046 pub this: Expression,
4047 pub unit: DateTimeField,
4048}
4049
4050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4052#[cfg_attr(feature = "bindings", derive(TS))]
4053pub struct ExtractFunc {
4054 pub this: Expression,
4055 pub field: DateTimeField,
4056}
4057
4058#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4059#[cfg_attr(feature = "bindings", derive(TS))]
4060pub enum DateTimeField {
4061 Year,
4062 Month,
4063 Day,
4064 Hour,
4065 Minute,
4066 Second,
4067 Millisecond,
4068 Microsecond,
4069 DayOfWeek,
4070 DayOfYear,
4071 Week,
4072 WeekWithModifier(String),
4074 Quarter,
4075 Epoch,
4076 Timezone,
4077 TimezoneHour,
4078 TimezoneMinute,
4079 Date,
4080 Time,
4081 Custom(String),
4083}
4084
4085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4087#[cfg_attr(feature = "bindings", derive(TS))]
4088pub struct ToDateFunc {
4089 pub this: Expression,
4090 pub format: Option<Expression>,
4091}
4092
4093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4095#[cfg_attr(feature = "bindings", derive(TS))]
4096pub struct ToTimestampFunc {
4097 pub this: Expression,
4098 pub format: Option<Expression>,
4099}
4100
4101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4103#[cfg_attr(feature = "bindings", derive(TS))]
4104pub struct IfFunc {
4105 pub condition: Expression,
4106 pub true_value: Expression,
4107 pub false_value: Option<Expression>,
4108 #[serde(skip_serializing_if = "Option::is_none", default)]
4110 pub original_name: Option<String>,
4111}
4112
4113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4115#[cfg_attr(feature = "bindings", derive(TS))]
4116pub struct Nvl2Func {
4117 pub this: Expression,
4118 pub true_value: Expression,
4119 pub false_value: Expression,
4120}
4121
4122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4128#[cfg_attr(feature = "bindings", derive(TS))]
4129pub struct AggFunc {
4130 pub this: Expression,
4131 pub distinct: bool,
4132 pub filter: Option<Expression>,
4133 pub order_by: Vec<Ordered>,
4134 #[serde(skip_serializing_if = "Option::is_none", default)]
4136 pub name: Option<String>,
4137 #[serde(skip_serializing_if = "Option::is_none", default)]
4139 pub ignore_nulls: Option<bool>,
4140 #[serde(skip_serializing_if = "Option::is_none", default)]
4143 pub having_max: Option<(Box<Expression>, bool)>,
4144 #[serde(skip_serializing_if = "Option::is_none", default)]
4146 pub limit: Option<Box<Expression>>,
4147}
4148
4149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4151#[cfg_attr(feature = "bindings", derive(TS))]
4152pub struct CountFunc {
4153 pub this: Option<Expression>,
4154 pub star: bool,
4155 pub distinct: bool,
4156 pub filter: Option<Expression>,
4157 #[serde(default, skip_serializing_if = "Option::is_none")]
4159 pub ignore_nulls: Option<bool>,
4160 #[serde(default, skip_serializing_if = "Option::is_none")]
4162 pub original_name: Option<String>,
4163}
4164
4165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4167#[cfg_attr(feature = "bindings", derive(TS))]
4168pub struct GroupConcatFunc {
4169 pub this: Expression,
4170 pub separator: Option<Expression>,
4171 pub order_by: Option<Vec<Ordered>>,
4172 pub distinct: bool,
4173 pub filter: Option<Expression>,
4174}
4175
4176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4178#[cfg_attr(feature = "bindings", derive(TS))]
4179pub struct StringAggFunc {
4180 pub this: Expression,
4181 #[serde(default)]
4182 pub separator: Option<Expression>,
4183 #[serde(default)]
4184 pub order_by: Option<Vec<Ordered>>,
4185 #[serde(default)]
4186 pub distinct: bool,
4187 #[serde(default)]
4188 pub filter: Option<Expression>,
4189 #[serde(default, skip_serializing_if = "Option::is_none")]
4191 pub limit: Option<Box<Expression>>,
4192}
4193
4194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4196#[cfg_attr(feature = "bindings", derive(TS))]
4197pub struct ListAggFunc {
4198 pub this: Expression,
4199 pub separator: Option<Expression>,
4200 pub on_overflow: Option<ListAggOverflow>,
4201 pub order_by: Option<Vec<Ordered>>,
4202 pub distinct: bool,
4203 pub filter: Option<Expression>,
4204}
4205
4206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4208#[cfg_attr(feature = "bindings", derive(TS))]
4209pub enum ListAggOverflow {
4210 Error,
4211 Truncate {
4212 filler: Option<Expression>,
4213 with_count: bool,
4214 },
4215}
4216
4217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4219#[cfg_attr(feature = "bindings", derive(TS))]
4220pub struct SumIfFunc {
4221 pub this: Expression,
4222 pub condition: Expression,
4223 pub filter: Option<Expression>,
4224}
4225
4226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4228#[cfg_attr(feature = "bindings", derive(TS))]
4229pub struct ApproxPercentileFunc {
4230 pub this: Expression,
4231 pub percentile: Expression,
4232 pub accuracy: Option<Expression>,
4233 pub filter: Option<Expression>,
4234}
4235
4236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4238#[cfg_attr(feature = "bindings", derive(TS))]
4239pub struct PercentileFunc {
4240 pub this: Expression,
4241 pub percentile: Expression,
4242 pub order_by: Option<Vec<Ordered>>,
4243 pub filter: Option<Expression>,
4244}
4245
4246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4252#[cfg_attr(feature = "bindings", derive(TS))]
4253pub struct RowNumber;
4254
4255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4257#[cfg_attr(feature = "bindings", derive(TS))]
4258pub struct Rank {
4259 #[serde(default, skip_serializing_if = "Option::is_none")]
4261 pub order_by: Option<Vec<Ordered>>,
4262 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4264 pub args: Vec<Expression>,
4265}
4266
4267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4269#[cfg_attr(feature = "bindings", derive(TS))]
4270pub struct DenseRank {
4271 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4273 pub args: Vec<Expression>,
4274}
4275
4276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4278#[cfg_attr(feature = "bindings", derive(TS))]
4279pub struct NTileFunc {
4280 #[serde(default, skip_serializing_if = "Option::is_none")]
4282 pub num_buckets: Option<Expression>,
4283 #[serde(default, skip_serializing_if = "Option::is_none")]
4285 pub order_by: Option<Vec<Ordered>>,
4286}
4287
4288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4290#[cfg_attr(feature = "bindings", derive(TS))]
4291pub struct LeadLagFunc {
4292 pub this: Expression,
4293 pub offset: Option<Expression>,
4294 pub default: Option<Expression>,
4295 pub ignore_nulls: bool,
4296}
4297
4298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4300#[cfg_attr(feature = "bindings", derive(TS))]
4301pub struct ValueFunc {
4302 pub this: Expression,
4303 #[serde(default, skip_serializing_if = "Option::is_none")]
4305 pub ignore_nulls: Option<bool>,
4306}
4307
4308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4310#[cfg_attr(feature = "bindings", derive(TS))]
4311pub struct NthValueFunc {
4312 pub this: Expression,
4313 pub offset: Expression,
4314 #[serde(default, skip_serializing_if = "Option::is_none")]
4316 pub ignore_nulls: Option<bool>,
4317}
4318
4319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4321#[cfg_attr(feature = "bindings", derive(TS))]
4322pub struct PercentRank {
4323 #[serde(default, skip_serializing_if = "Option::is_none")]
4325 pub order_by: Option<Vec<Ordered>>,
4326 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4328 pub args: Vec<Expression>,
4329}
4330
4331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4333#[cfg_attr(feature = "bindings", derive(TS))]
4334pub struct CumeDist {
4335 #[serde(default, skip_serializing_if = "Option::is_none")]
4337 pub order_by: Option<Vec<Ordered>>,
4338 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4340 pub args: Vec<Expression>,
4341}
4342
4343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4349#[cfg_attr(feature = "bindings", derive(TS))]
4350pub struct PositionFunc {
4351 pub substring: Expression,
4352 pub string: Expression,
4353 pub start: Option<Expression>,
4354}
4355
4356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4362#[cfg_attr(feature = "bindings", derive(TS))]
4363pub struct Random;
4364
4365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4367#[cfg_attr(feature = "bindings", derive(TS))]
4368pub struct Rand {
4369 pub seed: Option<Box<Expression>>,
4370 #[serde(default)]
4372 pub lower: Option<Box<Expression>>,
4373 #[serde(default)]
4375 pub upper: Option<Box<Expression>>,
4376}
4377
4378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4380#[cfg_attr(feature = "bindings", derive(TS))]
4381pub struct TruncateFunc {
4382 pub this: Expression,
4383 pub decimals: Option<Expression>,
4384}
4385
4386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4388#[cfg_attr(feature = "bindings", derive(TS))]
4389pub struct Pi;
4390
4391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4397#[cfg_attr(feature = "bindings", derive(TS))]
4398pub struct DecodeFunc {
4399 pub this: Expression,
4400 pub search_results: Vec<(Expression, Expression)>,
4401 pub default: Option<Expression>,
4402}
4403
4404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4410#[cfg_attr(feature = "bindings", derive(TS))]
4411pub struct DateFormatFunc {
4412 pub this: Expression,
4413 pub format: Expression,
4414}
4415
4416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4418#[cfg_attr(feature = "bindings", derive(TS))]
4419pub struct FromUnixtimeFunc {
4420 pub this: Expression,
4421 pub format: Option<Expression>,
4422}
4423
4424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4426#[cfg_attr(feature = "bindings", derive(TS))]
4427pub struct UnixTimestampFunc {
4428 pub this: Option<Expression>,
4429 pub format: Option<Expression>,
4430}
4431
4432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4434#[cfg_attr(feature = "bindings", derive(TS))]
4435pub struct MakeDateFunc {
4436 pub year: Expression,
4437 pub month: Expression,
4438 pub day: Expression,
4439}
4440
4441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4443#[cfg_attr(feature = "bindings", derive(TS))]
4444pub struct MakeTimestampFunc {
4445 pub year: Expression,
4446 pub month: Expression,
4447 pub day: Expression,
4448 pub hour: Expression,
4449 pub minute: Expression,
4450 pub second: Expression,
4451 pub timezone: Option<Expression>,
4452}
4453
4454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4456#[cfg_attr(feature = "bindings", derive(TS))]
4457pub struct LastDayFunc {
4458 pub this: Expression,
4459 #[serde(skip_serializing_if = "Option::is_none", default)]
4461 pub unit: Option<DateTimeField>,
4462}
4463
4464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4470#[cfg_attr(feature = "bindings", derive(TS))]
4471pub struct ArrayConstructor {
4472 pub expressions: Vec<Expression>,
4473 pub bracket_notation: bool,
4474 pub use_list_keyword: bool,
4476}
4477
4478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4480#[cfg_attr(feature = "bindings", derive(TS))]
4481pub struct ArraySortFunc {
4482 pub this: Expression,
4483 pub comparator: Option<Expression>,
4484 pub desc: bool,
4485 pub nulls_first: Option<bool>,
4486}
4487
4488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4490#[cfg_attr(feature = "bindings", derive(TS))]
4491pub struct ArrayJoinFunc {
4492 pub this: Expression,
4493 pub separator: Expression,
4494 pub null_replacement: Option<Expression>,
4495}
4496
4497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4499#[cfg_attr(feature = "bindings", derive(TS))]
4500pub struct UnnestFunc {
4501 pub this: Expression,
4502 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4504 pub expressions: Vec<Expression>,
4505 pub with_ordinality: bool,
4506 pub alias: Option<Identifier>,
4507 #[serde(default, skip_serializing_if = "Option::is_none")]
4509 pub offset_alias: Option<Identifier>,
4510}
4511
4512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4514#[cfg_attr(feature = "bindings", derive(TS))]
4515pub struct ArrayFilterFunc {
4516 pub this: Expression,
4517 pub filter: Expression,
4518}
4519
4520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4522#[cfg_attr(feature = "bindings", derive(TS))]
4523pub struct ArrayTransformFunc {
4524 pub this: Expression,
4525 pub transform: Expression,
4526}
4527
4528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4530#[cfg_attr(feature = "bindings", derive(TS))]
4531pub struct SequenceFunc {
4532 pub start: Expression,
4533 pub stop: Expression,
4534 pub step: Option<Expression>,
4535}
4536
4537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4543#[cfg_attr(feature = "bindings", derive(TS))]
4544pub struct StructConstructor {
4545 pub fields: Vec<(Option<Identifier>, Expression)>,
4546}
4547
4548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4550#[cfg_attr(feature = "bindings", derive(TS))]
4551pub struct StructExtractFunc {
4552 pub this: Expression,
4553 pub field: Identifier,
4554}
4555
4556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4558#[cfg_attr(feature = "bindings", derive(TS))]
4559pub struct NamedStructFunc {
4560 pub pairs: Vec<(Expression, Expression)>,
4561}
4562
4563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4569#[cfg_attr(feature = "bindings", derive(TS))]
4570pub struct MapConstructor {
4571 pub keys: Vec<Expression>,
4572 pub values: Vec<Expression>,
4573 #[serde(default)]
4575 pub curly_brace_syntax: bool,
4576 #[serde(default)]
4578 pub with_map_keyword: bool,
4579}
4580
4581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4583#[cfg_attr(feature = "bindings", derive(TS))]
4584pub struct TransformFunc {
4585 pub this: Expression,
4586 pub transform: Expression,
4587}
4588
4589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4595#[cfg_attr(feature = "bindings", derive(TS))]
4596pub struct JsonExtractFunc {
4597 pub this: Expression,
4598 pub path: Expression,
4599 pub returning: Option<DataType>,
4600 #[serde(default)]
4602 pub arrow_syntax: bool,
4603 #[serde(default)]
4605 pub hash_arrow_syntax: bool,
4606 #[serde(default)]
4608 pub wrapper_option: Option<String>,
4609 #[serde(default)]
4611 pub quotes_option: Option<String>,
4612 #[serde(default)]
4614 pub on_scalar_string: bool,
4615 #[serde(default)]
4617 pub on_error: Option<String>,
4618}
4619
4620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4622#[cfg_attr(feature = "bindings", derive(TS))]
4623pub struct JsonPathFunc {
4624 pub this: Expression,
4625 pub paths: Vec<Expression>,
4626}
4627
4628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4630#[cfg_attr(feature = "bindings", derive(TS))]
4631pub struct JsonObjectFunc {
4632 pub pairs: Vec<(Expression, Expression)>,
4633 pub null_handling: Option<JsonNullHandling>,
4634 #[serde(default)]
4635 pub with_unique_keys: bool,
4636 #[serde(default)]
4637 pub returning_type: Option<DataType>,
4638 #[serde(default)]
4639 pub format_json: bool,
4640 #[serde(default)]
4641 pub encoding: Option<String>,
4642 #[serde(default)]
4644 pub star: bool,
4645}
4646
4647#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4649#[cfg_attr(feature = "bindings", derive(TS))]
4650pub enum JsonNullHandling {
4651 NullOnNull,
4652 AbsentOnNull,
4653}
4654
4655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4657#[cfg_attr(feature = "bindings", derive(TS))]
4658pub struct JsonModifyFunc {
4659 pub this: Expression,
4660 pub path_values: Vec<(Expression, Expression)>,
4661}
4662
4663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4665#[cfg_attr(feature = "bindings", derive(TS))]
4666pub struct JsonArrayAggFunc {
4667 pub this: Expression,
4668 pub order_by: Option<Vec<Ordered>>,
4669 pub null_handling: Option<JsonNullHandling>,
4670 pub filter: Option<Expression>,
4671}
4672
4673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4675#[cfg_attr(feature = "bindings", derive(TS))]
4676pub struct JsonObjectAggFunc {
4677 pub key: Expression,
4678 pub value: Expression,
4679 pub null_handling: Option<JsonNullHandling>,
4680 pub filter: Option<Expression>,
4681}
4682
4683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4689#[cfg_attr(feature = "bindings", derive(TS))]
4690pub struct ConvertFunc {
4691 pub this: Expression,
4692 pub to: DataType,
4693 pub style: Option<Expression>,
4694}
4695
4696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4702#[cfg_attr(feature = "bindings", derive(TS))]
4703pub struct LambdaExpr {
4704 pub parameters: Vec<Identifier>,
4705 pub body: Expression,
4706 #[serde(default)]
4708 pub colon: bool,
4709 #[serde(default)]
4712 pub parameter_types: Vec<Option<DataType>>,
4713}
4714
4715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4717#[cfg_attr(feature = "bindings", derive(TS))]
4718pub struct Parameter {
4719 pub name: Option<String>,
4720 pub index: Option<u32>,
4721 pub style: ParameterStyle,
4722 #[serde(default)]
4724 pub quoted: bool,
4725 #[serde(default)]
4727 pub expression: Option<String>,
4728}
4729
4730#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4732#[cfg_attr(feature = "bindings", derive(TS))]
4733pub enum ParameterStyle {
4734 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
4744
4745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4747#[cfg_attr(feature = "bindings", derive(TS))]
4748pub struct Placeholder {
4749 pub index: Option<u32>,
4750}
4751
4752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4754#[cfg_attr(feature = "bindings", derive(TS))]
4755pub struct NamedArgument {
4756 pub name: Identifier,
4757 pub value: Expression,
4758 pub separator: NamedArgSeparator,
4760}
4761
4762#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4764#[cfg_attr(feature = "bindings", derive(TS))]
4765pub enum NamedArgSeparator {
4766 DArrow,
4768 ColonEq,
4770 Eq,
4772}
4773
4774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4777#[cfg_attr(feature = "bindings", derive(TS))]
4778pub struct TableArgument {
4779 pub prefix: String,
4781 pub this: Expression,
4783}
4784
4785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4787#[cfg_attr(feature = "bindings", derive(TS))]
4788pub struct SqlComment {
4789 pub text: String,
4790 pub is_block: bool,
4791}
4792
4793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4799#[cfg_attr(feature = "bindings", derive(TS))]
4800pub struct SimilarToExpr {
4801 pub this: Expression,
4802 pub pattern: Expression,
4803 pub escape: Option<Expression>,
4804 pub not: bool,
4805}
4806
4807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4809#[cfg_attr(feature = "bindings", derive(TS))]
4810pub struct QuantifiedExpr {
4811 pub this: Expression,
4812 pub subquery: Expression,
4813 pub op: Option<QuantifiedOp>,
4814}
4815
4816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4818#[cfg_attr(feature = "bindings", derive(TS))]
4819pub enum QuantifiedOp {
4820 Eq,
4821 Neq,
4822 Lt,
4823 Lte,
4824 Gt,
4825 Gte,
4826}
4827
4828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4833#[cfg_attr(feature = "bindings", derive(TS))]
4834pub struct OverlapsExpr {
4835 #[serde(skip_serializing_if = "Option::is_none")]
4837 pub this: Option<Expression>,
4838 #[serde(skip_serializing_if = "Option::is_none")]
4840 pub expression: Option<Expression>,
4841 #[serde(skip_serializing_if = "Option::is_none")]
4843 pub left_start: Option<Expression>,
4844 #[serde(skip_serializing_if = "Option::is_none")]
4846 pub left_end: Option<Expression>,
4847 #[serde(skip_serializing_if = "Option::is_none")]
4849 pub right_start: Option<Expression>,
4850 #[serde(skip_serializing_if = "Option::is_none")]
4852 pub right_end: Option<Expression>,
4853}
4854
4855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4861#[cfg_attr(feature = "bindings", derive(TS))]
4862pub struct Subscript {
4863 pub this: Expression,
4864 pub index: Expression,
4865}
4866
4867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4869#[cfg_attr(feature = "bindings", derive(TS))]
4870pub struct DotAccess {
4871 pub this: Expression,
4872 pub field: Identifier,
4873}
4874
4875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4877#[cfg_attr(feature = "bindings", derive(TS))]
4878pub struct MethodCall {
4879 pub this: Expression,
4880 pub method: Identifier,
4881 pub args: Vec<Expression>,
4882}
4883
4884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4886#[cfg_attr(feature = "bindings", derive(TS))]
4887pub struct ArraySlice {
4888 pub this: Expression,
4889 pub start: Option<Expression>,
4890 pub end: Option<Expression>,
4891}
4892
4893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4899#[cfg_attr(feature = "bindings", derive(TS))]
4900pub enum OnCommit {
4901 PreserveRows,
4903 DeleteRows,
4905}
4906
4907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4909#[cfg_attr(feature = "bindings", derive(TS))]
4910pub struct CreateTable {
4911 pub name: TableRef,
4912 #[serde(default, skip_serializing_if = "Option::is_none")]
4914 pub on_cluster: Option<OnCluster>,
4915 pub columns: Vec<ColumnDef>,
4916 pub constraints: Vec<TableConstraint>,
4917 pub if_not_exists: bool,
4918 pub temporary: bool,
4919 pub or_replace: bool,
4920 #[serde(default, skip_serializing_if = "Option::is_none")]
4922 pub table_modifier: Option<String>,
4923 pub as_select: Option<Expression>,
4924 #[serde(default)]
4926 pub as_select_parenthesized: bool,
4927 #[serde(default)]
4929 pub on_commit: Option<OnCommit>,
4930 #[serde(default)]
4932 pub clone_source: Option<TableRef>,
4933 #[serde(default, skip_serializing_if = "Option::is_none")]
4935 pub clone_at_clause: Option<Expression>,
4936 #[serde(default)]
4938 pub is_copy: bool,
4939 #[serde(default)]
4941 pub shallow_clone: bool,
4942 #[serde(default)]
4944 pub leading_comments: Vec<String>,
4945 #[serde(default)]
4947 pub with_properties: Vec<(String, String)>,
4948 #[serde(default)]
4950 pub teradata_post_name_options: Vec<String>,
4951 #[serde(default)]
4953 pub with_data: Option<bool>,
4954 #[serde(default)]
4956 pub with_statistics: Option<bool>,
4957 #[serde(default)]
4959 pub teradata_indexes: Vec<TeradataIndex>,
4960 #[serde(default)]
4962 pub with_cte: Option<With>,
4963 #[serde(default)]
4965 pub properties: Vec<Expression>,
4966 #[serde(default, skip_serializing_if = "Option::is_none")]
4968 pub partition_of: Option<Expression>,
4969 #[serde(default)]
4971 pub post_table_properties: Vec<Expression>,
4972 #[serde(default)]
4974 pub mysql_table_options: Vec<(String, String)>,
4975 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4977 pub inherits: Vec<TableRef>,
4978 #[serde(default, skip_serializing_if = "Option::is_none")]
4980 pub on_property: Option<OnProperty>,
4981 #[serde(default)]
4983 pub copy_grants: bool,
4984 #[serde(default, skip_serializing_if = "Option::is_none")]
4986 pub using_template: Option<Box<Expression>>,
4987 #[serde(default, skip_serializing_if = "Option::is_none")]
4989 pub rollup: Option<RollupProperty>,
4990}
4991
4992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4994#[cfg_attr(feature = "bindings", derive(TS))]
4995pub struct TeradataIndex {
4996 pub kind: TeradataIndexKind,
4998 pub name: Option<String>,
5000 pub columns: Vec<String>,
5002}
5003
5004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5006#[cfg_attr(feature = "bindings", derive(TS))]
5007pub enum TeradataIndexKind {
5008 NoPrimary,
5010 Primary,
5012 PrimaryAmp,
5014 Unique,
5016 UniquePrimary,
5018 Secondary,
5020}
5021
5022impl CreateTable {
5023 pub fn new(name: impl Into<String>) -> Self {
5024 Self {
5025 name: TableRef::new(name),
5026 on_cluster: None,
5027 columns: Vec::new(),
5028 constraints: Vec::new(),
5029 if_not_exists: false,
5030 temporary: false,
5031 or_replace: false,
5032 table_modifier: None,
5033 as_select: None,
5034 as_select_parenthesized: false,
5035 on_commit: None,
5036 clone_source: None,
5037 clone_at_clause: None,
5038 shallow_clone: false, is_copy: false,
5039 leading_comments: Vec::new(),
5040 with_properties: Vec::new(),
5041 teradata_post_name_options: Vec::new(),
5042 with_data: None,
5043 with_statistics: None,
5044 teradata_indexes: Vec::new(),
5045 with_cte: None,
5046 properties: Vec::new(),
5047 partition_of: None,
5048 post_table_properties: Vec::new(),
5049 mysql_table_options: Vec::new(),
5050 inherits: Vec::new(),
5051 on_property: None,
5052 copy_grants: false,
5053 using_template: None,
5054 rollup: None,
5055 }
5056 }
5057}
5058
5059#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
5061#[cfg_attr(feature = "bindings", derive(TS))]
5062pub enum SortOrder {
5063 Asc,
5064 Desc,
5065}
5066
5067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5069#[cfg_attr(feature = "bindings", derive(TS))]
5070pub enum ConstraintType {
5071 NotNull,
5072 Null,
5073 PrimaryKey,
5074 Unique,
5075 Default,
5076 AutoIncrement,
5077 Collate,
5078 Comment,
5079 References,
5080 Check,
5081 GeneratedAsIdentity,
5082 Tags,
5084 ComputedColumn,
5086 GeneratedAsRow,
5088 OnUpdate,
5090 Path,
5092 Encode,
5094}
5095
5096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5098#[cfg_attr(feature = "bindings", derive(TS))]
5099pub struct ColumnDef {
5100 pub name: Identifier,
5101 pub data_type: DataType,
5102 pub nullable: Option<bool>,
5103 pub default: Option<Expression>,
5104 pub primary_key: bool,
5105 #[serde(default)]
5107 pub primary_key_order: Option<SortOrder>,
5108 pub unique: bool,
5109 #[serde(default)]
5111 pub unique_nulls_not_distinct: bool,
5112 pub auto_increment: bool,
5113 pub comment: Option<String>,
5114 pub constraints: Vec<ColumnConstraint>,
5115 #[serde(default)]
5117 pub constraint_order: Vec<ConstraintType>,
5118 #[serde(default)]
5120 pub format: Option<String>,
5121 #[serde(default)]
5123 pub title: Option<String>,
5124 #[serde(default)]
5126 pub inline_length: Option<u64>,
5127 #[serde(default)]
5129 pub compress: Option<Vec<Expression>>,
5130 #[serde(default)]
5132 pub character_set: Option<String>,
5133 #[serde(default)]
5135 pub uppercase: bool,
5136 #[serde(default)]
5138 pub casespecific: Option<bool>,
5139 #[serde(default)]
5141 pub auto_increment_start: Option<Box<Expression>>,
5142 #[serde(default)]
5144 pub auto_increment_increment: Option<Box<Expression>>,
5145 #[serde(default)]
5147 pub auto_increment_order: Option<bool>,
5148 #[serde(default)]
5150 pub unsigned: bool,
5151 #[serde(default)]
5153 pub zerofill: bool,
5154 #[serde(default, skip_serializing_if = "Option::is_none")]
5156 pub on_update: Option<Expression>,
5157 #[serde(default, skip_serializing_if = "Option::is_none")]
5159 pub unique_constraint_name: Option<String>,
5160 #[serde(default, skip_serializing_if = "Option::is_none")]
5162 pub not_null_constraint_name: Option<String>,
5163 #[serde(default, skip_serializing_if = "Option::is_none")]
5165 pub primary_key_constraint_name: Option<String>,
5166 #[serde(default, skip_serializing_if = "Option::is_none")]
5168 pub check_constraint_name: Option<String>,
5169 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5171 pub options: Vec<Expression>,
5172 #[serde(default)]
5174 pub no_type: bool,
5175 #[serde(default, skip_serializing_if = "Option::is_none")]
5177 pub encoding: Option<String>,
5178 #[serde(default, skip_serializing_if = "Option::is_none")]
5180 pub codec: Option<String>,
5181 #[serde(default, skip_serializing_if = "Option::is_none")]
5183 pub ephemeral: Option<Option<Box<Expression>>>,
5184 #[serde(default, skip_serializing_if = "Option::is_none")]
5186 pub materialized_expr: Option<Box<Expression>>,
5187 #[serde(default, skip_serializing_if = "Option::is_none")]
5189 pub alias_expr: Option<Box<Expression>>,
5190 #[serde(default, skip_serializing_if = "Option::is_none")]
5192 pub ttl_expr: Option<Box<Expression>>,
5193 #[serde(default)]
5195 pub not_for_replication: bool,
5196}
5197
5198impl ColumnDef {
5199 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
5200 Self {
5201 name: Identifier::new(name),
5202 data_type,
5203 nullable: None,
5204 default: None,
5205 primary_key: false,
5206 primary_key_order: None,
5207 unique: false,
5208 unique_nulls_not_distinct: false,
5209 auto_increment: false,
5210 comment: None,
5211 constraints: Vec::new(),
5212 constraint_order: Vec::new(),
5213 format: None,
5214 title: None,
5215 inline_length: None,
5216 compress: None,
5217 character_set: None,
5218 uppercase: false,
5219 casespecific: None,
5220 auto_increment_start: None,
5221 auto_increment_increment: None,
5222 auto_increment_order: None,
5223 unsigned: false,
5224 zerofill: false,
5225 on_update: None,
5226 unique_constraint_name: None,
5227 not_null_constraint_name: None,
5228 primary_key_constraint_name: None,
5229 check_constraint_name: None,
5230 options: Vec::new(),
5231 no_type: false,
5232 encoding: None,
5233 codec: None,
5234 ephemeral: None,
5235 materialized_expr: None,
5236 alias_expr: None,
5237 ttl_expr: None,
5238 not_for_replication: false,
5239 }
5240 }
5241}
5242
5243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5245#[cfg_attr(feature = "bindings", derive(TS))]
5246pub enum ColumnConstraint {
5247 NotNull,
5248 Null,
5249 Unique,
5250 PrimaryKey,
5251 Default(Expression),
5252 Check(Expression),
5253 References(ForeignKeyRef),
5254 GeneratedAsIdentity(GeneratedAsIdentity),
5255 Collate(Identifier),
5256 Comment(String),
5257 Tags(Tags),
5259 ComputedColumn(ComputedColumn),
5262 GeneratedAsRow(GeneratedAsRow),
5264 Path(Expression),
5266}
5267
5268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5270#[cfg_attr(feature = "bindings", derive(TS))]
5271pub struct ComputedColumn {
5272 pub expression: Box<Expression>,
5274 #[serde(default)]
5276 pub persisted: bool,
5277 #[serde(default)]
5279 pub not_null: bool,
5280 #[serde(default)]
5283 pub persistence_kind: Option<String>,
5284 #[serde(default, skip_serializing_if = "Option::is_none")]
5286 pub data_type: Option<DataType>,
5287}
5288
5289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5291#[cfg_attr(feature = "bindings", derive(TS))]
5292pub struct GeneratedAsRow {
5293 pub start: bool,
5295 #[serde(default)]
5297 pub hidden: bool,
5298}
5299
5300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5302#[cfg_attr(feature = "bindings", derive(TS))]
5303pub struct GeneratedAsIdentity {
5304 pub always: bool,
5306 pub on_null: bool,
5308 pub start: Option<Box<Expression>>,
5310 pub increment: Option<Box<Expression>>,
5312 pub minvalue: Option<Box<Expression>>,
5314 pub maxvalue: Option<Box<Expression>>,
5316 pub cycle: Option<bool>,
5318}
5319
5320#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5322#[cfg_attr(feature = "bindings", derive(TS))]
5323pub struct ConstraintModifiers {
5324 pub enforced: Option<bool>,
5326 pub deferrable: Option<bool>,
5328 pub initially_deferred: Option<bool>,
5330 pub norely: bool,
5332 pub rely: bool,
5334 #[serde(default)]
5336 pub using: Option<String>,
5337 #[serde(default)]
5339 pub using_before_columns: bool,
5340 #[serde(default, skip_serializing_if = "Option::is_none")]
5342 pub comment: Option<String>,
5343 #[serde(default, skip_serializing_if = "Option::is_none")]
5345 pub visible: Option<bool>,
5346 #[serde(default, skip_serializing_if = "Option::is_none")]
5348 pub engine_attribute: Option<String>,
5349 #[serde(default, skip_serializing_if = "Option::is_none")]
5351 pub with_parser: Option<String>,
5352 #[serde(default)]
5354 pub not_valid: bool,
5355 #[serde(default, skip_serializing_if = "Option::is_none")]
5357 pub clustered: Option<String>,
5358 #[serde(default, skip_serializing_if = "Option::is_none")]
5360 pub on_conflict: Option<String>,
5361 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5363 pub with_options: Vec<(String, String)>,
5364 #[serde(default, skip_serializing_if = "Option::is_none")]
5366 pub on_filegroup: Option<Identifier>,
5367}
5368
5369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5371#[cfg_attr(feature = "bindings", derive(TS))]
5372pub enum TableConstraint {
5373 PrimaryKey {
5374 name: Option<Identifier>,
5375 columns: Vec<Identifier>,
5376 #[serde(default)]
5378 include_columns: Vec<Identifier>,
5379 #[serde(default)]
5380 modifiers: ConstraintModifiers,
5381 #[serde(default)]
5383 has_constraint_keyword: bool,
5384 },
5385 Unique {
5386 name: Option<Identifier>,
5387 columns: Vec<Identifier>,
5388 #[serde(default)]
5390 columns_parenthesized: bool,
5391 #[serde(default)]
5392 modifiers: ConstraintModifiers,
5393 #[serde(default)]
5395 has_constraint_keyword: bool,
5396 #[serde(default)]
5398 nulls_not_distinct: bool,
5399 },
5400 ForeignKey {
5401 name: Option<Identifier>,
5402 columns: Vec<Identifier>,
5403 #[serde(default)]
5404 references: Option<ForeignKeyRef>,
5405 #[serde(default)]
5407 on_delete: Option<ReferentialAction>,
5408 #[serde(default)]
5410 on_update: Option<ReferentialAction>,
5411 #[serde(default)]
5412 modifiers: ConstraintModifiers,
5413 },
5414 Check {
5415 name: Option<Identifier>,
5416 expression: Expression,
5417 #[serde(default)]
5418 modifiers: ConstraintModifiers,
5419 },
5420 Index {
5422 name: Option<Identifier>,
5423 columns: Vec<Identifier>,
5424 #[serde(default)]
5426 kind: Option<String>,
5427 #[serde(default)]
5428 modifiers: ConstraintModifiers,
5429 #[serde(default)]
5431 use_key_keyword: bool,
5432 #[serde(default, skip_serializing_if = "Option::is_none")]
5434 expression: Option<Box<Expression>>,
5435 #[serde(default, skip_serializing_if = "Option::is_none")]
5437 index_type: Option<Box<Expression>>,
5438 #[serde(default, skip_serializing_if = "Option::is_none")]
5440 granularity: Option<Box<Expression>>,
5441 },
5442 Projection {
5444 name: Identifier,
5445 expression: Expression,
5446 },
5447 Like {
5449 source: TableRef,
5450 options: Vec<(LikeOptionAction, String)>,
5452 },
5453 PeriodForSystemTime {
5455 start_col: Identifier,
5456 end_col: Identifier,
5457 },
5458 Exclude {
5461 name: Option<Identifier>,
5462 #[serde(default)]
5464 using: Option<String>,
5465 elements: Vec<ExcludeElement>,
5467 #[serde(default)]
5469 include_columns: Vec<Identifier>,
5470 #[serde(default)]
5472 where_clause: Option<Box<Expression>>,
5473 #[serde(default)]
5475 with_params: Vec<(String, String)>,
5476 #[serde(default)]
5478 using_index_tablespace: Option<String>,
5479 #[serde(default)]
5480 modifiers: ConstraintModifiers,
5481 },
5482 Tags(Tags),
5484 InitiallyDeferred {
5488 deferred: bool,
5490 },
5491}
5492
5493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5495#[cfg_attr(feature = "bindings", derive(TS))]
5496pub struct ExcludeElement {
5497 pub expression: String,
5499 pub operator: String,
5501}
5502
5503#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5505#[cfg_attr(feature = "bindings", derive(TS))]
5506pub enum LikeOptionAction {
5507 Including,
5508 Excluding,
5509}
5510
5511#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5513#[cfg_attr(feature = "bindings", derive(TS))]
5514pub enum MatchType {
5515 Full,
5516 Partial,
5517 Simple,
5518}
5519
5520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5522#[cfg_attr(feature = "bindings", derive(TS))]
5523pub struct ForeignKeyRef {
5524 pub table: TableRef,
5525 pub columns: Vec<Identifier>,
5526 pub on_delete: Option<ReferentialAction>,
5527 pub on_update: Option<ReferentialAction>,
5528 #[serde(default)]
5530 pub on_update_first: bool,
5531 #[serde(default)]
5533 pub match_type: Option<MatchType>,
5534 #[serde(default)]
5536 pub match_after_actions: bool,
5537 #[serde(default)]
5539 pub constraint_name: Option<String>,
5540 #[serde(default)]
5542 pub deferrable: Option<bool>,
5543 #[serde(default)]
5545 pub has_foreign_key_keywords: bool,
5546}
5547
5548#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5550#[cfg_attr(feature = "bindings", derive(TS))]
5551pub enum ReferentialAction {
5552 Cascade,
5553 SetNull,
5554 SetDefault,
5555 Restrict,
5556 NoAction,
5557}
5558
5559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5561#[cfg_attr(feature = "bindings", derive(TS))]
5562pub struct DropTable {
5563 pub names: Vec<TableRef>,
5564 pub if_exists: bool,
5565 pub cascade: bool,
5566 #[serde(default)]
5568 pub cascade_constraints: bool,
5569 #[serde(default)]
5571 pub purge: bool,
5572}
5573
5574impl DropTable {
5575 pub fn new(name: impl Into<String>) -> Self {
5576 Self {
5577 names: vec![TableRef::new(name)],
5578 if_exists: false,
5579 cascade: false,
5580 cascade_constraints: false,
5581 purge: false,
5582 }
5583 }
5584}
5585
5586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5588#[cfg_attr(feature = "bindings", derive(TS))]
5589pub struct AlterTable {
5590 pub name: TableRef,
5591 pub actions: Vec<AlterTableAction>,
5592 #[serde(default)]
5594 pub if_exists: bool,
5595 #[serde(default, skip_serializing_if = "Option::is_none")]
5597 pub algorithm: Option<String>,
5598 #[serde(default, skip_serializing_if = "Option::is_none")]
5600 pub lock: Option<String>,
5601 #[serde(default, skip_serializing_if = "Option::is_none")]
5603 pub with_check: Option<String>,
5604 #[serde(default, skip_serializing_if = "Option::is_none")]
5606 pub partition: Option<Vec<(Identifier, Expression)>>,
5607 #[serde(default, skip_serializing_if = "Option::is_none")]
5609 pub on_cluster: Option<OnCluster>,
5610}
5611
5612impl AlterTable {
5613 pub fn new(name: impl Into<String>) -> Self {
5614 Self {
5615 name: TableRef::new(name),
5616 actions: Vec::new(),
5617 if_exists: false,
5618 algorithm: None,
5619 lock: None,
5620 with_check: None,
5621 partition: None,
5622 on_cluster: None,
5623 }
5624 }
5625}
5626
5627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5629#[cfg_attr(feature = "bindings", derive(TS))]
5630pub enum ColumnPosition {
5631 First,
5632 After(Identifier),
5633}
5634
5635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5637#[cfg_attr(feature = "bindings", derive(TS))]
5638pub enum AlterTableAction {
5639 AddColumn {
5640 column: ColumnDef,
5641 if_not_exists: bool,
5642 position: Option<ColumnPosition>,
5643 },
5644 DropColumn {
5645 name: Identifier,
5646 if_exists: bool,
5647 cascade: bool,
5648 },
5649 RenameColumn {
5650 old_name: Identifier,
5651 new_name: Identifier,
5652 if_exists: bool,
5653 },
5654 AlterColumn {
5655 name: Identifier,
5656 action: AlterColumnAction,
5657 #[serde(default)]
5659 use_modify_keyword: bool,
5660 },
5661 RenameTable(TableRef),
5662 AddConstraint(TableConstraint),
5663 DropConstraint {
5664 name: Identifier,
5665 if_exists: bool,
5666 },
5667 DropForeignKey {
5669 name: Identifier,
5670 },
5671 DropPartition {
5673 partitions: Vec<Vec<(Identifier, Expression)>>,
5675 if_exists: bool,
5676 },
5677 AddPartition {
5679 partition: Expression,
5681 if_not_exists: bool,
5682 location: Option<Expression>,
5683 },
5684 Delete {
5686 where_clause: Expression,
5687 },
5688 SwapWith(TableRef),
5690 SetProperty {
5692 properties: Vec<(String, Expression)>,
5693 },
5694 UnsetProperty {
5696 properties: Vec<String>,
5697 },
5698 ClusterBy {
5700 expressions: Vec<Expression>,
5701 },
5702 SetTag {
5704 expressions: Vec<(String, Expression)>,
5705 },
5706 UnsetTag {
5708 names: Vec<String>,
5709 },
5710 SetOptions {
5712 expressions: Vec<Expression>,
5713 },
5714 AlterIndex {
5716 name: Identifier,
5717 visible: bool,
5718 },
5719 SetAttribute {
5721 attribute: String,
5722 },
5723 SetStageFileFormat {
5725 options: Option<Expression>,
5726 },
5727 SetStageCopyOptions {
5729 options: Option<Expression>,
5730 },
5731 AddColumns {
5733 columns: Vec<ColumnDef>,
5734 cascade: bool,
5735 },
5736 DropColumns {
5738 names: Vec<Identifier>,
5739 },
5740 ChangeColumn {
5743 old_name: Identifier,
5744 new_name: Identifier,
5745 #[serde(default, skip_serializing_if = "Option::is_none")]
5746 data_type: Option<DataType>,
5747 comment: Option<String>,
5748 #[serde(default)]
5749 cascade: bool,
5750 },
5751 AlterSortKey {
5754 this: Option<String>,
5756 expressions: Vec<Expression>,
5758 compound: bool,
5760 },
5761 AlterDistStyle {
5765 style: String,
5767 distkey: Option<Identifier>,
5769 },
5770 SetTableProperties {
5772 properties: Vec<(Expression, Expression)>,
5773 },
5774 SetLocation {
5776 location: String,
5777 },
5778 SetFileFormat {
5780 format: String,
5781 },
5782 ReplacePartition {
5784 partition: Expression,
5785 source: Option<Box<Expression>>,
5786 },
5787}
5788
5789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5791#[cfg_attr(feature = "bindings", derive(TS))]
5792pub enum AlterColumnAction {
5793 SetDataType {
5794 data_type: DataType,
5795 using: Option<Expression>,
5797 #[serde(default, skip_serializing_if = "Option::is_none")]
5799 collate: Option<String>,
5800 },
5801 SetDefault(Expression),
5802 DropDefault,
5803 SetNotNull,
5804 DropNotNull,
5805 Comment(String),
5807 SetVisible,
5809 SetInvisible,
5811}
5812
5813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5815#[cfg_attr(feature = "bindings", derive(TS))]
5816pub struct CreateIndex {
5817 pub name: Identifier,
5818 pub table: TableRef,
5819 pub columns: Vec<IndexColumn>,
5820 pub unique: bool,
5821 pub if_not_exists: bool,
5822 pub using: Option<String>,
5823 #[serde(default)]
5825 pub clustered: Option<String>,
5826 #[serde(default)]
5828 pub concurrently: bool,
5829 #[serde(default)]
5831 pub where_clause: Option<Box<Expression>>,
5832 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5834 pub include_columns: Vec<Identifier>,
5835 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5837 pub with_options: Vec<(String, String)>,
5838 #[serde(default)]
5840 pub on_filegroup: Option<String>,
5841}
5842
5843impl CreateIndex {
5844 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
5845 Self {
5846 name: Identifier::new(name),
5847 table: TableRef::new(table),
5848 columns: Vec::new(),
5849 unique: false,
5850 if_not_exists: false,
5851 using: None,
5852 clustered: None,
5853 concurrently: false,
5854 where_clause: None,
5855 include_columns: Vec::new(),
5856 with_options: Vec::new(),
5857 on_filegroup: None,
5858 }
5859 }
5860}
5861
5862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5864#[cfg_attr(feature = "bindings", derive(TS))]
5865pub struct IndexColumn {
5866 pub column: Identifier,
5867 pub desc: bool,
5868 #[serde(default)]
5870 pub asc: bool,
5871 pub nulls_first: Option<bool>,
5872 #[serde(default, skip_serializing_if = "Option::is_none")]
5874 pub opclass: Option<String>,
5875}
5876
5877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5879#[cfg_attr(feature = "bindings", derive(TS))]
5880pub struct DropIndex {
5881 pub name: Identifier,
5882 pub table: Option<TableRef>,
5883 pub if_exists: bool,
5884 #[serde(default)]
5886 pub concurrently: bool,
5887}
5888
5889impl DropIndex {
5890 pub fn new(name: impl Into<String>) -> Self {
5891 Self {
5892 name: Identifier::new(name),
5893 table: None,
5894 if_exists: false,
5895 concurrently: false,
5896 }
5897 }
5898}
5899
5900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5902#[cfg_attr(feature = "bindings", derive(TS))]
5903pub struct ViewColumn {
5904 pub name: Identifier,
5905 pub comment: Option<String>,
5906 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5908 pub options: Vec<Expression>,
5909}
5910
5911impl ViewColumn {
5912 pub fn new(name: impl Into<String>) -> Self {
5913 Self {
5914 name: Identifier::new(name),
5915 comment: None,
5916 options: Vec::new(),
5917 }
5918 }
5919
5920 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
5921 Self {
5922 name: Identifier::new(name),
5923 comment: Some(comment.into()),
5924 options: Vec::new(),
5925 }
5926 }
5927}
5928
5929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5931#[cfg_attr(feature = "bindings", derive(TS))]
5932pub struct CreateView {
5933 pub name: TableRef,
5934 pub columns: Vec<ViewColumn>,
5935 pub query: Expression,
5936 pub or_replace: bool,
5937 pub if_not_exists: bool,
5938 pub materialized: bool,
5939 pub temporary: bool,
5940 #[serde(default)]
5942 pub secure: bool,
5943 #[serde(skip_serializing_if = "Option::is_none")]
5945 pub algorithm: Option<String>,
5946 #[serde(skip_serializing_if = "Option::is_none")]
5948 pub definer: Option<String>,
5949 #[serde(skip_serializing_if = "Option::is_none")]
5951 pub security: Option<FunctionSecurity>,
5952 #[serde(default = "default_true")]
5954 pub security_sql_style: bool,
5955 #[serde(default)]
5957 pub query_parenthesized: bool,
5958 #[serde(skip_serializing_if = "Option::is_none")]
5960 pub locking_mode: Option<String>,
5961 #[serde(skip_serializing_if = "Option::is_none")]
5963 pub locking_access: Option<String>,
5964 #[serde(default)]
5966 pub copy_grants: bool,
5967 #[serde(skip_serializing_if = "Option::is_none", default)]
5969 pub comment: Option<String>,
5970 #[serde(default)]
5972 pub tags: Vec<(String, String)>,
5973 #[serde(default)]
5975 pub options: Vec<Expression>,
5976 #[serde(skip_serializing_if = "Option::is_none", default)]
5978 pub build: Option<String>,
5979 #[serde(skip_serializing_if = "Option::is_none", default)]
5981 pub refresh: Option<Box<RefreshTriggerProperty>>,
5982 #[serde(skip_serializing_if = "Option::is_none", default)]
5985 pub schema: Option<Box<Schema>>,
5986 #[serde(skip_serializing_if = "Option::is_none", default)]
5988 pub unique_key: Option<Box<UniqueKeyProperty>>,
5989 #[serde(default)]
5991 pub no_schema_binding: bool,
5992 #[serde(skip_serializing_if = "Option::is_none", default)]
5994 pub auto_refresh: Option<bool>,
5995 #[serde(default, skip_serializing_if = "Option::is_none")]
5997 pub on_cluster: Option<OnCluster>,
5998 #[serde(default, skip_serializing_if = "Option::is_none")]
6000 pub to_table: Option<TableRef>,
6001 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6003 pub table_properties: Vec<Expression>,
6004}
6005
6006impl CreateView {
6007 pub fn new(name: impl Into<String>, query: Expression) -> Self {
6008 Self {
6009 name: TableRef::new(name),
6010 columns: Vec::new(),
6011 query,
6012 or_replace: false,
6013 if_not_exists: false,
6014 materialized: false,
6015 temporary: false,
6016 secure: false,
6017 algorithm: None,
6018 definer: None,
6019 security: None,
6020 security_sql_style: true,
6021 query_parenthesized: false,
6022 locking_mode: None,
6023 locking_access: None,
6024 copy_grants: false,
6025 comment: None,
6026 tags: Vec::new(),
6027 options: Vec::new(),
6028 build: None,
6029 refresh: None,
6030 schema: None,
6031 unique_key: None,
6032 no_schema_binding: false,
6033 auto_refresh: None,
6034 on_cluster: None,
6035 to_table: None,
6036 table_properties: Vec::new(),
6037 }
6038 }
6039}
6040
6041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6043#[cfg_attr(feature = "bindings", derive(TS))]
6044pub struct DropView {
6045 pub name: TableRef,
6046 pub if_exists: bool,
6047 pub materialized: bool,
6048}
6049
6050impl DropView {
6051 pub fn new(name: impl Into<String>) -> Self {
6052 Self {
6053 name: TableRef::new(name),
6054 if_exists: false,
6055 materialized: false,
6056 }
6057 }
6058}
6059
6060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6062#[cfg_attr(feature = "bindings", derive(TS))]
6063pub struct Truncate {
6064 #[serde(default)]
6066 pub target: TruncateTarget,
6067 pub table: TableRef,
6068 #[serde(default, skip_serializing_if = "Option::is_none")]
6070 pub on_cluster: Option<OnCluster>,
6071 pub cascade: bool,
6072 #[serde(default)]
6074 pub extra_tables: Vec<TruncateTableEntry>,
6075 #[serde(default)]
6077 pub identity: Option<TruncateIdentity>,
6078 #[serde(default)]
6080 pub restrict: bool,
6081 #[serde(default, skip_serializing_if = "Option::is_none")]
6083 pub partition: Option<Box<Expression>>,
6084}
6085
6086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6088#[cfg_attr(feature = "bindings", derive(TS))]
6089pub struct TruncateTableEntry {
6090 pub table: TableRef,
6091 #[serde(default)]
6093 pub star: bool,
6094}
6095
6096#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6098#[cfg_attr(feature = "bindings", derive(TS))]
6099pub enum TruncateTarget {
6100 Table,
6101 Database,
6102}
6103
6104impl Default for TruncateTarget {
6105 fn default() -> Self {
6106 TruncateTarget::Table
6107 }
6108}
6109
6110#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6112#[cfg_attr(feature = "bindings", derive(TS))]
6113pub enum TruncateIdentity {
6114 Restart,
6115 Continue,
6116}
6117
6118impl Truncate {
6119 pub fn new(table: impl Into<String>) -> Self {
6120 Self {
6121 target: TruncateTarget::Table,
6122 table: TableRef::new(table),
6123 on_cluster: None,
6124 cascade: false,
6125 extra_tables: Vec::new(),
6126 identity: None,
6127 restrict: false,
6128 partition: None,
6129 }
6130 }
6131}
6132
6133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6135#[cfg_attr(feature = "bindings", derive(TS))]
6136pub struct Use {
6137 pub kind: Option<UseKind>,
6139 pub this: Identifier,
6141}
6142
6143#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6145#[cfg_attr(feature = "bindings", derive(TS))]
6146pub enum UseKind {
6147 Database,
6148 Schema,
6149 Role,
6150 Warehouse,
6151 Catalog,
6152 SecondaryRoles,
6154}
6155
6156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6158#[cfg_attr(feature = "bindings", derive(TS))]
6159pub struct SetStatement {
6160 pub items: Vec<SetItem>,
6162}
6163
6164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6166#[cfg_attr(feature = "bindings", derive(TS))]
6167pub struct SetItem {
6168 pub name: Expression,
6170 pub value: Expression,
6172 pub kind: Option<String>,
6174 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6176 pub no_equals: bool,
6177}
6178
6179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6181#[cfg_attr(feature = "bindings", derive(TS))]
6182pub struct Cache {
6183 pub table: Identifier,
6185 pub lazy: bool,
6187 pub options: Vec<(Expression, Expression)>,
6189 pub query: Option<Expression>,
6191}
6192
6193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6195#[cfg_attr(feature = "bindings", derive(TS))]
6196pub struct Uncache {
6197 pub table: Identifier,
6199 pub if_exists: bool,
6201}
6202
6203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6205#[cfg_attr(feature = "bindings", derive(TS))]
6206pub struct LoadData {
6207 pub local: bool,
6209 pub inpath: String,
6211 pub overwrite: bool,
6213 pub table: Expression,
6215 pub partition: Vec<(Identifier, Expression)>,
6217 pub input_format: Option<String>,
6219 pub serde: Option<String>,
6221}
6222
6223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6225#[cfg_attr(feature = "bindings", derive(TS))]
6226pub struct Pragma {
6227 pub schema: Option<Identifier>,
6229 pub name: Identifier,
6231 pub value: Option<Expression>,
6233 pub args: Vec<Expression>,
6235}
6236
6237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6240#[cfg_attr(feature = "bindings", derive(TS))]
6241pub struct Privilege {
6242 pub name: String,
6244 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6246 pub columns: Vec<String>,
6247}
6248
6249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6251#[cfg_attr(feature = "bindings", derive(TS))]
6252pub struct GrantPrincipal {
6253 pub name: Identifier,
6255 pub is_role: bool,
6257 #[serde(default)]
6259 pub is_group: bool,
6260}
6261
6262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6264#[cfg_attr(feature = "bindings", derive(TS))]
6265pub struct Grant {
6266 pub privileges: Vec<Privilege>,
6268 pub kind: Option<String>,
6270 pub securable: Identifier,
6272 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6274 pub function_params: Vec<String>,
6275 pub principals: Vec<GrantPrincipal>,
6277 pub grant_option: bool,
6279 #[serde(default, skip_serializing_if = "Option::is_none")]
6281 pub as_principal: Option<Identifier>,
6282}
6283
6284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6286#[cfg_attr(feature = "bindings", derive(TS))]
6287pub struct Revoke {
6288 pub privileges: Vec<Privilege>,
6290 pub kind: Option<String>,
6292 pub securable: Identifier,
6294 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6296 pub function_params: Vec<String>,
6297 pub principals: Vec<GrantPrincipal>,
6299 pub grant_option: bool,
6301 pub cascade: bool,
6303 #[serde(default)]
6305 pub restrict: bool,
6306}
6307
6308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6310#[cfg_attr(feature = "bindings", derive(TS))]
6311pub struct Comment {
6312 pub this: Expression,
6314 pub kind: String,
6316 pub expression: Expression,
6318 pub exists: bool,
6320 pub materialized: bool,
6322}
6323
6324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6330#[cfg_attr(feature = "bindings", derive(TS))]
6331pub struct AlterView {
6332 pub name: TableRef,
6333 pub actions: Vec<AlterViewAction>,
6334 #[serde(default, skip_serializing_if = "Option::is_none")]
6336 pub algorithm: Option<String>,
6337 #[serde(default, skip_serializing_if = "Option::is_none")]
6339 pub definer: Option<String>,
6340 #[serde(default, skip_serializing_if = "Option::is_none")]
6342 pub sql_security: Option<String>,
6343 #[serde(default, skip_serializing_if = "Option::is_none")]
6345 pub with_option: Option<String>,
6346 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6348 pub columns: Vec<ViewColumn>,
6349}
6350
6351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6353#[cfg_attr(feature = "bindings", derive(TS))]
6354pub enum AlterViewAction {
6355 Rename(TableRef),
6357 OwnerTo(Identifier),
6359 SetSchema(Identifier),
6361 SetAuthorization(String),
6363 AlterColumn {
6365 name: Identifier,
6366 action: AlterColumnAction,
6367 },
6368 AsSelect(Box<Expression>),
6370 SetTblproperties(Vec<(String, String)>),
6372 UnsetTblproperties(Vec<String>),
6374}
6375
6376impl AlterView {
6377 pub fn new(name: impl Into<String>) -> Self {
6378 Self {
6379 name: TableRef::new(name),
6380 actions: Vec::new(),
6381 algorithm: None,
6382 definer: None,
6383 sql_security: None,
6384 with_option: None,
6385 columns: Vec::new(),
6386 }
6387 }
6388}
6389
6390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6392#[cfg_attr(feature = "bindings", derive(TS))]
6393pub struct AlterIndex {
6394 pub name: Identifier,
6395 pub table: Option<TableRef>,
6396 pub actions: Vec<AlterIndexAction>,
6397}
6398
6399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6401#[cfg_attr(feature = "bindings", derive(TS))]
6402pub enum AlterIndexAction {
6403 Rename(Identifier),
6405 SetTablespace(Identifier),
6407 Visible(bool),
6409}
6410
6411impl AlterIndex {
6412 pub fn new(name: impl Into<String>) -> Self {
6413 Self {
6414 name: Identifier::new(name),
6415 table: None,
6416 actions: Vec::new(),
6417 }
6418 }
6419}
6420
6421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6423#[cfg_attr(feature = "bindings", derive(TS))]
6424pub struct CreateSchema {
6425 pub name: Identifier,
6426 pub if_not_exists: bool,
6427 pub authorization: Option<Identifier>,
6428 #[serde(default)]
6429 pub clone_from: Option<Identifier>,
6430 #[serde(default)]
6432 pub at_clause: Option<Expression>,
6433 #[serde(default)]
6435 pub properties: Vec<Expression>,
6436 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6438 pub leading_comments: Vec<String>,
6439}
6440
6441impl CreateSchema {
6442 pub fn new(name: impl Into<String>) -> Self {
6443 Self {
6444 name: Identifier::new(name),
6445 if_not_exists: false,
6446 authorization: None,
6447 clone_from: None,
6448 at_clause: None,
6449 properties: Vec::new(),
6450 leading_comments: Vec::new(),
6451 }
6452 }
6453}
6454
6455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6457#[cfg_attr(feature = "bindings", derive(TS))]
6458pub struct DropSchema {
6459 pub name: Identifier,
6460 pub if_exists: bool,
6461 pub cascade: bool,
6462}
6463
6464impl DropSchema {
6465 pub fn new(name: impl Into<String>) -> Self {
6466 Self {
6467 name: Identifier::new(name),
6468 if_exists: false,
6469 cascade: false,
6470 }
6471 }
6472}
6473
6474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6476#[cfg_attr(feature = "bindings", derive(TS))]
6477pub struct DropNamespace {
6478 pub name: Identifier,
6479 pub if_exists: bool,
6480 pub cascade: bool,
6481}
6482
6483impl DropNamespace {
6484 pub fn new(name: impl Into<String>) -> Self {
6485 Self {
6486 name: Identifier::new(name),
6487 if_exists: false,
6488 cascade: false,
6489 }
6490 }
6491}
6492
6493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6495#[cfg_attr(feature = "bindings", derive(TS))]
6496pub struct CreateDatabase {
6497 pub name: Identifier,
6498 pub if_not_exists: bool,
6499 pub options: Vec<DatabaseOption>,
6500 #[serde(default)]
6502 pub clone_from: Option<Identifier>,
6503 #[serde(default)]
6505 pub at_clause: Option<Expression>,
6506}
6507
6508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6510#[cfg_attr(feature = "bindings", derive(TS))]
6511pub enum DatabaseOption {
6512 CharacterSet(String),
6513 Collate(String),
6514 Owner(Identifier),
6515 Template(Identifier),
6516 Encoding(String),
6517 Location(String),
6518}
6519
6520impl CreateDatabase {
6521 pub fn new(name: impl Into<String>) -> Self {
6522 Self {
6523 name: Identifier::new(name),
6524 if_not_exists: false,
6525 options: Vec::new(),
6526 clone_from: None,
6527 at_clause: None,
6528 }
6529 }
6530}
6531
6532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6534#[cfg_attr(feature = "bindings", derive(TS))]
6535pub struct DropDatabase {
6536 pub name: Identifier,
6537 pub if_exists: bool,
6538}
6539
6540impl DropDatabase {
6541 pub fn new(name: impl Into<String>) -> Self {
6542 Self {
6543 name: Identifier::new(name),
6544 if_exists: false,
6545 }
6546 }
6547}
6548
6549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6551#[cfg_attr(feature = "bindings", derive(TS))]
6552pub struct CreateFunction {
6553 pub name: TableRef,
6554 pub parameters: Vec<FunctionParameter>,
6555 pub return_type: Option<DataType>,
6556 pub body: Option<FunctionBody>,
6557 pub or_replace: bool,
6558 pub if_not_exists: bool,
6559 pub temporary: bool,
6560 pub language: Option<String>,
6561 pub deterministic: Option<bool>,
6562 pub returns_null_on_null_input: Option<bool>,
6563 pub security: Option<FunctionSecurity>,
6564 #[serde(default = "default_true")]
6566 pub has_parens: bool,
6567 #[serde(default)]
6569 pub sql_data_access: Option<SqlDataAccess>,
6570 #[serde(default, skip_serializing_if = "Option::is_none")]
6572 pub returns_table_body: Option<String>,
6573 #[serde(default)]
6575 pub language_first: bool,
6576 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6578 pub set_options: Vec<FunctionSetOption>,
6579 #[serde(default)]
6581 pub strict: bool,
6582 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6584 pub options: Vec<Expression>,
6585 #[serde(default)]
6587 pub is_table_function: bool,
6588 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6590 pub property_order: Vec<FunctionPropertyKind>,
6591 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6593 pub environment: Vec<Expression>,
6594}
6595
6596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6598#[cfg_attr(feature = "bindings", derive(TS))]
6599pub struct FunctionSetOption {
6600 pub name: String,
6601 pub value: FunctionSetValue,
6602}
6603
6604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6606#[cfg_attr(feature = "bindings", derive(TS))]
6607pub enum FunctionSetValue {
6608 Value { value: String, use_to: bool },
6610 FromCurrent,
6612}
6613
6614#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6616#[cfg_attr(feature = "bindings", derive(TS))]
6617pub enum SqlDataAccess {
6618 NoSql,
6620 ContainsSql,
6622 ReadsSqlData,
6624 ModifiesSqlData,
6626}
6627
6628#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6630#[cfg_attr(feature = "bindings", derive(TS))]
6631pub enum FunctionPropertyKind {
6632 Set,
6634 As,
6636 Language,
6638 Determinism,
6640 NullInput,
6642 Security,
6644 SqlDataAccess,
6646 Options,
6648 Environment,
6650}
6651
6652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6654#[cfg_attr(feature = "bindings", derive(TS))]
6655pub struct FunctionParameter {
6656 pub name: Option<Identifier>,
6657 pub data_type: DataType,
6658 pub mode: Option<ParameterMode>,
6659 pub default: Option<Expression>,
6660}
6661
6662#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6664#[cfg_attr(feature = "bindings", derive(TS))]
6665pub enum ParameterMode {
6666 In,
6667 Out,
6668 InOut,
6669}
6670
6671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6673#[cfg_attr(feature = "bindings", derive(TS))]
6674pub enum FunctionBody {
6675 Block(String),
6677 StringLiteral(String),
6679 Expression(Expression),
6681 External(String),
6683 Return(Expression),
6685 Statements(Vec<Expression>),
6687 DollarQuoted {
6690 content: String,
6691 tag: Option<String>,
6692 },
6693}
6694
6695#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6697#[cfg_attr(feature = "bindings", derive(TS))]
6698pub enum FunctionSecurity {
6699 Definer,
6700 Invoker,
6701 None,
6703}
6704
6705impl CreateFunction {
6706 pub fn new(name: impl Into<String>) -> Self {
6707 Self {
6708 name: TableRef::new(name),
6709 parameters: Vec::new(),
6710 return_type: None,
6711 body: None,
6712 or_replace: false,
6713 if_not_exists: false,
6714 temporary: false,
6715 language: None,
6716 deterministic: None,
6717 returns_null_on_null_input: None,
6718 security: None,
6719 has_parens: true,
6720 sql_data_access: None,
6721 returns_table_body: None,
6722 language_first: false,
6723 set_options: Vec::new(),
6724 strict: false,
6725 options: Vec::new(),
6726 is_table_function: false,
6727 property_order: Vec::new(),
6728 environment: Vec::new(),
6729 }
6730 }
6731}
6732
6733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6735#[cfg_attr(feature = "bindings", derive(TS))]
6736pub struct DropFunction {
6737 pub name: TableRef,
6738 pub parameters: Option<Vec<DataType>>,
6739 pub if_exists: bool,
6740 pub cascade: bool,
6741}
6742
6743impl DropFunction {
6744 pub fn new(name: impl Into<String>) -> Self {
6745 Self {
6746 name: TableRef::new(name),
6747 parameters: None,
6748 if_exists: false,
6749 cascade: false,
6750 }
6751 }
6752}
6753
6754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6756#[cfg_attr(feature = "bindings", derive(TS))]
6757pub struct CreateProcedure {
6758 pub name: TableRef,
6759 pub parameters: Vec<FunctionParameter>,
6760 pub body: Option<FunctionBody>,
6761 pub or_replace: bool,
6762 pub if_not_exists: bool,
6763 pub language: Option<String>,
6764 pub security: Option<FunctionSecurity>,
6765 #[serde(default)]
6767 pub return_type: Option<DataType>,
6768 #[serde(default)]
6770 pub execute_as: Option<String>,
6771 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6773 pub with_options: Vec<String>,
6774 #[serde(default = "default_true", skip_serializing_if = "is_true")]
6776 pub has_parens: bool,
6777 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6779 pub use_proc_keyword: bool,
6780}
6781
6782impl CreateProcedure {
6783 pub fn new(name: impl Into<String>) -> Self {
6784 Self {
6785 name: TableRef::new(name),
6786 parameters: Vec::new(),
6787 body: None,
6788 or_replace: false,
6789 if_not_exists: false,
6790 language: None,
6791 security: None,
6792 return_type: None,
6793 execute_as: None,
6794 with_options: Vec::new(),
6795 has_parens: true,
6796 use_proc_keyword: false,
6797 }
6798 }
6799}
6800
6801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6803#[cfg_attr(feature = "bindings", derive(TS))]
6804pub struct DropProcedure {
6805 pub name: TableRef,
6806 pub parameters: Option<Vec<DataType>>,
6807 pub if_exists: bool,
6808 pub cascade: bool,
6809}
6810
6811impl DropProcedure {
6812 pub fn new(name: impl Into<String>) -> Self {
6813 Self {
6814 name: TableRef::new(name),
6815 parameters: None,
6816 if_exists: false,
6817 cascade: false,
6818 }
6819 }
6820}
6821
6822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6824#[cfg_attr(feature = "bindings", derive(TS))]
6825pub enum SeqPropKind {
6826 Start,
6827 Increment,
6828 Minvalue,
6829 Maxvalue,
6830 Cache,
6831 Cycle,
6832 NoCycle,
6833 OwnedBy,
6834 Order,
6835 NoOrder,
6836 Comment,
6837}
6838
6839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6841#[cfg_attr(feature = "bindings", derive(TS))]
6842pub struct CreateSequence {
6843 pub name: TableRef,
6844 pub if_not_exists: bool,
6845 pub temporary: bool,
6846 pub increment: Option<i64>,
6847 pub minvalue: Option<SequenceBound>,
6848 pub maxvalue: Option<SequenceBound>,
6849 pub start: Option<i64>,
6850 pub cache: Option<i64>,
6851 pub cycle: bool,
6852 pub owned_by: Option<TableRef>,
6853 #[serde(default)]
6855 pub order: Option<bool>,
6856 #[serde(default)]
6858 pub comment: Option<String>,
6859 #[serde(default)]
6861 pub property_order: Vec<SeqPropKind>,
6862}
6863
6864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6866#[cfg_attr(feature = "bindings", derive(TS))]
6867pub enum SequenceBound {
6868 Value(i64),
6869 None,
6870}
6871
6872impl CreateSequence {
6873 pub fn new(name: impl Into<String>) -> Self {
6874 Self {
6875 name: TableRef::new(name),
6876 if_not_exists: false,
6877 temporary: false,
6878 increment: None,
6879 minvalue: None,
6880 maxvalue: None,
6881 start: None,
6882 cache: None,
6883 cycle: false,
6884 owned_by: None,
6885 order: None,
6886 comment: None,
6887 property_order: Vec::new(),
6888 }
6889 }
6890}
6891
6892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6894#[cfg_attr(feature = "bindings", derive(TS))]
6895pub struct DropSequence {
6896 pub name: TableRef,
6897 pub if_exists: bool,
6898 pub cascade: bool,
6899}
6900
6901impl DropSequence {
6902 pub fn new(name: impl Into<String>) -> Self {
6903 Self {
6904 name: TableRef::new(name),
6905 if_exists: false,
6906 cascade: false,
6907 }
6908 }
6909}
6910
6911#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6913#[cfg_attr(feature = "bindings", derive(TS))]
6914pub struct AlterSequence {
6915 pub name: TableRef,
6916 pub if_exists: bool,
6917 pub increment: Option<i64>,
6918 pub minvalue: Option<SequenceBound>,
6919 pub maxvalue: Option<SequenceBound>,
6920 pub start: Option<i64>,
6921 pub restart: Option<Option<i64>>,
6922 pub cache: Option<i64>,
6923 pub cycle: Option<bool>,
6924 pub owned_by: Option<Option<TableRef>>,
6925}
6926
6927impl AlterSequence {
6928 pub fn new(name: impl Into<String>) -> Self {
6929 Self {
6930 name: TableRef::new(name),
6931 if_exists: false,
6932 increment: None,
6933 minvalue: None,
6934 maxvalue: None,
6935 start: None,
6936 restart: None,
6937 cache: None,
6938 cycle: None,
6939 owned_by: None,
6940 }
6941 }
6942}
6943
6944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6946#[cfg_attr(feature = "bindings", derive(TS))]
6947pub struct CreateTrigger {
6948 pub name: Identifier,
6949 pub table: TableRef,
6950 pub timing: TriggerTiming,
6951 pub events: Vec<TriggerEvent>,
6952 pub for_each: TriggerForEach,
6953 pub when: Option<Expression>,
6954 pub body: TriggerBody,
6955 pub or_replace: bool,
6956 pub constraint: bool,
6957 pub deferrable: Option<bool>,
6958 pub initially_deferred: Option<bool>,
6959 pub referencing: Option<TriggerReferencing>,
6960}
6961
6962#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6964#[cfg_attr(feature = "bindings", derive(TS))]
6965pub enum TriggerTiming {
6966 Before,
6967 After,
6968 InsteadOf,
6969}
6970
6971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6973#[cfg_attr(feature = "bindings", derive(TS))]
6974pub enum TriggerEvent {
6975 Insert,
6976 Update(Option<Vec<Identifier>>),
6977 Delete,
6978 Truncate,
6979}
6980
6981#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6983#[cfg_attr(feature = "bindings", derive(TS))]
6984pub enum TriggerForEach {
6985 Row,
6986 Statement,
6987}
6988
6989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6991#[cfg_attr(feature = "bindings", derive(TS))]
6992pub enum TriggerBody {
6993 Execute {
6995 function: TableRef,
6996 args: Vec<Expression>,
6997 },
6998 Block(String),
7000}
7001
7002#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7004#[cfg_attr(feature = "bindings", derive(TS))]
7005pub struct TriggerReferencing {
7006 pub old_table: Option<Identifier>,
7007 pub new_table: Option<Identifier>,
7008 pub old_row: Option<Identifier>,
7009 pub new_row: Option<Identifier>,
7010}
7011
7012impl CreateTrigger {
7013 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
7014 Self {
7015 name: Identifier::new(name),
7016 table: TableRef::new(table),
7017 timing: TriggerTiming::Before,
7018 events: Vec::new(),
7019 for_each: TriggerForEach::Row,
7020 when: None,
7021 body: TriggerBody::Execute {
7022 function: TableRef::new(""),
7023 args: Vec::new(),
7024 },
7025 or_replace: false,
7026 constraint: false,
7027 deferrable: None,
7028 initially_deferred: None,
7029 referencing: None,
7030 }
7031 }
7032}
7033
7034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7036#[cfg_attr(feature = "bindings", derive(TS))]
7037pub struct DropTrigger {
7038 pub name: Identifier,
7039 pub table: Option<TableRef>,
7040 pub if_exists: bool,
7041 pub cascade: bool,
7042}
7043
7044impl DropTrigger {
7045 pub fn new(name: impl Into<String>) -> Self {
7046 Self {
7047 name: Identifier::new(name),
7048 table: None,
7049 if_exists: false,
7050 cascade: false,
7051 }
7052 }
7053}
7054
7055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7057#[cfg_attr(feature = "bindings", derive(TS))]
7058pub struct CreateType {
7059 pub name: TableRef,
7060 pub definition: TypeDefinition,
7061 pub if_not_exists: bool,
7062}
7063
7064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7066#[cfg_attr(feature = "bindings", derive(TS))]
7067pub enum TypeDefinition {
7068 Enum(Vec<String>),
7070 Composite(Vec<TypeAttribute>),
7072 Range {
7074 subtype: DataType,
7075 subtype_diff: Option<String>,
7076 canonical: Option<String>,
7077 },
7078 Base {
7080 input: String,
7081 output: String,
7082 internallength: Option<i32>,
7083 },
7084 Domain {
7086 base_type: DataType,
7087 default: Option<Expression>,
7088 constraints: Vec<DomainConstraint>,
7089 },
7090}
7091
7092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7094#[cfg_attr(feature = "bindings", derive(TS))]
7095pub struct TypeAttribute {
7096 pub name: Identifier,
7097 pub data_type: DataType,
7098 pub collate: Option<Identifier>,
7099}
7100
7101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7103#[cfg_attr(feature = "bindings", derive(TS))]
7104pub struct DomainConstraint {
7105 pub name: Option<Identifier>,
7106 pub check: Expression,
7107}
7108
7109impl CreateType {
7110 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
7111 Self {
7112 name: TableRef::new(name),
7113 definition: TypeDefinition::Enum(values),
7114 if_not_exists: false,
7115 }
7116 }
7117
7118 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
7119 Self {
7120 name: TableRef::new(name),
7121 definition: TypeDefinition::Composite(attributes),
7122 if_not_exists: false,
7123 }
7124 }
7125}
7126
7127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7129#[cfg_attr(feature = "bindings", derive(TS))]
7130pub struct DropType {
7131 pub name: TableRef,
7132 pub if_exists: bool,
7133 pub cascade: bool,
7134}
7135
7136impl DropType {
7137 pub fn new(name: impl Into<String>) -> Self {
7138 Self {
7139 name: TableRef::new(name),
7140 if_exists: false,
7141 cascade: false,
7142 }
7143 }
7144}
7145
7146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7148#[cfg_attr(feature = "bindings", derive(TS))]
7149pub struct Describe {
7150 pub target: Expression,
7152 pub extended: bool,
7154 pub formatted: bool,
7156 #[serde(default)]
7158 pub kind: Option<String>,
7159 #[serde(default)]
7161 pub properties: Vec<(String, String)>,
7162 #[serde(default, skip_serializing_if = "Option::is_none")]
7164 pub style: Option<String>,
7165 #[serde(default)]
7167 pub partition: Option<Box<Expression>>,
7168 #[serde(default)]
7170 pub leading_comments: Vec<String>,
7171}
7172
7173impl Describe {
7174 pub fn new(target: Expression) -> Self {
7175 Self {
7176 target,
7177 extended: false,
7178 formatted: false,
7179 kind: None,
7180 properties: Vec::new(),
7181 style: None,
7182 partition: None,
7183 leading_comments: Vec::new(),
7184 }
7185 }
7186}
7187
7188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7190#[cfg_attr(feature = "bindings", derive(TS))]
7191pub struct Show {
7192 pub this: String,
7194 #[serde(default)]
7196 pub terse: bool,
7197 #[serde(default)]
7199 pub history: bool,
7200 pub like: Option<Expression>,
7202 pub scope_kind: Option<String>,
7204 pub scope: Option<Expression>,
7206 pub starts_with: Option<Expression>,
7208 pub limit: Option<Box<Limit>>,
7210 pub from: Option<Expression>,
7212 #[serde(default, skip_serializing_if = "Option::is_none")]
7214 pub where_clause: Option<Expression>,
7215 #[serde(default, skip_serializing_if = "Option::is_none")]
7217 pub for_target: Option<Expression>,
7218 #[serde(default, skip_serializing_if = "Option::is_none")]
7220 pub db: Option<Expression>,
7221 #[serde(default, skip_serializing_if = "Option::is_none")]
7223 pub target: Option<Expression>,
7224 #[serde(default, skip_serializing_if = "Option::is_none")]
7226 pub mutex: Option<bool>,
7227 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7229 pub privileges: Vec<String>,
7230}
7231
7232impl Show {
7233 pub fn new(this: impl Into<String>) -> Self {
7234 Self {
7235 this: this.into(),
7236 terse: false,
7237 history: false,
7238 like: None,
7239 scope_kind: None,
7240 scope: None,
7241 starts_with: None,
7242 limit: None,
7243 from: None,
7244 where_clause: None,
7245 for_target: None,
7246 db: None,
7247 target: None,
7248 mutex: None,
7249 privileges: Vec::new(),
7250 }
7251 }
7252}
7253
7254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7259#[cfg_attr(feature = "bindings", derive(TS))]
7260pub struct Paren {
7261 pub this: Expression,
7263 #[serde(default)]
7264 pub trailing_comments: Vec<String>,
7265}
7266
7267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7269#[cfg_attr(feature = "bindings", derive(TS))]
7270pub struct Annotated {
7271 pub this: Expression,
7272 pub trailing_comments: Vec<String>,
7273}
7274
7275
7276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7281#[cfg_attr(feature = "bindings", derive(TS))]
7282pub struct Refresh {
7283 pub this: Box<Expression>,
7284 pub kind: String,
7285}
7286
7287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7289#[cfg_attr(feature = "bindings", derive(TS))]
7290pub struct LockingStatement {
7291 pub this: Box<Expression>,
7292 pub expression: Box<Expression>,
7293}
7294
7295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7297#[cfg_attr(feature = "bindings", derive(TS))]
7298pub struct SequenceProperties {
7299 #[serde(default)]
7300 pub increment: Option<Box<Expression>>,
7301 #[serde(default)]
7302 pub minvalue: Option<Box<Expression>>,
7303 #[serde(default)]
7304 pub maxvalue: Option<Box<Expression>>,
7305 #[serde(default)]
7306 pub cache: Option<Box<Expression>>,
7307 #[serde(default)]
7308 pub start: Option<Box<Expression>>,
7309 #[serde(default)]
7310 pub owned: Option<Box<Expression>>,
7311 #[serde(default)]
7312 pub options: Vec<Expression>,
7313}
7314
7315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7317#[cfg_attr(feature = "bindings", derive(TS))]
7318pub struct TruncateTable {
7319 #[serde(default)]
7320 pub expressions: Vec<Expression>,
7321 #[serde(default)]
7322 pub is_database: Option<Box<Expression>>,
7323 #[serde(default)]
7324 pub exists: bool,
7325 #[serde(default)]
7326 pub only: Option<Box<Expression>>,
7327 #[serde(default)]
7328 pub cluster: Option<Box<Expression>>,
7329 #[serde(default)]
7330 pub identity: Option<Box<Expression>>,
7331 #[serde(default)]
7332 pub option: Option<Box<Expression>>,
7333 #[serde(default)]
7334 pub partition: Option<Box<Expression>>,
7335}
7336
7337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7339#[cfg_attr(feature = "bindings", derive(TS))]
7340pub struct Clone {
7341 pub this: Box<Expression>,
7342 #[serde(default)]
7343 pub shallow: Option<Box<Expression>>,
7344 #[serde(default)]
7345 pub copy: Option<Box<Expression>>,
7346}
7347
7348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7350#[cfg_attr(feature = "bindings", derive(TS))]
7351pub struct Attach {
7352 pub this: Box<Expression>,
7353 #[serde(default)]
7354 pub exists: bool,
7355 #[serde(default)]
7356 pub expressions: Vec<Expression>,
7357}
7358
7359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7361#[cfg_attr(feature = "bindings", derive(TS))]
7362pub struct Detach {
7363 pub this: Box<Expression>,
7364 #[serde(default)]
7365 pub exists: bool,
7366}
7367
7368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7370#[cfg_attr(feature = "bindings", derive(TS))]
7371pub struct Install {
7372 pub this: Box<Expression>,
7373 #[serde(default)]
7374 pub from_: Option<Box<Expression>>,
7375 #[serde(default)]
7376 pub force: Option<Box<Expression>>,
7377}
7378
7379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7381#[cfg_attr(feature = "bindings", derive(TS))]
7382pub struct Summarize {
7383 pub this: Box<Expression>,
7384 #[serde(default)]
7385 pub table: Option<Box<Expression>>,
7386}
7387
7388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7390#[cfg_attr(feature = "bindings", derive(TS))]
7391pub struct Declare {
7392 #[serde(default)]
7393 pub expressions: Vec<Expression>,
7394}
7395
7396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7398#[cfg_attr(feature = "bindings", derive(TS))]
7399pub struct DeclareItem {
7400 pub this: Box<Expression>,
7401 #[serde(default)]
7402 pub kind: Option<String>,
7403 #[serde(default)]
7404 pub default: Option<Box<Expression>>,
7405 #[serde(default)]
7406 pub has_as: bool,
7407 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7409 pub additional_names: Vec<Expression>,
7410}
7411
7412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7414#[cfg_attr(feature = "bindings", derive(TS))]
7415pub struct Set {
7416 #[serde(default)]
7417 pub expressions: Vec<Expression>,
7418 #[serde(default)]
7419 pub unset: Option<Box<Expression>>,
7420 #[serde(default)]
7421 pub tag: Option<Box<Expression>>,
7422}
7423
7424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7426#[cfg_attr(feature = "bindings", derive(TS))]
7427pub struct Heredoc {
7428 pub this: Box<Expression>,
7429 #[serde(default)]
7430 pub tag: Option<Box<Expression>>,
7431}
7432
7433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7435#[cfg_attr(feature = "bindings", derive(TS))]
7436pub struct QueryBand {
7437 pub this: Box<Expression>,
7438 #[serde(default)]
7439 pub scope: Option<Box<Expression>>,
7440 #[serde(default)]
7441 pub update: Option<Box<Expression>>,
7442}
7443
7444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7446#[cfg_attr(feature = "bindings", derive(TS))]
7447pub struct UserDefinedFunction {
7448 pub this: Box<Expression>,
7449 #[serde(default)]
7450 pub expressions: Vec<Expression>,
7451 #[serde(default)]
7452 pub wrapped: Option<Box<Expression>>,
7453}
7454
7455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7457#[cfg_attr(feature = "bindings", derive(TS))]
7458pub struct RecursiveWithSearch {
7459 pub kind: String,
7460 pub this: Box<Expression>,
7461 pub expression: Box<Expression>,
7462 #[serde(default)]
7463 pub using: Option<Box<Expression>>,
7464}
7465
7466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7468#[cfg_attr(feature = "bindings", derive(TS))]
7469pub struct ProjectionDef {
7470 pub this: Box<Expression>,
7471 pub expression: Box<Expression>,
7472}
7473
7474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7476#[cfg_attr(feature = "bindings", derive(TS))]
7477pub struct TableAlias {
7478 #[serde(default)]
7479 pub this: Option<Box<Expression>>,
7480 #[serde(default)]
7481 pub columns: Vec<Expression>,
7482}
7483
7484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7486#[cfg_attr(feature = "bindings", derive(TS))]
7487pub struct ByteString {
7488 pub this: Box<Expression>,
7489 #[serde(default)]
7490 pub is_bytes: Option<Box<Expression>>,
7491}
7492
7493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7496#[cfg_attr(feature = "bindings", derive(TS))]
7497pub struct HexStringExpr {
7498 pub this: Box<Expression>,
7499 #[serde(default)]
7500 pub is_integer: Option<bool>,
7501}
7502
7503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7505#[cfg_attr(feature = "bindings", derive(TS))]
7506pub struct UnicodeString {
7507 pub this: Box<Expression>,
7508 #[serde(default)]
7509 pub escape: Option<Box<Expression>>,
7510}
7511
7512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7514#[cfg_attr(feature = "bindings", derive(TS))]
7515pub struct AlterColumn {
7516 pub this: Box<Expression>,
7517 #[serde(default)]
7518 pub dtype: Option<Box<Expression>>,
7519 #[serde(default)]
7520 pub collate: Option<Box<Expression>>,
7521 #[serde(default)]
7522 pub using: Option<Box<Expression>>,
7523 #[serde(default)]
7524 pub default: Option<Box<Expression>>,
7525 #[serde(default)]
7526 pub drop: Option<Box<Expression>>,
7527 #[serde(default)]
7528 pub comment: Option<Box<Expression>>,
7529 #[serde(default)]
7530 pub allow_null: Option<Box<Expression>>,
7531 #[serde(default)]
7532 pub visible: Option<Box<Expression>>,
7533 #[serde(default)]
7534 pub rename_to: Option<Box<Expression>>,
7535}
7536
7537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7539#[cfg_attr(feature = "bindings", derive(TS))]
7540pub struct AlterSortKey {
7541 #[serde(default)]
7542 pub this: Option<Box<Expression>>,
7543 #[serde(default)]
7544 pub expressions: Vec<Expression>,
7545 #[serde(default)]
7546 pub compound: Option<Box<Expression>>,
7547}
7548
7549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7551#[cfg_attr(feature = "bindings", derive(TS))]
7552pub struct AlterSet {
7553 #[serde(default)]
7554 pub expressions: Vec<Expression>,
7555 #[serde(default)]
7556 pub option: Option<Box<Expression>>,
7557 #[serde(default)]
7558 pub tablespace: Option<Box<Expression>>,
7559 #[serde(default)]
7560 pub access_method: Option<Box<Expression>>,
7561 #[serde(default)]
7562 pub file_format: Option<Box<Expression>>,
7563 #[serde(default)]
7564 pub copy_options: Option<Box<Expression>>,
7565 #[serde(default)]
7566 pub tag: Option<Box<Expression>>,
7567 #[serde(default)]
7568 pub location: Option<Box<Expression>>,
7569 #[serde(default)]
7570 pub serde: Option<Box<Expression>>,
7571}
7572
7573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7575#[cfg_attr(feature = "bindings", derive(TS))]
7576pub struct RenameColumn {
7577 pub this: Box<Expression>,
7578 #[serde(default)]
7579 pub to: Option<Box<Expression>>,
7580 #[serde(default)]
7581 pub exists: bool,
7582}
7583
7584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7586#[cfg_attr(feature = "bindings", derive(TS))]
7587pub struct Comprehension {
7588 pub this: Box<Expression>,
7589 pub expression: Box<Expression>,
7590 #[serde(default)]
7591 pub position: Option<Box<Expression>>,
7592 #[serde(default)]
7593 pub iterator: Option<Box<Expression>>,
7594 #[serde(default)]
7595 pub condition: Option<Box<Expression>>,
7596}
7597
7598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7600#[cfg_attr(feature = "bindings", derive(TS))]
7601pub struct MergeTreeTTLAction {
7602 pub this: Box<Expression>,
7603 #[serde(default)]
7604 pub delete: Option<Box<Expression>>,
7605 #[serde(default)]
7606 pub recompress: Option<Box<Expression>>,
7607 #[serde(default)]
7608 pub to_disk: Option<Box<Expression>>,
7609 #[serde(default)]
7610 pub to_volume: Option<Box<Expression>>,
7611}
7612
7613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7615#[cfg_attr(feature = "bindings", derive(TS))]
7616pub struct MergeTreeTTL {
7617 #[serde(default)]
7618 pub expressions: Vec<Expression>,
7619 #[serde(default)]
7620 pub where_: Option<Box<Expression>>,
7621 #[serde(default)]
7622 pub group: Option<Box<Expression>>,
7623 #[serde(default)]
7624 pub aggregates: Option<Box<Expression>>,
7625}
7626
7627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7629#[cfg_attr(feature = "bindings", derive(TS))]
7630pub struct IndexConstraintOption {
7631 #[serde(default)]
7632 pub key_block_size: Option<Box<Expression>>,
7633 #[serde(default)]
7634 pub using: Option<Box<Expression>>,
7635 #[serde(default)]
7636 pub parser: Option<Box<Expression>>,
7637 #[serde(default)]
7638 pub comment: Option<Box<Expression>>,
7639 #[serde(default)]
7640 pub visible: Option<Box<Expression>>,
7641 #[serde(default)]
7642 pub engine_attr: Option<Box<Expression>>,
7643 #[serde(default)]
7644 pub secondary_engine_attr: Option<Box<Expression>>,
7645}
7646
7647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7649#[cfg_attr(feature = "bindings", derive(TS))]
7650pub struct PeriodForSystemTimeConstraint {
7651 pub this: Box<Expression>,
7652 pub expression: Box<Expression>,
7653}
7654
7655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7657#[cfg_attr(feature = "bindings", derive(TS))]
7658pub struct CaseSpecificColumnConstraint {
7659 #[serde(default)]
7660 pub not_: Option<Box<Expression>>,
7661}
7662
7663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7665#[cfg_attr(feature = "bindings", derive(TS))]
7666pub struct CharacterSetColumnConstraint {
7667 pub this: Box<Expression>,
7668}
7669
7670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7672#[cfg_attr(feature = "bindings", derive(TS))]
7673pub struct CheckColumnConstraint {
7674 pub this: Box<Expression>,
7675 #[serde(default)]
7676 pub enforced: Option<Box<Expression>>,
7677}
7678
7679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7681#[cfg_attr(feature = "bindings", derive(TS))]
7682pub struct CompressColumnConstraint {
7683 #[serde(default)]
7684 pub this: Option<Box<Expression>>,
7685}
7686
7687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7689#[cfg_attr(feature = "bindings", derive(TS))]
7690pub struct DateFormatColumnConstraint {
7691 pub this: Box<Expression>,
7692}
7693
7694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7696#[cfg_attr(feature = "bindings", derive(TS))]
7697pub struct EphemeralColumnConstraint {
7698 #[serde(default)]
7699 pub this: Option<Box<Expression>>,
7700}
7701
7702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7704#[cfg_attr(feature = "bindings", derive(TS))]
7705pub struct WithOperator {
7706 pub this: Box<Expression>,
7707 pub op: String,
7708}
7709
7710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7712#[cfg_attr(feature = "bindings", derive(TS))]
7713pub struct GeneratedAsIdentityColumnConstraint {
7714 #[serde(default)]
7715 pub this: Option<Box<Expression>>,
7716 #[serde(default)]
7717 pub expression: Option<Box<Expression>>,
7718 #[serde(default)]
7719 pub on_null: Option<Box<Expression>>,
7720 #[serde(default)]
7721 pub start: Option<Box<Expression>>,
7722 #[serde(default)]
7723 pub increment: Option<Box<Expression>>,
7724 #[serde(default)]
7725 pub minvalue: Option<Box<Expression>>,
7726 #[serde(default)]
7727 pub maxvalue: Option<Box<Expression>>,
7728 #[serde(default)]
7729 pub cycle: Option<Box<Expression>>,
7730 #[serde(default)]
7731 pub order: Option<Box<Expression>>,
7732}
7733
7734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7737#[cfg_attr(feature = "bindings", derive(TS))]
7738pub struct AutoIncrementColumnConstraint;
7739
7740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7742#[cfg_attr(feature = "bindings", derive(TS))]
7743pub struct CommentColumnConstraint;
7744
7745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7747#[cfg_attr(feature = "bindings", derive(TS))]
7748pub struct GeneratedAsRowColumnConstraint {
7749 #[serde(default)]
7750 pub start: Option<Box<Expression>>,
7751 #[serde(default)]
7752 pub hidden: Option<Box<Expression>>,
7753}
7754
7755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7757#[cfg_attr(feature = "bindings", derive(TS))]
7758pub struct IndexColumnConstraint {
7759 #[serde(default)]
7760 pub this: Option<Box<Expression>>,
7761 #[serde(default)]
7762 pub expressions: Vec<Expression>,
7763 #[serde(default)]
7764 pub kind: Option<String>,
7765 #[serde(default)]
7766 pub index_type: Option<Box<Expression>>,
7767 #[serde(default)]
7768 pub options: Vec<Expression>,
7769 #[serde(default)]
7770 pub expression: Option<Box<Expression>>,
7771 #[serde(default)]
7772 pub granularity: Option<Box<Expression>>,
7773}
7774
7775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7777#[cfg_attr(feature = "bindings", derive(TS))]
7778pub struct MaskingPolicyColumnConstraint {
7779 pub this: Box<Expression>,
7780 #[serde(default)]
7781 pub expressions: Vec<Expression>,
7782}
7783
7784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7786#[cfg_attr(feature = "bindings", derive(TS))]
7787pub struct NotNullColumnConstraint {
7788 #[serde(default)]
7789 pub allow_null: Option<Box<Expression>>,
7790}
7791
7792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7794#[cfg_attr(feature = "bindings", derive(TS))]
7795pub struct DefaultColumnConstraint {
7796 pub this: Box<Expression>,
7797}
7798
7799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7801#[cfg_attr(feature = "bindings", derive(TS))]
7802pub struct PrimaryKeyColumnConstraint {
7803 #[serde(default)]
7804 pub desc: Option<Box<Expression>>,
7805 #[serde(default)]
7806 pub options: Vec<Expression>,
7807}
7808
7809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7811#[cfg_attr(feature = "bindings", derive(TS))]
7812pub struct UniqueColumnConstraint {
7813 #[serde(default)]
7814 pub this: Option<Box<Expression>>,
7815 #[serde(default)]
7816 pub index_type: Option<Box<Expression>>,
7817 #[serde(default)]
7818 pub on_conflict: Option<Box<Expression>>,
7819 #[serde(default)]
7820 pub nulls: Option<Box<Expression>>,
7821 #[serde(default)]
7822 pub options: Vec<Expression>,
7823}
7824
7825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7827#[cfg_attr(feature = "bindings", derive(TS))]
7828pub struct WatermarkColumnConstraint {
7829 pub this: Box<Expression>,
7830 pub expression: Box<Expression>,
7831}
7832
7833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7835#[cfg_attr(feature = "bindings", derive(TS))]
7836pub struct ComputedColumnConstraint {
7837 pub this: Box<Expression>,
7838 #[serde(default)]
7839 pub persisted: Option<Box<Expression>>,
7840 #[serde(default)]
7841 pub not_null: Option<Box<Expression>>,
7842 #[serde(default)]
7843 pub data_type: Option<Box<Expression>>,
7844}
7845
7846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7848#[cfg_attr(feature = "bindings", derive(TS))]
7849pub struct InOutColumnConstraint {
7850 #[serde(default)]
7851 pub input_: Option<Box<Expression>>,
7852 #[serde(default)]
7853 pub output: Option<Box<Expression>>,
7854}
7855
7856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7858#[cfg_attr(feature = "bindings", derive(TS))]
7859pub struct PathColumnConstraint {
7860 pub this: Box<Expression>,
7861}
7862
7863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7865#[cfg_attr(feature = "bindings", derive(TS))]
7866pub struct Constraint {
7867 pub this: Box<Expression>,
7868 #[serde(default)]
7869 pub expressions: Vec<Expression>,
7870}
7871
7872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7874#[cfg_attr(feature = "bindings", derive(TS))]
7875pub struct Export {
7876 pub this: Box<Expression>,
7877 #[serde(default)]
7878 pub connection: Option<Box<Expression>>,
7879 #[serde(default)]
7880 pub options: Vec<Expression>,
7881}
7882
7883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7885#[cfg_attr(feature = "bindings", derive(TS))]
7886pub struct Filter {
7887 pub this: Box<Expression>,
7888 pub expression: Box<Expression>,
7889}
7890
7891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7893#[cfg_attr(feature = "bindings", derive(TS))]
7894pub struct Changes {
7895 #[serde(default)]
7896 pub information: Option<Box<Expression>>,
7897 #[serde(default)]
7898 pub at_before: Option<Box<Expression>>,
7899 #[serde(default)]
7900 pub end: Option<Box<Expression>>,
7901}
7902
7903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7905#[cfg_attr(feature = "bindings", derive(TS))]
7906pub struct Directory {
7907 pub this: Box<Expression>,
7908 #[serde(default)]
7909 pub local: Option<Box<Expression>>,
7910 #[serde(default)]
7911 pub row_format: Option<Box<Expression>>,
7912}
7913
7914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7916#[cfg_attr(feature = "bindings", derive(TS))]
7917pub struct ForeignKey {
7918 #[serde(default)]
7919 pub expressions: Vec<Expression>,
7920 #[serde(default)]
7921 pub reference: Option<Box<Expression>>,
7922 #[serde(default)]
7923 pub delete: Option<Box<Expression>>,
7924 #[serde(default)]
7925 pub update: Option<Box<Expression>>,
7926 #[serde(default)]
7927 pub options: Vec<Expression>,
7928}
7929
7930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7932#[cfg_attr(feature = "bindings", derive(TS))]
7933pub struct ColumnPrefix {
7934 pub this: Box<Expression>,
7935 pub expression: Box<Expression>,
7936}
7937
7938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7940#[cfg_attr(feature = "bindings", derive(TS))]
7941pub struct PrimaryKey {
7942 #[serde(default)]
7943 pub this: Option<Box<Expression>>,
7944 #[serde(default)]
7945 pub expressions: Vec<Expression>,
7946 #[serde(default)]
7947 pub options: Vec<Expression>,
7948 #[serde(default)]
7949 pub include: Option<Box<Expression>>,
7950}
7951
7952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7954#[cfg_attr(feature = "bindings", derive(TS))]
7955pub struct IntoClause {
7956 #[serde(default)]
7957 pub this: Option<Box<Expression>>,
7958 #[serde(default)]
7959 pub temporary: bool,
7960 #[serde(default)]
7961 pub unlogged: Option<Box<Expression>>,
7962 #[serde(default)]
7963 pub bulk_collect: Option<Box<Expression>>,
7964 #[serde(default)]
7965 pub expressions: Vec<Expression>,
7966}
7967
7968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7970#[cfg_attr(feature = "bindings", derive(TS))]
7971pub struct JoinHint {
7972 pub this: Box<Expression>,
7973 #[serde(default)]
7974 pub expressions: Vec<Expression>,
7975}
7976
7977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7979#[cfg_attr(feature = "bindings", derive(TS))]
7980pub struct Opclass {
7981 pub this: Box<Expression>,
7982 pub expression: Box<Expression>,
7983}
7984
7985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7987#[cfg_attr(feature = "bindings", derive(TS))]
7988pub struct Index {
7989 #[serde(default)]
7990 pub this: Option<Box<Expression>>,
7991 #[serde(default)]
7992 pub table: Option<Box<Expression>>,
7993 #[serde(default)]
7994 pub unique: bool,
7995 #[serde(default)]
7996 pub primary: Option<Box<Expression>>,
7997 #[serde(default)]
7998 pub amp: Option<Box<Expression>>,
7999 #[serde(default)]
8000 pub params: Vec<Expression>,
8001}
8002
8003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8005#[cfg_attr(feature = "bindings", derive(TS))]
8006pub struct IndexParameters {
8007 #[serde(default)]
8008 pub using: Option<Box<Expression>>,
8009 #[serde(default)]
8010 pub include: Option<Box<Expression>>,
8011 #[serde(default)]
8012 pub columns: Vec<Expression>,
8013 #[serde(default)]
8014 pub with_storage: Option<Box<Expression>>,
8015 #[serde(default)]
8016 pub partition_by: Option<Box<Expression>>,
8017 #[serde(default)]
8018 pub tablespace: Option<Box<Expression>>,
8019 #[serde(default)]
8020 pub where_: Option<Box<Expression>>,
8021 #[serde(default)]
8022 pub on: Option<Box<Expression>>,
8023}
8024
8025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8027#[cfg_attr(feature = "bindings", derive(TS))]
8028pub struct ConditionalInsert {
8029 pub this: Box<Expression>,
8030 #[serde(default)]
8031 pub expression: Option<Box<Expression>>,
8032 #[serde(default)]
8033 pub else_: Option<Box<Expression>>,
8034}
8035
8036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8038#[cfg_attr(feature = "bindings", derive(TS))]
8039pub struct MultitableInserts {
8040 #[serde(default)]
8041 pub expressions: Vec<Expression>,
8042 pub kind: String,
8043 #[serde(default)]
8044 pub source: Option<Box<Expression>>,
8045 #[serde(default)]
8047 pub leading_comments: Vec<String>,
8048}
8049
8050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8052#[cfg_attr(feature = "bindings", derive(TS))]
8053pub struct OnConflict {
8054 #[serde(default)]
8055 pub duplicate: Option<Box<Expression>>,
8056 #[serde(default)]
8057 pub expressions: Vec<Expression>,
8058 #[serde(default)]
8059 pub action: Option<Box<Expression>>,
8060 #[serde(default)]
8061 pub conflict_keys: Option<Box<Expression>>,
8062 #[serde(default)]
8063 pub index_predicate: Option<Box<Expression>>,
8064 #[serde(default)]
8065 pub constraint: Option<Box<Expression>>,
8066 #[serde(default)]
8067 pub where_: Option<Box<Expression>>,
8068}
8069
8070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8072#[cfg_attr(feature = "bindings", derive(TS))]
8073pub struct OnCondition {
8074 #[serde(default)]
8075 pub error: Option<Box<Expression>>,
8076 #[serde(default)]
8077 pub empty: Option<Box<Expression>>,
8078 #[serde(default)]
8079 pub null: Option<Box<Expression>>,
8080}
8081
8082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8084#[cfg_attr(feature = "bindings", derive(TS))]
8085pub struct Returning {
8086 #[serde(default)]
8087 pub expressions: Vec<Expression>,
8088 #[serde(default)]
8089 pub into: Option<Box<Expression>>,
8090}
8091
8092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8094#[cfg_attr(feature = "bindings", derive(TS))]
8095pub struct Introducer {
8096 pub this: Box<Expression>,
8097 pub expression: Box<Expression>,
8098}
8099
8100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8102#[cfg_attr(feature = "bindings", derive(TS))]
8103pub struct PartitionRange {
8104 pub this: Box<Expression>,
8105 #[serde(default)]
8106 pub expression: Option<Box<Expression>>,
8107 #[serde(default)]
8108 pub expressions: Vec<Expression>,
8109}
8110
8111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8113#[cfg_attr(feature = "bindings", derive(TS))]
8114pub struct Group {
8115 #[serde(default)]
8116 pub expressions: Vec<Expression>,
8117 #[serde(default)]
8118 pub grouping_sets: Option<Box<Expression>>,
8119 #[serde(default)]
8120 pub cube: Option<Box<Expression>>,
8121 #[serde(default)]
8122 pub rollup: Option<Box<Expression>>,
8123 #[serde(default)]
8124 pub totals: Option<Box<Expression>>,
8125 #[serde(default)]
8127 pub all: Option<bool>,
8128}
8129
8130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8132#[cfg_attr(feature = "bindings", derive(TS))]
8133pub struct Cube {
8134 #[serde(default)]
8135 pub expressions: Vec<Expression>,
8136}
8137
8138#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8140#[cfg_attr(feature = "bindings", derive(TS))]
8141pub struct Rollup {
8142 #[serde(default)]
8143 pub expressions: Vec<Expression>,
8144}
8145
8146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8148#[cfg_attr(feature = "bindings", derive(TS))]
8149pub struct GroupingSets {
8150 #[serde(default)]
8151 pub expressions: Vec<Expression>,
8152}
8153
8154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8156#[cfg_attr(feature = "bindings", derive(TS))]
8157pub struct LimitOptions {
8158 #[serde(default)]
8159 pub percent: Option<Box<Expression>>,
8160 #[serde(default)]
8161 pub rows: Option<Box<Expression>>,
8162 #[serde(default)]
8163 pub with_ties: Option<Box<Expression>>,
8164}
8165
8166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8168#[cfg_attr(feature = "bindings", derive(TS))]
8169pub struct Lateral {
8170 pub this: Box<Expression>,
8171 #[serde(default)]
8172 pub view: Option<Box<Expression>>,
8173 #[serde(default)]
8174 pub outer: Option<Box<Expression>>,
8175 #[serde(default)]
8176 pub alias: Option<String>,
8177 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8179 pub alias_quoted: bool,
8180 #[serde(default)]
8181 pub cross_apply: Option<Box<Expression>>,
8182 #[serde(default)]
8183 pub ordinality: Option<Box<Expression>>,
8184 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8186 pub column_aliases: Vec<String>,
8187}
8188
8189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8191#[cfg_attr(feature = "bindings", derive(TS))]
8192pub struct TableFromRows {
8193 pub this: Box<Expression>,
8194 #[serde(default)]
8195 pub alias: Option<String>,
8196 #[serde(default)]
8197 pub joins: Vec<Expression>,
8198 #[serde(default)]
8199 pub pivots: Option<Box<Expression>>,
8200 #[serde(default)]
8201 pub sample: Option<Box<Expression>>,
8202}
8203
8204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8207#[cfg_attr(feature = "bindings", derive(TS))]
8208pub struct RowsFrom {
8209 pub expressions: Vec<Expression>,
8211 #[serde(default)]
8213 pub ordinality: bool,
8214 #[serde(default)]
8216 pub alias: Option<Box<Expression>>,
8217}
8218
8219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8221#[cfg_attr(feature = "bindings", derive(TS))]
8222pub struct WithFill {
8223 #[serde(default)]
8224 pub from_: Option<Box<Expression>>,
8225 #[serde(default)]
8226 pub to: Option<Box<Expression>>,
8227 #[serde(default)]
8228 pub step: Option<Box<Expression>>,
8229 #[serde(default)]
8230 pub interpolate: Option<Box<Expression>>,
8231}
8232
8233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8235#[cfg_attr(feature = "bindings", derive(TS))]
8236pub struct Property {
8237 pub this: Box<Expression>,
8238 #[serde(default)]
8239 pub value: Option<Box<Expression>>,
8240}
8241
8242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8244#[cfg_attr(feature = "bindings", derive(TS))]
8245pub struct GrantPrivilege {
8246 pub this: Box<Expression>,
8247 #[serde(default)]
8248 pub expressions: Vec<Expression>,
8249}
8250
8251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8253#[cfg_attr(feature = "bindings", derive(TS))]
8254pub struct AllowedValuesProperty {
8255 #[serde(default)]
8256 pub expressions: Vec<Expression>,
8257}
8258
8259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8261#[cfg_attr(feature = "bindings", derive(TS))]
8262pub struct AlgorithmProperty {
8263 pub this: Box<Expression>,
8264}
8265
8266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8268#[cfg_attr(feature = "bindings", derive(TS))]
8269pub struct AutoIncrementProperty {
8270 pub this: Box<Expression>,
8271}
8272
8273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8275#[cfg_attr(feature = "bindings", derive(TS))]
8276pub struct AutoRefreshProperty {
8277 pub this: Box<Expression>,
8278}
8279
8280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8282#[cfg_attr(feature = "bindings", derive(TS))]
8283pub struct BackupProperty {
8284 pub this: Box<Expression>,
8285}
8286
8287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8289#[cfg_attr(feature = "bindings", derive(TS))]
8290pub struct BuildProperty {
8291 pub this: Box<Expression>,
8292}
8293
8294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8296#[cfg_attr(feature = "bindings", derive(TS))]
8297pub struct BlockCompressionProperty {
8298 #[serde(default)]
8299 pub autotemp: Option<Box<Expression>>,
8300 #[serde(default)]
8301 pub always: Option<Box<Expression>>,
8302 #[serde(default)]
8303 pub default: Option<Box<Expression>>,
8304 #[serde(default)]
8305 pub manual: Option<Box<Expression>>,
8306 #[serde(default)]
8307 pub never: Option<Box<Expression>>,
8308}
8309
8310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8312#[cfg_attr(feature = "bindings", derive(TS))]
8313pub struct CharacterSetProperty {
8314 pub this: Box<Expression>,
8315 #[serde(default)]
8316 pub default: Option<Box<Expression>>,
8317}
8318
8319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8321#[cfg_attr(feature = "bindings", derive(TS))]
8322pub struct ChecksumProperty {
8323 #[serde(default)]
8324 pub on: Option<Box<Expression>>,
8325 #[serde(default)]
8326 pub default: Option<Box<Expression>>,
8327}
8328
8329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8331#[cfg_attr(feature = "bindings", derive(TS))]
8332pub struct CollateProperty {
8333 pub this: Box<Expression>,
8334 #[serde(default)]
8335 pub default: Option<Box<Expression>>,
8336}
8337
8338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8340#[cfg_attr(feature = "bindings", derive(TS))]
8341pub struct DataBlocksizeProperty {
8342 #[serde(default)]
8343 pub size: Option<i64>,
8344 #[serde(default)]
8345 pub units: Option<Box<Expression>>,
8346 #[serde(default)]
8347 pub minimum: Option<Box<Expression>>,
8348 #[serde(default)]
8349 pub maximum: Option<Box<Expression>>,
8350 #[serde(default)]
8351 pub default: Option<Box<Expression>>,
8352}
8353
8354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8356#[cfg_attr(feature = "bindings", derive(TS))]
8357pub struct DataDeletionProperty {
8358 pub on: Box<Expression>,
8359 #[serde(default)]
8360 pub filter_column: Option<Box<Expression>>,
8361 #[serde(default)]
8362 pub retention_period: Option<Box<Expression>>,
8363}
8364
8365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8367#[cfg_attr(feature = "bindings", derive(TS))]
8368pub struct DefinerProperty {
8369 pub this: Box<Expression>,
8370}
8371
8372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8374#[cfg_attr(feature = "bindings", derive(TS))]
8375pub struct DistKeyProperty {
8376 pub this: Box<Expression>,
8377}
8378
8379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8381#[cfg_attr(feature = "bindings", derive(TS))]
8382pub struct DistributedByProperty {
8383 #[serde(default)]
8384 pub expressions: Vec<Expression>,
8385 pub kind: String,
8386 #[serde(default)]
8387 pub buckets: Option<Box<Expression>>,
8388 #[serde(default)]
8389 pub order: Option<Box<Expression>>,
8390}
8391
8392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8394#[cfg_attr(feature = "bindings", derive(TS))]
8395pub struct DistStyleProperty {
8396 pub this: Box<Expression>,
8397}
8398
8399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8401#[cfg_attr(feature = "bindings", derive(TS))]
8402pub struct DuplicateKeyProperty {
8403 #[serde(default)]
8404 pub expressions: Vec<Expression>,
8405}
8406
8407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8409#[cfg_attr(feature = "bindings", derive(TS))]
8410pub struct EngineProperty {
8411 pub this: Box<Expression>,
8412}
8413
8414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8416#[cfg_attr(feature = "bindings", derive(TS))]
8417pub struct ToTableProperty {
8418 pub this: Box<Expression>,
8419}
8420
8421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8423#[cfg_attr(feature = "bindings", derive(TS))]
8424pub struct ExecuteAsProperty {
8425 pub this: Box<Expression>,
8426}
8427
8428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8430#[cfg_attr(feature = "bindings", derive(TS))]
8431pub struct ExternalProperty {
8432 #[serde(default)]
8433 pub this: Option<Box<Expression>>,
8434}
8435
8436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8438#[cfg_attr(feature = "bindings", derive(TS))]
8439pub struct FallbackProperty {
8440 #[serde(default)]
8441 pub no: Option<Box<Expression>>,
8442 #[serde(default)]
8443 pub protection: Option<Box<Expression>>,
8444}
8445
8446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8448#[cfg_attr(feature = "bindings", derive(TS))]
8449pub struct FileFormatProperty {
8450 #[serde(default)]
8451 pub this: Option<Box<Expression>>,
8452 #[serde(default)]
8453 pub expressions: Vec<Expression>,
8454 #[serde(default)]
8455 pub hive_format: Option<Box<Expression>>,
8456}
8457
8458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8460#[cfg_attr(feature = "bindings", derive(TS))]
8461pub struct CredentialsProperty {
8462 #[serde(default)]
8463 pub expressions: Vec<Expression>,
8464}
8465
8466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8468#[cfg_attr(feature = "bindings", derive(TS))]
8469pub struct FreespaceProperty {
8470 pub this: Box<Expression>,
8471 #[serde(default)]
8472 pub percent: Option<Box<Expression>>,
8473}
8474
8475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8477#[cfg_attr(feature = "bindings", derive(TS))]
8478pub struct InheritsProperty {
8479 #[serde(default)]
8480 pub expressions: Vec<Expression>,
8481}
8482
8483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8485#[cfg_attr(feature = "bindings", derive(TS))]
8486pub struct InputModelProperty {
8487 pub this: Box<Expression>,
8488}
8489
8490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8492#[cfg_attr(feature = "bindings", derive(TS))]
8493pub struct OutputModelProperty {
8494 pub this: Box<Expression>,
8495}
8496
8497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8499#[cfg_attr(feature = "bindings", derive(TS))]
8500pub struct IsolatedLoadingProperty {
8501 #[serde(default)]
8502 pub no: Option<Box<Expression>>,
8503 #[serde(default)]
8504 pub concurrent: Option<Box<Expression>>,
8505 #[serde(default)]
8506 pub target: Option<Box<Expression>>,
8507}
8508
8509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8511#[cfg_attr(feature = "bindings", derive(TS))]
8512pub struct JournalProperty {
8513 #[serde(default)]
8514 pub no: Option<Box<Expression>>,
8515 #[serde(default)]
8516 pub dual: Option<Box<Expression>>,
8517 #[serde(default)]
8518 pub before: Option<Box<Expression>>,
8519 #[serde(default)]
8520 pub local: Option<Box<Expression>>,
8521 #[serde(default)]
8522 pub after: Option<Box<Expression>>,
8523}
8524
8525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8527#[cfg_attr(feature = "bindings", derive(TS))]
8528pub struct LanguageProperty {
8529 pub this: Box<Expression>,
8530}
8531
8532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8534#[cfg_attr(feature = "bindings", derive(TS))]
8535pub struct EnviromentProperty {
8536 #[serde(default)]
8537 pub expressions: Vec<Expression>,
8538}
8539
8540#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8542#[cfg_attr(feature = "bindings", derive(TS))]
8543pub struct ClusteredByProperty {
8544 #[serde(default)]
8545 pub expressions: Vec<Expression>,
8546 #[serde(default)]
8547 pub sorted_by: Option<Box<Expression>>,
8548 #[serde(default)]
8549 pub buckets: Option<Box<Expression>>,
8550}
8551
8552#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8554#[cfg_attr(feature = "bindings", derive(TS))]
8555pub struct DictProperty {
8556 pub this: Box<Expression>,
8557 pub kind: String,
8558 #[serde(default)]
8559 pub settings: Option<Box<Expression>>,
8560}
8561
8562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8564#[cfg_attr(feature = "bindings", derive(TS))]
8565pub struct DictRange {
8566 pub this: Box<Expression>,
8567 #[serde(default)]
8568 pub min: Option<Box<Expression>>,
8569 #[serde(default)]
8570 pub max: Option<Box<Expression>>,
8571}
8572
8573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8575#[cfg_attr(feature = "bindings", derive(TS))]
8576pub struct OnCluster {
8577 pub this: Box<Expression>,
8578}
8579
8580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8582#[cfg_attr(feature = "bindings", derive(TS))]
8583pub struct LikeProperty {
8584 pub this: Box<Expression>,
8585 #[serde(default)]
8586 pub expressions: Vec<Expression>,
8587}
8588
8589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8591#[cfg_attr(feature = "bindings", derive(TS))]
8592pub struct LocationProperty {
8593 pub this: Box<Expression>,
8594}
8595
8596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8598#[cfg_attr(feature = "bindings", derive(TS))]
8599pub struct LockProperty {
8600 pub this: Box<Expression>,
8601}
8602
8603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8605#[cfg_attr(feature = "bindings", derive(TS))]
8606pub struct LockingProperty {
8607 #[serde(default)]
8608 pub this: Option<Box<Expression>>,
8609 pub kind: String,
8610 #[serde(default)]
8611 pub for_or_in: Option<Box<Expression>>,
8612 #[serde(default)]
8613 pub lock_type: Option<Box<Expression>>,
8614 #[serde(default)]
8615 pub override_: Option<Box<Expression>>,
8616}
8617
8618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8620#[cfg_attr(feature = "bindings", derive(TS))]
8621pub struct LogProperty {
8622 #[serde(default)]
8623 pub no: Option<Box<Expression>>,
8624}
8625
8626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8628#[cfg_attr(feature = "bindings", derive(TS))]
8629pub struct MaterializedProperty {
8630 #[serde(default)]
8631 pub this: Option<Box<Expression>>,
8632}
8633
8634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8636#[cfg_attr(feature = "bindings", derive(TS))]
8637pub struct MergeBlockRatioProperty {
8638 #[serde(default)]
8639 pub this: Option<Box<Expression>>,
8640 #[serde(default)]
8641 pub no: Option<Box<Expression>>,
8642 #[serde(default)]
8643 pub default: Option<Box<Expression>>,
8644 #[serde(default)]
8645 pub percent: Option<Box<Expression>>,
8646}
8647
8648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8650#[cfg_attr(feature = "bindings", derive(TS))]
8651pub struct OnProperty {
8652 pub this: Box<Expression>,
8653}
8654
8655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8657#[cfg_attr(feature = "bindings", derive(TS))]
8658pub struct OnCommitProperty {
8659 #[serde(default)]
8660 pub delete: Option<Box<Expression>>,
8661}
8662
8663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8665#[cfg_attr(feature = "bindings", derive(TS))]
8666pub struct PartitionedByProperty {
8667 pub this: Box<Expression>,
8668}
8669
8670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8672#[cfg_attr(feature = "bindings", derive(TS))]
8673pub struct PartitionedByBucket {
8674 pub this: Box<Expression>,
8675 pub expression: Box<Expression>,
8676}
8677
8678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8680#[cfg_attr(feature = "bindings", derive(TS))]
8681pub struct PartitionByTruncate {
8682 pub this: Box<Expression>,
8683 pub expression: Box<Expression>,
8684}
8685
8686#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8688#[cfg_attr(feature = "bindings", derive(TS))]
8689pub struct PartitionByRangeProperty {
8690 #[serde(default)]
8691 pub partition_expressions: Option<Box<Expression>>,
8692 #[serde(default)]
8693 pub create_expressions: Option<Box<Expression>>,
8694}
8695
8696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8698#[cfg_attr(feature = "bindings", derive(TS))]
8699pub struct PartitionByRangePropertyDynamic {
8700 #[serde(default)]
8701 pub this: Option<Box<Expression>>,
8702 #[serde(default)]
8703 pub start: Option<Box<Expression>>,
8704 #[serde(default)]
8705 pub end: Option<Box<Expression>>,
8706 #[serde(default)]
8707 pub every: Option<Box<Expression>>,
8708}
8709
8710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8712#[cfg_attr(feature = "bindings", derive(TS))]
8713pub struct PartitionByListProperty {
8714 #[serde(default)]
8715 pub partition_expressions: Option<Box<Expression>>,
8716 #[serde(default)]
8717 pub create_expressions: Option<Box<Expression>>,
8718}
8719
8720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8722#[cfg_attr(feature = "bindings", derive(TS))]
8723pub struct PartitionList {
8724 pub this: Box<Expression>,
8725 #[serde(default)]
8726 pub expressions: Vec<Expression>,
8727}
8728
8729#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8731#[cfg_attr(feature = "bindings", derive(TS))]
8732pub struct Partition {
8733 pub expressions: Vec<Expression>,
8734 #[serde(default)]
8735 pub subpartition: bool,
8736}
8737
8738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8741#[cfg_attr(feature = "bindings", derive(TS))]
8742pub struct RefreshTriggerProperty {
8743 pub method: String,
8745 #[serde(default)]
8747 pub kind: Option<String>,
8748 #[serde(default)]
8750 pub every: Option<Box<Expression>>,
8751 #[serde(default)]
8753 pub unit: Option<String>,
8754 #[serde(default)]
8756 pub starts: Option<Box<Expression>>,
8757}
8758
8759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8761#[cfg_attr(feature = "bindings", derive(TS))]
8762pub struct UniqueKeyProperty {
8763 #[serde(default)]
8764 pub expressions: Vec<Expression>,
8765}
8766
8767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8769#[cfg_attr(feature = "bindings", derive(TS))]
8770pub struct RollupProperty {
8771 pub expressions: Vec<RollupIndex>,
8772}
8773
8774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8776#[cfg_attr(feature = "bindings", derive(TS))]
8777pub struct RollupIndex {
8778 pub name: Identifier,
8779 pub expressions: Vec<Identifier>,
8780}
8781
8782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8784#[cfg_attr(feature = "bindings", derive(TS))]
8785pub struct PartitionBoundSpec {
8786 #[serde(default)]
8787 pub this: Option<Box<Expression>>,
8788 #[serde(default)]
8789 pub expression: Option<Box<Expression>>,
8790 #[serde(default)]
8791 pub from_expressions: Option<Box<Expression>>,
8792 #[serde(default)]
8793 pub to_expressions: Option<Box<Expression>>,
8794}
8795
8796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8798#[cfg_attr(feature = "bindings", derive(TS))]
8799pub struct PartitionedOfProperty {
8800 pub this: Box<Expression>,
8801 pub expression: Box<Expression>,
8802}
8803
8804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8806#[cfg_attr(feature = "bindings", derive(TS))]
8807pub struct RemoteWithConnectionModelProperty {
8808 pub this: Box<Expression>,
8809}
8810
8811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8813#[cfg_attr(feature = "bindings", derive(TS))]
8814pub struct ReturnsProperty {
8815 #[serde(default)]
8816 pub this: Option<Box<Expression>>,
8817 #[serde(default)]
8818 pub is_table: Option<Box<Expression>>,
8819 #[serde(default)]
8820 pub table: Option<Box<Expression>>,
8821 #[serde(default)]
8822 pub null: Option<Box<Expression>>,
8823}
8824
8825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8827#[cfg_attr(feature = "bindings", derive(TS))]
8828pub struct RowFormatProperty {
8829 pub this: Box<Expression>,
8830}
8831
8832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8834#[cfg_attr(feature = "bindings", derive(TS))]
8835pub struct RowFormatDelimitedProperty {
8836 #[serde(default)]
8837 pub fields: Option<Box<Expression>>,
8838 #[serde(default)]
8839 pub escaped: Option<Box<Expression>>,
8840 #[serde(default)]
8841 pub collection_items: Option<Box<Expression>>,
8842 #[serde(default)]
8843 pub map_keys: Option<Box<Expression>>,
8844 #[serde(default)]
8845 pub lines: Option<Box<Expression>>,
8846 #[serde(default)]
8847 pub null: Option<Box<Expression>>,
8848 #[serde(default)]
8849 pub serde: Option<Box<Expression>>,
8850}
8851
8852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8854#[cfg_attr(feature = "bindings", derive(TS))]
8855pub struct RowFormatSerdeProperty {
8856 pub this: Box<Expression>,
8857 #[serde(default)]
8858 pub serde_properties: Option<Box<Expression>>,
8859}
8860
8861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8863#[cfg_attr(feature = "bindings", derive(TS))]
8864pub struct QueryTransform {
8865 #[serde(default)]
8866 pub expressions: Vec<Expression>,
8867 #[serde(default)]
8868 pub command_script: Option<Box<Expression>>,
8869 #[serde(default)]
8870 pub schema: Option<Box<Expression>>,
8871 #[serde(default)]
8872 pub row_format_before: Option<Box<Expression>>,
8873 #[serde(default)]
8874 pub record_writer: Option<Box<Expression>>,
8875 #[serde(default)]
8876 pub row_format_after: Option<Box<Expression>>,
8877 #[serde(default)]
8878 pub record_reader: Option<Box<Expression>>,
8879}
8880
8881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8883#[cfg_attr(feature = "bindings", derive(TS))]
8884pub struct SampleProperty {
8885 pub this: Box<Expression>,
8886}
8887
8888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8890#[cfg_attr(feature = "bindings", derive(TS))]
8891pub struct SecurityProperty {
8892 pub this: Box<Expression>,
8893}
8894
8895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8897#[cfg_attr(feature = "bindings", derive(TS))]
8898pub struct SchemaCommentProperty {
8899 pub this: Box<Expression>,
8900}
8901
8902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8904#[cfg_attr(feature = "bindings", derive(TS))]
8905pub struct SemanticView {
8906 pub this: Box<Expression>,
8907 #[serde(default)]
8908 pub metrics: Option<Box<Expression>>,
8909 #[serde(default)]
8910 pub dimensions: Option<Box<Expression>>,
8911 #[serde(default)]
8912 pub facts: Option<Box<Expression>>,
8913 #[serde(default)]
8914 pub where_: Option<Box<Expression>>,
8915}
8916
8917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8919#[cfg_attr(feature = "bindings", derive(TS))]
8920pub struct SerdeProperties {
8921 #[serde(default)]
8922 pub expressions: Vec<Expression>,
8923 #[serde(default)]
8924 pub with_: Option<Box<Expression>>,
8925}
8926
8927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8929#[cfg_attr(feature = "bindings", derive(TS))]
8930pub struct SetProperty {
8931 #[serde(default)]
8932 pub multi: Option<Box<Expression>>,
8933}
8934
8935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8937#[cfg_attr(feature = "bindings", derive(TS))]
8938pub struct SharingProperty {
8939 #[serde(default)]
8940 pub this: Option<Box<Expression>>,
8941}
8942
8943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8945#[cfg_attr(feature = "bindings", derive(TS))]
8946pub struct SetConfigProperty {
8947 pub this: Box<Expression>,
8948}
8949
8950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8952#[cfg_attr(feature = "bindings", derive(TS))]
8953pub struct SettingsProperty {
8954 #[serde(default)]
8955 pub expressions: Vec<Expression>,
8956}
8957
8958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8960#[cfg_attr(feature = "bindings", derive(TS))]
8961pub struct SortKeyProperty {
8962 pub this: Box<Expression>,
8963 #[serde(default)]
8964 pub compound: Option<Box<Expression>>,
8965}
8966
8967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8969#[cfg_attr(feature = "bindings", derive(TS))]
8970pub struct SqlReadWriteProperty {
8971 pub this: Box<Expression>,
8972}
8973
8974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8976#[cfg_attr(feature = "bindings", derive(TS))]
8977pub struct SqlSecurityProperty {
8978 pub this: Box<Expression>,
8979}
8980
8981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8983#[cfg_attr(feature = "bindings", derive(TS))]
8984pub struct StabilityProperty {
8985 pub this: Box<Expression>,
8986}
8987
8988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8990#[cfg_attr(feature = "bindings", derive(TS))]
8991pub struct StorageHandlerProperty {
8992 pub this: Box<Expression>,
8993}
8994
8995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8997#[cfg_attr(feature = "bindings", derive(TS))]
8998pub struct TemporaryProperty {
8999 #[serde(default)]
9000 pub this: Option<Box<Expression>>,
9001}
9002
9003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9005#[cfg_attr(feature = "bindings", derive(TS))]
9006pub struct Tags {
9007 #[serde(default)]
9008 pub expressions: Vec<Expression>,
9009}
9010
9011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9013#[cfg_attr(feature = "bindings", derive(TS))]
9014pub struct TransformModelProperty {
9015 #[serde(default)]
9016 pub expressions: Vec<Expression>,
9017}
9018
9019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9021#[cfg_attr(feature = "bindings", derive(TS))]
9022pub struct TransientProperty {
9023 #[serde(default)]
9024 pub this: Option<Box<Expression>>,
9025}
9026
9027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9029#[cfg_attr(feature = "bindings", derive(TS))]
9030pub struct UsingTemplateProperty {
9031 pub this: Box<Expression>,
9032}
9033
9034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9036#[cfg_attr(feature = "bindings", derive(TS))]
9037pub struct ViewAttributeProperty {
9038 pub this: Box<Expression>,
9039}
9040
9041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9043#[cfg_attr(feature = "bindings", derive(TS))]
9044pub struct VolatileProperty {
9045 #[serde(default)]
9046 pub this: Option<Box<Expression>>,
9047}
9048
9049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9051#[cfg_attr(feature = "bindings", derive(TS))]
9052pub struct WithDataProperty {
9053 #[serde(default)]
9054 pub no: Option<Box<Expression>>,
9055 #[serde(default)]
9056 pub statistics: Option<Box<Expression>>,
9057}
9058
9059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9061#[cfg_attr(feature = "bindings", derive(TS))]
9062pub struct WithJournalTableProperty {
9063 pub this: Box<Expression>,
9064}
9065
9066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9068#[cfg_attr(feature = "bindings", derive(TS))]
9069pub struct WithSchemaBindingProperty {
9070 pub this: Box<Expression>,
9071}
9072
9073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9075#[cfg_attr(feature = "bindings", derive(TS))]
9076pub struct WithSystemVersioningProperty {
9077 #[serde(default)]
9078 pub on: Option<Box<Expression>>,
9079 #[serde(default)]
9080 pub this: Option<Box<Expression>>,
9081 #[serde(default)]
9082 pub data_consistency: Option<Box<Expression>>,
9083 #[serde(default)]
9084 pub retention_period: Option<Box<Expression>>,
9085 #[serde(default)]
9086 pub with_: Option<Box<Expression>>,
9087}
9088
9089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9091#[cfg_attr(feature = "bindings", derive(TS))]
9092pub struct WithProcedureOptions {
9093 #[serde(default)]
9094 pub expressions: Vec<Expression>,
9095}
9096
9097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9099#[cfg_attr(feature = "bindings", derive(TS))]
9100pub struct EncodeProperty {
9101 pub this: Box<Expression>,
9102 #[serde(default)]
9103 pub properties: Vec<Expression>,
9104 #[serde(default)]
9105 pub key: Option<Box<Expression>>,
9106}
9107
9108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9110#[cfg_attr(feature = "bindings", derive(TS))]
9111pub struct IncludeProperty {
9112 pub this: Box<Expression>,
9113 #[serde(default)]
9114 pub alias: Option<String>,
9115 #[serde(default)]
9116 pub column_def: Option<Box<Expression>>,
9117}
9118
9119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9121#[cfg_attr(feature = "bindings", derive(TS))]
9122pub struct Properties {
9123 #[serde(default)]
9124 pub expressions: Vec<Expression>,
9125}
9126
9127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9129#[cfg_attr(feature = "bindings", derive(TS))]
9130pub struct InputOutputFormat {
9131 #[serde(default)]
9132 pub input_format: Option<Box<Expression>>,
9133 #[serde(default)]
9134 pub output_format: Option<Box<Expression>>,
9135}
9136
9137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9139#[cfg_attr(feature = "bindings", derive(TS))]
9140pub struct Reference {
9141 pub this: Box<Expression>,
9142 #[serde(default)]
9143 pub expressions: Vec<Expression>,
9144 #[serde(default)]
9145 pub options: Vec<Expression>,
9146}
9147
9148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9150#[cfg_attr(feature = "bindings", derive(TS))]
9151pub struct QueryOption {
9152 pub this: Box<Expression>,
9153 #[serde(default)]
9154 pub expression: Option<Box<Expression>>,
9155}
9156
9157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9159#[cfg_attr(feature = "bindings", derive(TS))]
9160pub struct WithTableHint {
9161 #[serde(default)]
9162 pub expressions: Vec<Expression>,
9163}
9164
9165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9167#[cfg_attr(feature = "bindings", derive(TS))]
9168pub struct IndexTableHint {
9169 pub this: Box<Expression>,
9170 #[serde(default)]
9171 pub expressions: Vec<Expression>,
9172 #[serde(default)]
9173 pub target: Option<Box<Expression>>,
9174}
9175
9176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9178#[cfg_attr(feature = "bindings", derive(TS))]
9179pub struct Get {
9180 pub this: Box<Expression>,
9181 #[serde(default)]
9182 pub target: Option<Box<Expression>>,
9183 #[serde(default)]
9184 pub properties: Vec<Expression>,
9185}
9186
9187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9189#[cfg_attr(feature = "bindings", derive(TS))]
9190pub struct SetOperation {
9191 #[serde(default)]
9192 pub with_: Option<Box<Expression>>,
9193 pub this: Box<Expression>,
9194 pub expression: Box<Expression>,
9195 #[serde(default)]
9196 pub distinct: bool,
9197 #[serde(default)]
9198 pub by_name: Option<Box<Expression>>,
9199 #[serde(default)]
9200 pub side: Option<Box<Expression>>,
9201 #[serde(default)]
9202 pub kind: Option<String>,
9203 #[serde(default)]
9204 pub on: Option<Box<Expression>>,
9205}
9206
9207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9209#[cfg_attr(feature = "bindings", derive(TS))]
9210pub struct Var {
9211 pub this: String,
9212}
9213
9214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9216#[cfg_attr(feature = "bindings", derive(TS))]
9217pub struct Version {
9218 pub this: Box<Expression>,
9219 pub kind: String,
9220 #[serde(default)]
9221 pub expression: Option<Box<Expression>>,
9222}
9223
9224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9226#[cfg_attr(feature = "bindings", derive(TS))]
9227pub struct Schema {
9228 #[serde(default)]
9229 pub this: Option<Box<Expression>>,
9230 #[serde(default)]
9231 pub expressions: Vec<Expression>,
9232}
9233
9234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9236#[cfg_attr(feature = "bindings", derive(TS))]
9237pub struct Lock {
9238 #[serde(default)]
9239 pub update: Option<Box<Expression>>,
9240 #[serde(default)]
9241 pub expressions: Vec<Expression>,
9242 #[serde(default)]
9243 pub wait: Option<Box<Expression>>,
9244 #[serde(default)]
9245 pub key: Option<Box<Expression>>,
9246}
9247
9248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9251#[cfg_attr(feature = "bindings", derive(TS))]
9252pub struct TableSample {
9253 #[serde(default, skip_serializing_if = "Option::is_none")]
9255 pub this: Option<Box<Expression>>,
9256 #[serde(default, skip_serializing_if = "Option::is_none")]
9258 pub sample: Option<Box<Sample>>,
9259 #[serde(default)]
9260 pub expressions: Vec<Expression>,
9261 #[serde(default)]
9262 pub method: Option<String>,
9263 #[serde(default)]
9264 pub bucket_numerator: Option<Box<Expression>>,
9265 #[serde(default)]
9266 pub bucket_denominator: Option<Box<Expression>>,
9267 #[serde(default)]
9268 pub bucket_field: Option<Box<Expression>>,
9269 #[serde(default)]
9270 pub percent: Option<Box<Expression>>,
9271 #[serde(default)]
9272 pub rows: Option<Box<Expression>>,
9273 #[serde(default)]
9274 pub size: Option<i64>,
9275 #[serde(default)]
9276 pub seed: Option<Box<Expression>>,
9277}
9278
9279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9281#[cfg_attr(feature = "bindings", derive(TS))]
9282pub struct Tag {
9283 #[serde(default)]
9284 pub this: Option<Box<Expression>>,
9285 #[serde(default)]
9286 pub prefix: Option<Box<Expression>>,
9287 #[serde(default)]
9288 pub postfix: Option<Box<Expression>>,
9289}
9290
9291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9293#[cfg_attr(feature = "bindings", derive(TS))]
9294pub struct UnpivotColumns {
9295 pub this: Box<Expression>,
9296 #[serde(default)]
9297 pub expressions: Vec<Expression>,
9298}
9299
9300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9302#[cfg_attr(feature = "bindings", derive(TS))]
9303pub struct SessionParameter {
9304 pub this: Box<Expression>,
9305 #[serde(default)]
9306 pub kind: Option<String>,
9307}
9308
9309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9311#[cfg_attr(feature = "bindings", derive(TS))]
9312pub struct PseudoType {
9313 pub this: Box<Expression>,
9314}
9315
9316#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9318#[cfg_attr(feature = "bindings", derive(TS))]
9319pub struct ObjectIdentifier {
9320 pub this: Box<Expression>,
9321}
9322
9323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9325#[cfg_attr(feature = "bindings", derive(TS))]
9326pub struct Transaction {
9327 #[serde(default)]
9328 pub this: Option<Box<Expression>>,
9329 #[serde(default)]
9330 pub modes: Option<Box<Expression>>,
9331 #[serde(default)]
9332 pub mark: Option<Box<Expression>>,
9333}
9334
9335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9337#[cfg_attr(feature = "bindings", derive(TS))]
9338pub struct Commit {
9339 #[serde(default)]
9340 pub chain: Option<Box<Expression>>,
9341 #[serde(default)]
9342 pub this: Option<Box<Expression>>,
9343 #[serde(default)]
9344 pub durability: Option<Box<Expression>>,
9345}
9346
9347#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9349#[cfg_attr(feature = "bindings", derive(TS))]
9350pub struct Rollback {
9351 #[serde(default)]
9352 pub savepoint: Option<Box<Expression>>,
9353 #[serde(default)]
9354 pub this: Option<Box<Expression>>,
9355}
9356
9357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9359#[cfg_attr(feature = "bindings", derive(TS))]
9360pub struct AlterSession {
9361 #[serde(default)]
9362 pub expressions: Vec<Expression>,
9363 #[serde(default)]
9364 pub unset: Option<Box<Expression>>,
9365}
9366
9367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9369#[cfg_attr(feature = "bindings", derive(TS))]
9370pub struct Analyze {
9371 #[serde(default)]
9372 pub kind: Option<String>,
9373 #[serde(default)]
9374 pub this: Option<Box<Expression>>,
9375 #[serde(default)]
9376 pub options: Vec<Expression>,
9377 #[serde(default)]
9378 pub mode: Option<Box<Expression>>,
9379 #[serde(default)]
9380 pub partition: Option<Box<Expression>>,
9381 #[serde(default)]
9382 pub expression: Option<Box<Expression>>,
9383 #[serde(default)]
9384 pub properties: Vec<Expression>,
9385 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9387 pub columns: Vec<String>,
9388}
9389
9390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9392#[cfg_attr(feature = "bindings", derive(TS))]
9393pub struct AnalyzeStatistics {
9394 pub kind: String,
9395 #[serde(default)]
9396 pub option: Option<Box<Expression>>,
9397 #[serde(default)]
9398 pub this: Option<Box<Expression>>,
9399 #[serde(default)]
9400 pub expressions: Vec<Expression>,
9401}
9402
9403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9405#[cfg_attr(feature = "bindings", derive(TS))]
9406pub struct AnalyzeHistogram {
9407 pub this: Box<Expression>,
9408 #[serde(default)]
9409 pub expressions: Vec<Expression>,
9410 #[serde(default)]
9411 pub expression: Option<Box<Expression>>,
9412 #[serde(default)]
9413 pub update_options: Option<Box<Expression>>,
9414}
9415
9416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9418#[cfg_attr(feature = "bindings", derive(TS))]
9419pub struct AnalyzeSample {
9420 pub kind: String,
9421 #[serde(default)]
9422 pub sample: Option<Box<Expression>>,
9423}
9424
9425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9427#[cfg_attr(feature = "bindings", derive(TS))]
9428pub struct AnalyzeListChainedRows {
9429 #[serde(default)]
9430 pub expression: Option<Box<Expression>>,
9431}
9432
9433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9435#[cfg_attr(feature = "bindings", derive(TS))]
9436pub struct AnalyzeDelete {
9437 #[serde(default)]
9438 pub kind: Option<String>,
9439}
9440
9441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9443#[cfg_attr(feature = "bindings", derive(TS))]
9444pub struct AnalyzeWith {
9445 #[serde(default)]
9446 pub expressions: Vec<Expression>,
9447}
9448
9449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9451#[cfg_attr(feature = "bindings", derive(TS))]
9452pub struct AnalyzeValidate {
9453 pub kind: String,
9454 #[serde(default)]
9455 pub this: Option<Box<Expression>>,
9456 #[serde(default)]
9457 pub expression: Option<Box<Expression>>,
9458}
9459
9460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9462#[cfg_attr(feature = "bindings", derive(TS))]
9463pub struct AddPartition {
9464 pub this: Box<Expression>,
9465 #[serde(default)]
9466 pub exists: bool,
9467 #[serde(default)]
9468 pub location: Option<Box<Expression>>,
9469}
9470
9471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9473#[cfg_attr(feature = "bindings", derive(TS))]
9474pub struct AttachOption {
9475 pub this: Box<Expression>,
9476 #[serde(default)]
9477 pub expression: Option<Box<Expression>>,
9478}
9479
9480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9482#[cfg_attr(feature = "bindings", derive(TS))]
9483pub struct DropPartition {
9484 #[serde(default)]
9485 pub expressions: Vec<Expression>,
9486 #[serde(default)]
9487 pub exists: bool,
9488}
9489
9490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9492#[cfg_attr(feature = "bindings", derive(TS))]
9493pub struct ReplacePartition {
9494 pub expression: Box<Expression>,
9495 #[serde(default)]
9496 pub source: Option<Box<Expression>>,
9497}
9498
9499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9501#[cfg_attr(feature = "bindings", derive(TS))]
9502pub struct DPipe {
9503 pub this: Box<Expression>,
9504 pub expression: Box<Expression>,
9505 #[serde(default)]
9506 pub safe: Option<Box<Expression>>,
9507}
9508
9509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9511#[cfg_attr(feature = "bindings", derive(TS))]
9512pub struct Operator {
9513 pub this: Box<Expression>,
9514 #[serde(default)]
9515 pub operator: Option<Box<Expression>>,
9516 pub expression: Box<Expression>,
9517}
9518
9519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9521#[cfg_attr(feature = "bindings", derive(TS))]
9522pub struct PivotAny {
9523 #[serde(default)]
9524 pub this: Option<Box<Expression>>,
9525}
9526
9527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9529#[cfg_attr(feature = "bindings", derive(TS))]
9530pub struct Aliases {
9531 pub this: Box<Expression>,
9532 #[serde(default)]
9533 pub expressions: Vec<Expression>,
9534}
9535
9536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9538#[cfg_attr(feature = "bindings", derive(TS))]
9539pub struct AtIndex {
9540 pub this: Box<Expression>,
9541 pub expression: Box<Expression>,
9542}
9543
9544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9546#[cfg_attr(feature = "bindings", derive(TS))]
9547pub struct FromTimeZone {
9548 pub this: Box<Expression>,
9549 #[serde(default)]
9550 pub zone: Option<Box<Expression>>,
9551}
9552
9553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9555#[cfg_attr(feature = "bindings", derive(TS))]
9556pub struct FormatPhrase {
9557 pub this: Box<Expression>,
9558 pub format: String,
9559}
9560
9561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9563#[cfg_attr(feature = "bindings", derive(TS))]
9564pub struct ForIn {
9565 pub this: Box<Expression>,
9566 pub expression: Box<Expression>,
9567}
9568
9569#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9571#[cfg_attr(feature = "bindings", derive(TS))]
9572pub struct TimeUnit {
9573 #[serde(default)]
9574 pub unit: Option<String>,
9575}
9576
9577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9579#[cfg_attr(feature = "bindings", derive(TS))]
9580pub struct IntervalOp {
9581 #[serde(default)]
9582 pub unit: Option<String>,
9583 pub expression: Box<Expression>,
9584}
9585
9586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9588#[cfg_attr(feature = "bindings", derive(TS))]
9589pub struct HavingMax {
9590 pub this: Box<Expression>,
9591 pub expression: Box<Expression>,
9592 #[serde(default)]
9593 pub max: Option<Box<Expression>>,
9594}
9595
9596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9598#[cfg_attr(feature = "bindings", derive(TS))]
9599pub struct CosineDistance {
9600 pub this: Box<Expression>,
9601 pub expression: Box<Expression>,
9602}
9603
9604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9606#[cfg_attr(feature = "bindings", derive(TS))]
9607pub struct DotProduct {
9608 pub this: Box<Expression>,
9609 pub expression: Box<Expression>,
9610}
9611
9612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9614#[cfg_attr(feature = "bindings", derive(TS))]
9615pub struct EuclideanDistance {
9616 pub this: Box<Expression>,
9617 pub expression: Box<Expression>,
9618}
9619
9620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9622#[cfg_attr(feature = "bindings", derive(TS))]
9623pub struct ManhattanDistance {
9624 pub this: Box<Expression>,
9625 pub expression: Box<Expression>,
9626}
9627
9628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9630#[cfg_attr(feature = "bindings", derive(TS))]
9631pub struct JarowinklerSimilarity {
9632 pub this: Box<Expression>,
9633 pub expression: Box<Expression>,
9634}
9635
9636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9638#[cfg_attr(feature = "bindings", derive(TS))]
9639pub struct Booland {
9640 pub this: Box<Expression>,
9641 pub expression: Box<Expression>,
9642}
9643
9644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9646#[cfg_attr(feature = "bindings", derive(TS))]
9647pub struct Boolor {
9648 pub this: Box<Expression>,
9649 pub expression: Box<Expression>,
9650}
9651
9652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9654#[cfg_attr(feature = "bindings", derive(TS))]
9655pub struct ParameterizedAgg {
9656 pub this: Box<Expression>,
9657 #[serde(default)]
9658 pub expressions: Vec<Expression>,
9659 #[serde(default)]
9660 pub params: Vec<Expression>,
9661}
9662
9663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9665#[cfg_attr(feature = "bindings", derive(TS))]
9666pub struct ArgMax {
9667 pub this: Box<Expression>,
9668 pub expression: Box<Expression>,
9669 #[serde(default)]
9670 pub count: Option<Box<Expression>>,
9671}
9672
9673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9675#[cfg_attr(feature = "bindings", derive(TS))]
9676pub struct ArgMin {
9677 pub this: Box<Expression>,
9678 pub expression: Box<Expression>,
9679 #[serde(default)]
9680 pub count: Option<Box<Expression>>,
9681}
9682
9683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9685#[cfg_attr(feature = "bindings", derive(TS))]
9686pub struct ApproxTopK {
9687 pub this: Box<Expression>,
9688 #[serde(default)]
9689 pub expression: Option<Box<Expression>>,
9690 #[serde(default)]
9691 pub counters: Option<Box<Expression>>,
9692}
9693
9694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9696#[cfg_attr(feature = "bindings", derive(TS))]
9697pub struct ApproxTopKAccumulate {
9698 pub this: Box<Expression>,
9699 #[serde(default)]
9700 pub expression: Option<Box<Expression>>,
9701}
9702
9703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9705#[cfg_attr(feature = "bindings", derive(TS))]
9706pub struct ApproxTopKCombine {
9707 pub this: Box<Expression>,
9708 #[serde(default)]
9709 pub expression: Option<Box<Expression>>,
9710}
9711
9712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9714#[cfg_attr(feature = "bindings", derive(TS))]
9715pub struct ApproxTopKEstimate {
9716 pub this: Box<Expression>,
9717 #[serde(default)]
9718 pub expression: Option<Box<Expression>>,
9719}
9720
9721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9723#[cfg_attr(feature = "bindings", derive(TS))]
9724pub struct ApproxTopSum {
9725 pub this: Box<Expression>,
9726 pub expression: Box<Expression>,
9727 #[serde(default)]
9728 pub count: Option<Box<Expression>>,
9729}
9730
9731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9733#[cfg_attr(feature = "bindings", derive(TS))]
9734pub struct ApproxQuantiles {
9735 pub this: Box<Expression>,
9736 #[serde(default)]
9737 pub expression: Option<Box<Expression>>,
9738}
9739
9740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9742#[cfg_attr(feature = "bindings", derive(TS))]
9743pub struct Minhash {
9744 pub this: Box<Expression>,
9745 #[serde(default)]
9746 pub expressions: Vec<Expression>,
9747}
9748
9749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9751#[cfg_attr(feature = "bindings", derive(TS))]
9752pub struct FarmFingerprint {
9753 #[serde(default)]
9754 pub expressions: Vec<Expression>,
9755}
9756
9757#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9759#[cfg_attr(feature = "bindings", derive(TS))]
9760pub struct Float64 {
9761 pub this: Box<Expression>,
9762 #[serde(default)]
9763 pub expression: Option<Box<Expression>>,
9764}
9765
9766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9768#[cfg_attr(feature = "bindings", derive(TS))]
9769pub struct Transform {
9770 pub this: Box<Expression>,
9771 pub expression: Box<Expression>,
9772}
9773
9774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9776#[cfg_attr(feature = "bindings", derive(TS))]
9777pub struct Translate {
9778 pub this: Box<Expression>,
9779 #[serde(default)]
9780 pub from_: Option<Box<Expression>>,
9781 #[serde(default)]
9782 pub to: Option<Box<Expression>>,
9783}
9784
9785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9787#[cfg_attr(feature = "bindings", derive(TS))]
9788pub struct Grouping {
9789 #[serde(default)]
9790 pub expressions: Vec<Expression>,
9791}
9792
9793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9795#[cfg_attr(feature = "bindings", derive(TS))]
9796pub struct GroupingId {
9797 #[serde(default)]
9798 pub expressions: Vec<Expression>,
9799}
9800
9801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9803#[cfg_attr(feature = "bindings", derive(TS))]
9804pub struct Anonymous {
9805 pub this: Box<Expression>,
9806 #[serde(default)]
9807 pub expressions: Vec<Expression>,
9808}
9809
9810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9812#[cfg_attr(feature = "bindings", derive(TS))]
9813pub struct AnonymousAggFunc {
9814 pub this: Box<Expression>,
9815 #[serde(default)]
9816 pub expressions: Vec<Expression>,
9817}
9818
9819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9821#[cfg_attr(feature = "bindings", derive(TS))]
9822pub struct CombinedAggFunc {
9823 pub this: Box<Expression>,
9824 #[serde(default)]
9825 pub expressions: Vec<Expression>,
9826}
9827
9828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9830#[cfg_attr(feature = "bindings", derive(TS))]
9831pub struct CombinedParameterizedAgg {
9832 pub this: Box<Expression>,
9833 #[serde(default)]
9834 pub expressions: Vec<Expression>,
9835 #[serde(default)]
9836 pub params: Vec<Expression>,
9837}
9838
9839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9841#[cfg_attr(feature = "bindings", derive(TS))]
9842pub struct HashAgg {
9843 pub this: Box<Expression>,
9844 #[serde(default)]
9845 pub expressions: Vec<Expression>,
9846}
9847
9848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9850#[cfg_attr(feature = "bindings", derive(TS))]
9851pub struct Hll {
9852 pub this: Box<Expression>,
9853 #[serde(default)]
9854 pub expressions: Vec<Expression>,
9855}
9856
9857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9859#[cfg_attr(feature = "bindings", derive(TS))]
9860pub struct Apply {
9861 pub this: Box<Expression>,
9862 pub expression: Box<Expression>,
9863}
9864
9865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9867#[cfg_attr(feature = "bindings", derive(TS))]
9868pub struct ToBoolean {
9869 pub this: 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 List {
9878 #[serde(default)]
9879 pub expressions: Vec<Expression>,
9880}
9881
9882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9887#[cfg_attr(feature = "bindings", derive(TS))]
9888pub struct ToMap {
9889 pub this: Box<Expression>,
9891}
9892
9893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9895#[cfg_attr(feature = "bindings", derive(TS))]
9896pub struct Pad {
9897 pub this: Box<Expression>,
9898 pub expression: Box<Expression>,
9899 #[serde(default)]
9900 pub fill_pattern: Option<Box<Expression>>,
9901 #[serde(default)]
9902 pub is_left: Option<Box<Expression>>,
9903}
9904
9905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9907#[cfg_attr(feature = "bindings", derive(TS))]
9908pub struct ToChar {
9909 pub this: Box<Expression>,
9910 #[serde(default)]
9911 pub format: Option<String>,
9912 #[serde(default)]
9913 pub nlsparam: Option<Box<Expression>>,
9914 #[serde(default)]
9915 pub is_numeric: Option<Box<Expression>>,
9916}
9917
9918#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9920#[cfg_attr(feature = "bindings", derive(TS))]
9921pub struct StringFunc {
9922 pub this: Box<Expression>,
9923 #[serde(default)]
9924 pub zone: Option<Box<Expression>>,
9925}
9926
9927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9929#[cfg_attr(feature = "bindings", derive(TS))]
9930pub struct ToNumber {
9931 pub this: Box<Expression>,
9932 #[serde(default)]
9933 pub format: Option<Box<Expression>>,
9934 #[serde(default)]
9935 pub nlsparam: Option<Box<Expression>>,
9936 #[serde(default)]
9937 pub precision: Option<Box<Expression>>,
9938 #[serde(default)]
9939 pub scale: Option<Box<Expression>>,
9940 #[serde(default)]
9941 pub safe: Option<Box<Expression>>,
9942 #[serde(default)]
9943 pub safe_name: Option<Box<Expression>>,
9944}
9945
9946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9948#[cfg_attr(feature = "bindings", derive(TS))]
9949pub struct ToDouble {
9950 pub this: Box<Expression>,
9951 #[serde(default)]
9952 pub format: Option<String>,
9953 #[serde(default)]
9954 pub safe: Option<Box<Expression>>,
9955}
9956
9957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9959#[cfg_attr(feature = "bindings", derive(TS))]
9960pub struct ToDecfloat {
9961 pub this: Box<Expression>,
9962 #[serde(default)]
9963 pub format: Option<String>,
9964}
9965
9966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9968#[cfg_attr(feature = "bindings", derive(TS))]
9969pub struct TryToDecfloat {
9970 pub this: Box<Expression>,
9971 #[serde(default)]
9972 pub format: Option<String>,
9973}
9974
9975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9977#[cfg_attr(feature = "bindings", derive(TS))]
9978pub struct ToFile {
9979 pub this: Box<Expression>,
9980 #[serde(default)]
9981 pub path: Option<Box<Expression>>,
9982 #[serde(default)]
9983 pub safe: Option<Box<Expression>>,
9984}
9985
9986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9988#[cfg_attr(feature = "bindings", derive(TS))]
9989pub struct Columns {
9990 pub this: Box<Expression>,
9991 #[serde(default)]
9992 pub unpack: Option<Box<Expression>>,
9993}
9994
9995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9997#[cfg_attr(feature = "bindings", derive(TS))]
9998pub struct ConvertToCharset {
9999 pub this: Box<Expression>,
10000 #[serde(default)]
10001 pub dest: Option<Box<Expression>>,
10002 #[serde(default)]
10003 pub source: Option<Box<Expression>>,
10004}
10005
10006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10008#[cfg_attr(feature = "bindings", derive(TS))]
10009pub struct ConvertTimezone {
10010 #[serde(default)]
10011 pub source_tz: Option<Box<Expression>>,
10012 #[serde(default)]
10013 pub target_tz: Option<Box<Expression>>,
10014 #[serde(default)]
10015 pub timestamp: Option<Box<Expression>>,
10016 #[serde(default)]
10017 pub options: Vec<Expression>,
10018}
10019
10020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10022#[cfg_attr(feature = "bindings", derive(TS))]
10023pub struct GenerateSeries {
10024 #[serde(default)]
10025 pub start: Option<Box<Expression>>,
10026 #[serde(default)]
10027 pub end: Option<Box<Expression>>,
10028 #[serde(default)]
10029 pub step: Option<Box<Expression>>,
10030 #[serde(default)]
10031 pub is_end_exclusive: Option<Box<Expression>>,
10032}
10033
10034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10036#[cfg_attr(feature = "bindings", derive(TS))]
10037pub struct AIAgg {
10038 pub this: Box<Expression>,
10039 pub expression: Box<Expression>,
10040}
10041
10042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10044#[cfg_attr(feature = "bindings", derive(TS))]
10045pub struct AIClassify {
10046 pub this: Box<Expression>,
10047 #[serde(default)]
10048 pub categories: Option<Box<Expression>>,
10049 #[serde(default)]
10050 pub config: Option<Box<Expression>>,
10051}
10052
10053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10055#[cfg_attr(feature = "bindings", derive(TS))]
10056pub struct ArrayAll {
10057 pub this: Box<Expression>,
10058 pub expression: Box<Expression>,
10059}
10060
10061#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10063#[cfg_attr(feature = "bindings", derive(TS))]
10064pub struct ArrayAny {
10065 pub this: Box<Expression>,
10066 pub expression: Box<Expression>,
10067}
10068
10069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10071#[cfg_attr(feature = "bindings", derive(TS))]
10072pub struct ArrayConstructCompact {
10073 #[serde(default)]
10074 pub expressions: Vec<Expression>,
10075}
10076
10077#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10079#[cfg_attr(feature = "bindings", derive(TS))]
10080pub struct StPoint {
10081 pub this: Box<Expression>,
10082 pub expression: Box<Expression>,
10083 #[serde(default)]
10084 pub null: Option<Box<Expression>>,
10085}
10086
10087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10089#[cfg_attr(feature = "bindings", derive(TS))]
10090pub struct StDistance {
10091 pub this: Box<Expression>,
10092 pub expression: Box<Expression>,
10093 #[serde(default)]
10094 pub use_spheroid: Option<Box<Expression>>,
10095}
10096
10097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10099#[cfg_attr(feature = "bindings", derive(TS))]
10100pub struct StringToArray {
10101 pub this: Box<Expression>,
10102 #[serde(default)]
10103 pub expression: Option<Box<Expression>>,
10104 #[serde(default)]
10105 pub null: Option<Box<Expression>>,
10106}
10107
10108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10110#[cfg_attr(feature = "bindings", derive(TS))]
10111pub struct ArraySum {
10112 pub this: Box<Expression>,
10113 #[serde(default)]
10114 pub expression: Option<Box<Expression>>,
10115}
10116
10117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10119#[cfg_attr(feature = "bindings", derive(TS))]
10120pub struct ObjectAgg {
10121 pub this: Box<Expression>,
10122 pub expression: Box<Expression>,
10123}
10124
10125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10127#[cfg_attr(feature = "bindings", derive(TS))]
10128pub struct CastToStrType {
10129 pub this: Box<Expression>,
10130 #[serde(default)]
10131 pub to: Option<Box<Expression>>,
10132}
10133
10134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10136#[cfg_attr(feature = "bindings", derive(TS))]
10137pub struct CheckJson {
10138 pub this: Box<Expression>,
10139}
10140
10141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10143#[cfg_attr(feature = "bindings", derive(TS))]
10144pub struct CheckXml {
10145 pub this: Box<Expression>,
10146 #[serde(default)]
10147 pub disable_auto_convert: Option<Box<Expression>>,
10148}
10149
10150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10152#[cfg_attr(feature = "bindings", derive(TS))]
10153pub struct TranslateCharacters {
10154 pub this: Box<Expression>,
10155 pub expression: Box<Expression>,
10156 #[serde(default)]
10157 pub with_error: Option<Box<Expression>>,
10158}
10159
10160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10162#[cfg_attr(feature = "bindings", derive(TS))]
10163pub struct CurrentSchemas {
10164 #[serde(default)]
10165 pub this: Option<Box<Expression>>,
10166}
10167
10168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10170#[cfg_attr(feature = "bindings", derive(TS))]
10171pub struct CurrentDatetime {
10172 #[serde(default)]
10173 pub this: Option<Box<Expression>>,
10174}
10175
10176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10178#[cfg_attr(feature = "bindings", derive(TS))]
10179pub struct Localtime {
10180 #[serde(default)]
10181 pub this: Option<Box<Expression>>,
10182}
10183
10184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10186#[cfg_attr(feature = "bindings", derive(TS))]
10187pub struct Localtimestamp {
10188 #[serde(default)]
10189 pub this: Option<Box<Expression>>,
10190}
10191
10192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10194#[cfg_attr(feature = "bindings", derive(TS))]
10195pub struct Systimestamp {
10196 #[serde(default)]
10197 pub this: Option<Box<Expression>>,
10198}
10199
10200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10202#[cfg_attr(feature = "bindings", derive(TS))]
10203pub struct CurrentSchema {
10204 #[serde(default)]
10205 pub this: Option<Box<Expression>>,
10206}
10207
10208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10210#[cfg_attr(feature = "bindings", derive(TS))]
10211pub struct CurrentUser {
10212 #[serde(default)]
10213 pub this: Option<Box<Expression>>,
10214}
10215
10216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10218#[cfg_attr(feature = "bindings", derive(TS))]
10219pub struct SessionUser;
10220
10221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10223#[cfg_attr(feature = "bindings", derive(TS))]
10224pub struct JSONPathRoot;
10225
10226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10228#[cfg_attr(feature = "bindings", derive(TS))]
10229pub struct UtcTime {
10230 #[serde(default)]
10231 pub this: Option<Box<Expression>>,
10232}
10233
10234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10236#[cfg_attr(feature = "bindings", derive(TS))]
10237pub struct UtcTimestamp {
10238 #[serde(default)]
10239 pub this: Option<Box<Expression>>,
10240}
10241
10242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10244#[cfg_attr(feature = "bindings", derive(TS))]
10245pub struct TimestampFunc {
10246 #[serde(default)]
10247 pub this: Option<Box<Expression>>,
10248 #[serde(default)]
10249 pub zone: Option<Box<Expression>>,
10250 #[serde(default)]
10251 pub with_tz: Option<bool>,
10252 #[serde(default)]
10253 pub safe: Option<bool>,
10254}
10255
10256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10258#[cfg_attr(feature = "bindings", derive(TS))]
10259pub struct DateBin {
10260 pub this: Box<Expression>,
10261 pub expression: Box<Expression>,
10262 #[serde(default)]
10263 pub unit: Option<String>,
10264 #[serde(default)]
10265 pub zone: Option<Box<Expression>>,
10266 #[serde(default)]
10267 pub origin: Option<Box<Expression>>,
10268}
10269
10270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10272#[cfg_attr(feature = "bindings", derive(TS))]
10273pub struct Datetime {
10274 pub this: Box<Expression>,
10275 #[serde(default)]
10276 pub expression: Option<Box<Expression>>,
10277}
10278
10279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10281#[cfg_attr(feature = "bindings", derive(TS))]
10282pub struct DatetimeAdd {
10283 pub this: Box<Expression>,
10284 pub expression: Box<Expression>,
10285 #[serde(default)]
10286 pub unit: Option<String>,
10287}
10288
10289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10291#[cfg_attr(feature = "bindings", derive(TS))]
10292pub struct DatetimeSub {
10293 pub this: Box<Expression>,
10294 pub expression: Box<Expression>,
10295 #[serde(default)]
10296 pub unit: Option<String>,
10297}
10298
10299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10301#[cfg_attr(feature = "bindings", derive(TS))]
10302pub struct DatetimeDiff {
10303 pub this: Box<Expression>,
10304 pub expression: Box<Expression>,
10305 #[serde(default)]
10306 pub unit: Option<String>,
10307}
10308
10309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10311#[cfg_attr(feature = "bindings", derive(TS))]
10312pub struct DatetimeTrunc {
10313 pub this: Box<Expression>,
10314 pub unit: String,
10315 #[serde(default)]
10316 pub zone: Option<Box<Expression>>,
10317}
10318
10319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10321#[cfg_attr(feature = "bindings", derive(TS))]
10322pub struct Dayname {
10323 pub this: Box<Expression>,
10324 #[serde(default)]
10325 pub abbreviated: Option<Box<Expression>>,
10326}
10327
10328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10330#[cfg_attr(feature = "bindings", derive(TS))]
10331pub struct MakeInterval {
10332 #[serde(default)]
10333 pub year: Option<Box<Expression>>,
10334 #[serde(default)]
10335 pub month: Option<Box<Expression>>,
10336 #[serde(default)]
10337 pub week: Option<Box<Expression>>,
10338 #[serde(default)]
10339 pub day: Option<Box<Expression>>,
10340 #[serde(default)]
10341 pub hour: Option<Box<Expression>>,
10342 #[serde(default)]
10343 pub minute: Option<Box<Expression>>,
10344 #[serde(default)]
10345 pub second: Option<Box<Expression>>,
10346}
10347
10348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10350#[cfg_attr(feature = "bindings", derive(TS))]
10351pub struct PreviousDay {
10352 pub this: Box<Expression>,
10353 pub expression: Box<Expression>,
10354}
10355
10356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10358#[cfg_attr(feature = "bindings", derive(TS))]
10359pub struct Elt {
10360 pub this: Box<Expression>,
10361 #[serde(default)]
10362 pub expressions: Vec<Expression>,
10363}
10364
10365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10367#[cfg_attr(feature = "bindings", derive(TS))]
10368pub struct TimestampAdd {
10369 pub this: Box<Expression>,
10370 pub expression: Box<Expression>,
10371 #[serde(default)]
10372 pub unit: Option<String>,
10373}
10374
10375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10377#[cfg_attr(feature = "bindings", derive(TS))]
10378pub struct TimestampSub {
10379 pub this: Box<Expression>,
10380 pub expression: Box<Expression>,
10381 #[serde(default)]
10382 pub unit: Option<String>,
10383}
10384
10385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10387#[cfg_attr(feature = "bindings", derive(TS))]
10388pub struct TimestampDiff {
10389 pub this: Box<Expression>,
10390 pub expression: Box<Expression>,
10391 #[serde(default)]
10392 pub unit: Option<String>,
10393}
10394
10395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10397#[cfg_attr(feature = "bindings", derive(TS))]
10398pub struct TimeSlice {
10399 pub this: Box<Expression>,
10400 pub expression: Box<Expression>,
10401 pub unit: String,
10402 #[serde(default)]
10403 pub kind: Option<String>,
10404}
10405
10406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10408#[cfg_attr(feature = "bindings", derive(TS))]
10409pub struct TimeAdd {
10410 pub this: Box<Expression>,
10411 pub expression: Box<Expression>,
10412 #[serde(default)]
10413 pub unit: Option<String>,
10414}
10415
10416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10418#[cfg_attr(feature = "bindings", derive(TS))]
10419pub struct TimeSub {
10420 pub this: Box<Expression>,
10421 pub expression: Box<Expression>,
10422 #[serde(default)]
10423 pub unit: Option<String>,
10424}
10425
10426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10428#[cfg_attr(feature = "bindings", derive(TS))]
10429pub struct TimeDiff {
10430 pub this: Box<Expression>,
10431 pub expression: Box<Expression>,
10432 #[serde(default)]
10433 pub unit: Option<String>,
10434}
10435
10436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10438#[cfg_attr(feature = "bindings", derive(TS))]
10439pub struct TimeTrunc {
10440 pub this: Box<Expression>,
10441 pub unit: String,
10442 #[serde(default)]
10443 pub zone: Option<Box<Expression>>,
10444}
10445
10446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10448#[cfg_attr(feature = "bindings", derive(TS))]
10449pub struct DateFromParts {
10450 #[serde(default)]
10451 pub year: Option<Box<Expression>>,
10452 #[serde(default)]
10453 pub month: Option<Box<Expression>>,
10454 #[serde(default)]
10455 pub day: Option<Box<Expression>>,
10456 #[serde(default)]
10457 pub allow_overflow: Option<Box<Expression>>,
10458}
10459
10460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10462#[cfg_attr(feature = "bindings", derive(TS))]
10463pub struct TimeFromParts {
10464 #[serde(default)]
10465 pub hour: Option<Box<Expression>>,
10466 #[serde(default)]
10467 pub min: Option<Box<Expression>>,
10468 #[serde(default)]
10469 pub sec: Option<Box<Expression>>,
10470 #[serde(default)]
10471 pub nano: Option<Box<Expression>>,
10472 #[serde(default)]
10473 pub fractions: Option<Box<Expression>>,
10474 #[serde(default)]
10475 pub precision: Option<i64>,
10476}
10477
10478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10480#[cfg_attr(feature = "bindings", derive(TS))]
10481pub struct DecodeCase {
10482 #[serde(default)]
10483 pub expressions: Vec<Expression>,
10484}
10485
10486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10488#[cfg_attr(feature = "bindings", derive(TS))]
10489pub struct Decrypt {
10490 pub this: Box<Expression>,
10491 #[serde(default)]
10492 pub passphrase: Option<Box<Expression>>,
10493 #[serde(default)]
10494 pub aad: Option<Box<Expression>>,
10495 #[serde(default)]
10496 pub encryption_method: Option<Box<Expression>>,
10497 #[serde(default)]
10498 pub safe: Option<Box<Expression>>,
10499}
10500
10501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10503#[cfg_attr(feature = "bindings", derive(TS))]
10504pub struct DecryptRaw {
10505 pub this: Box<Expression>,
10506 #[serde(default)]
10507 pub key: Option<Box<Expression>>,
10508 #[serde(default)]
10509 pub iv: Option<Box<Expression>>,
10510 #[serde(default)]
10511 pub aad: Option<Box<Expression>>,
10512 #[serde(default)]
10513 pub encryption_method: Option<Box<Expression>>,
10514 #[serde(default)]
10515 pub aead: Option<Box<Expression>>,
10516 #[serde(default)]
10517 pub safe: Option<Box<Expression>>,
10518}
10519
10520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10522#[cfg_attr(feature = "bindings", derive(TS))]
10523pub struct Encode {
10524 pub this: Box<Expression>,
10525 #[serde(default)]
10526 pub charset: Option<Box<Expression>>,
10527}
10528
10529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10531#[cfg_attr(feature = "bindings", derive(TS))]
10532pub struct Encrypt {
10533 pub this: Box<Expression>,
10534 #[serde(default)]
10535 pub passphrase: Option<Box<Expression>>,
10536 #[serde(default)]
10537 pub aad: Option<Box<Expression>>,
10538 #[serde(default)]
10539 pub encryption_method: Option<Box<Expression>>,
10540}
10541
10542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10544#[cfg_attr(feature = "bindings", derive(TS))]
10545pub struct EncryptRaw {
10546 pub this: Box<Expression>,
10547 #[serde(default)]
10548 pub key: Option<Box<Expression>>,
10549 #[serde(default)]
10550 pub iv: Option<Box<Expression>>,
10551 #[serde(default)]
10552 pub aad: Option<Box<Expression>>,
10553 #[serde(default)]
10554 pub encryption_method: Option<Box<Expression>>,
10555}
10556
10557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10559#[cfg_attr(feature = "bindings", derive(TS))]
10560pub struct EqualNull {
10561 pub this: Box<Expression>,
10562 pub expression: Box<Expression>,
10563}
10564
10565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10567#[cfg_attr(feature = "bindings", derive(TS))]
10568pub struct ToBinary {
10569 pub this: Box<Expression>,
10570 #[serde(default)]
10571 pub format: Option<String>,
10572 #[serde(default)]
10573 pub safe: Option<Box<Expression>>,
10574}
10575
10576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10578#[cfg_attr(feature = "bindings", derive(TS))]
10579pub struct Base64DecodeBinary {
10580 pub this: Box<Expression>,
10581 #[serde(default)]
10582 pub alphabet: Option<Box<Expression>>,
10583}
10584
10585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10587#[cfg_attr(feature = "bindings", derive(TS))]
10588pub struct Base64DecodeString {
10589 pub this: Box<Expression>,
10590 #[serde(default)]
10591 pub alphabet: Option<Box<Expression>>,
10592}
10593
10594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10596#[cfg_attr(feature = "bindings", derive(TS))]
10597pub struct Base64Encode {
10598 pub this: Box<Expression>,
10599 #[serde(default)]
10600 pub max_line_length: Option<Box<Expression>>,
10601 #[serde(default)]
10602 pub alphabet: Option<Box<Expression>>,
10603}
10604
10605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10607#[cfg_attr(feature = "bindings", derive(TS))]
10608pub struct TryBase64DecodeBinary {
10609 pub this: Box<Expression>,
10610 #[serde(default)]
10611 pub alphabet: Option<Box<Expression>>,
10612}
10613
10614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10616#[cfg_attr(feature = "bindings", derive(TS))]
10617pub struct TryBase64DecodeString {
10618 pub this: Box<Expression>,
10619 #[serde(default)]
10620 pub alphabet: Option<Box<Expression>>,
10621}
10622
10623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10625#[cfg_attr(feature = "bindings", derive(TS))]
10626pub struct GapFill {
10627 pub this: Box<Expression>,
10628 #[serde(default)]
10629 pub ts_column: Option<Box<Expression>>,
10630 #[serde(default)]
10631 pub bucket_width: Option<Box<Expression>>,
10632 #[serde(default)]
10633 pub partitioning_columns: Option<Box<Expression>>,
10634 #[serde(default)]
10635 pub value_columns: Option<Box<Expression>>,
10636 #[serde(default)]
10637 pub origin: Option<Box<Expression>>,
10638 #[serde(default)]
10639 pub ignore_nulls: Option<Box<Expression>>,
10640}
10641
10642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10644#[cfg_attr(feature = "bindings", derive(TS))]
10645pub struct GenerateDateArray {
10646 #[serde(default)]
10647 pub start: Option<Box<Expression>>,
10648 #[serde(default)]
10649 pub end: Option<Box<Expression>>,
10650 #[serde(default)]
10651 pub step: Option<Box<Expression>>,
10652}
10653
10654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10656#[cfg_attr(feature = "bindings", derive(TS))]
10657pub struct GenerateTimestampArray {
10658 #[serde(default)]
10659 pub start: Option<Box<Expression>>,
10660 #[serde(default)]
10661 pub end: Option<Box<Expression>>,
10662 #[serde(default)]
10663 pub step: Option<Box<Expression>>,
10664}
10665
10666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10668#[cfg_attr(feature = "bindings", derive(TS))]
10669pub struct GetExtract {
10670 pub this: Box<Expression>,
10671 pub expression: Box<Expression>,
10672}
10673
10674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10676#[cfg_attr(feature = "bindings", derive(TS))]
10677pub struct Getbit {
10678 pub this: Box<Expression>,
10679 pub expression: Box<Expression>,
10680 #[serde(default)]
10681 pub zero_is_msb: Option<Box<Expression>>,
10682}
10683
10684#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10686#[cfg_attr(feature = "bindings", derive(TS))]
10687pub struct OverflowTruncateBehavior {
10688 #[serde(default)]
10689 pub this: Option<Box<Expression>>,
10690 #[serde(default)]
10691 pub with_count: Option<Box<Expression>>,
10692}
10693
10694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10696#[cfg_attr(feature = "bindings", derive(TS))]
10697pub struct HexEncode {
10698 pub this: Box<Expression>,
10699 #[serde(default)]
10700 pub case: Option<Box<Expression>>,
10701}
10702
10703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10705#[cfg_attr(feature = "bindings", derive(TS))]
10706pub struct Compress {
10707 pub this: Box<Expression>,
10708 #[serde(default)]
10709 pub method: Option<String>,
10710}
10711
10712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10714#[cfg_attr(feature = "bindings", derive(TS))]
10715pub struct DecompressBinary {
10716 pub this: Box<Expression>,
10717 pub method: String,
10718}
10719
10720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10722#[cfg_attr(feature = "bindings", derive(TS))]
10723pub struct DecompressString {
10724 pub this: Box<Expression>,
10725 pub method: String,
10726}
10727
10728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10730#[cfg_attr(feature = "bindings", derive(TS))]
10731pub struct Xor {
10732 #[serde(default)]
10733 pub this: Option<Box<Expression>>,
10734 #[serde(default)]
10735 pub expression: Option<Box<Expression>>,
10736 #[serde(default)]
10737 pub expressions: Vec<Expression>,
10738}
10739
10740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10742#[cfg_attr(feature = "bindings", derive(TS))]
10743pub struct Nullif {
10744 pub this: Box<Expression>,
10745 pub expression: Box<Expression>,
10746}
10747
10748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10750#[cfg_attr(feature = "bindings", derive(TS))]
10751pub struct JSON {
10752 #[serde(default)]
10753 pub this: Option<Box<Expression>>,
10754 #[serde(default)]
10755 pub with_: Option<Box<Expression>>,
10756 #[serde(default)]
10757 pub unique: bool,
10758}
10759
10760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10762#[cfg_attr(feature = "bindings", derive(TS))]
10763pub struct JSONPath {
10764 #[serde(default)]
10765 pub expressions: Vec<Expression>,
10766 #[serde(default)]
10767 pub escape: Option<Box<Expression>>,
10768}
10769
10770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10772#[cfg_attr(feature = "bindings", derive(TS))]
10773pub struct JSONPathFilter {
10774 pub this: Box<Expression>,
10775}
10776
10777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10779#[cfg_attr(feature = "bindings", derive(TS))]
10780pub struct JSONPathKey {
10781 pub this: Box<Expression>,
10782}
10783
10784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10786#[cfg_attr(feature = "bindings", derive(TS))]
10787pub struct JSONPathRecursive {
10788 #[serde(default)]
10789 pub this: Option<Box<Expression>>,
10790}
10791
10792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10794#[cfg_attr(feature = "bindings", derive(TS))]
10795pub struct JSONPathScript {
10796 pub this: Box<Expression>,
10797}
10798
10799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10801#[cfg_attr(feature = "bindings", derive(TS))]
10802pub struct JSONPathSlice {
10803 #[serde(default)]
10804 pub start: Option<Box<Expression>>,
10805 #[serde(default)]
10806 pub end: Option<Box<Expression>>,
10807 #[serde(default)]
10808 pub step: Option<Box<Expression>>,
10809}
10810
10811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10813#[cfg_attr(feature = "bindings", derive(TS))]
10814pub struct JSONPathSelector {
10815 pub this: Box<Expression>,
10816}
10817
10818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10820#[cfg_attr(feature = "bindings", derive(TS))]
10821pub struct JSONPathSubscript {
10822 pub this: Box<Expression>,
10823}
10824
10825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10827#[cfg_attr(feature = "bindings", derive(TS))]
10828pub struct JSONPathUnion {
10829 #[serde(default)]
10830 pub expressions: Vec<Expression>,
10831}
10832
10833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10835#[cfg_attr(feature = "bindings", derive(TS))]
10836pub struct Format {
10837 pub this: Box<Expression>,
10838 #[serde(default)]
10839 pub expressions: Vec<Expression>,
10840}
10841
10842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10844#[cfg_attr(feature = "bindings", derive(TS))]
10845pub struct JSONKeys {
10846 pub this: Box<Expression>,
10847 #[serde(default)]
10848 pub expression: Option<Box<Expression>>,
10849 #[serde(default)]
10850 pub expressions: Vec<Expression>,
10851}
10852
10853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10855#[cfg_attr(feature = "bindings", derive(TS))]
10856pub struct JSONKeyValue {
10857 pub this: Box<Expression>,
10858 pub expression: Box<Expression>,
10859}
10860
10861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10863#[cfg_attr(feature = "bindings", derive(TS))]
10864pub struct JSONKeysAtDepth {
10865 pub this: Box<Expression>,
10866 #[serde(default)]
10867 pub expression: Option<Box<Expression>>,
10868 #[serde(default)]
10869 pub mode: Option<Box<Expression>>,
10870}
10871
10872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10874#[cfg_attr(feature = "bindings", derive(TS))]
10875pub struct JSONObject {
10876 #[serde(default)]
10877 pub expressions: Vec<Expression>,
10878 #[serde(default)]
10879 pub null_handling: Option<Box<Expression>>,
10880 #[serde(default)]
10881 pub unique_keys: Option<Box<Expression>>,
10882 #[serde(default)]
10883 pub return_type: Option<Box<Expression>>,
10884 #[serde(default)]
10885 pub encoding: Option<Box<Expression>>,
10886}
10887
10888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10890#[cfg_attr(feature = "bindings", derive(TS))]
10891pub struct JSONObjectAgg {
10892 #[serde(default)]
10893 pub expressions: Vec<Expression>,
10894 #[serde(default)]
10895 pub null_handling: Option<Box<Expression>>,
10896 #[serde(default)]
10897 pub unique_keys: Option<Box<Expression>>,
10898 #[serde(default)]
10899 pub return_type: Option<Box<Expression>>,
10900 #[serde(default)]
10901 pub encoding: Option<Box<Expression>>,
10902}
10903
10904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10906#[cfg_attr(feature = "bindings", derive(TS))]
10907pub struct JSONBObjectAgg {
10908 pub this: Box<Expression>,
10909 pub expression: Box<Expression>,
10910}
10911
10912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10914#[cfg_attr(feature = "bindings", derive(TS))]
10915pub struct JSONArray {
10916 #[serde(default)]
10917 pub expressions: Vec<Expression>,
10918 #[serde(default)]
10919 pub null_handling: Option<Box<Expression>>,
10920 #[serde(default)]
10921 pub return_type: Option<Box<Expression>>,
10922 #[serde(default)]
10923 pub strict: Option<Box<Expression>>,
10924}
10925
10926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10928#[cfg_attr(feature = "bindings", derive(TS))]
10929pub struct JSONArrayAgg {
10930 pub this: Box<Expression>,
10931 #[serde(default)]
10932 pub order: Option<Box<Expression>>,
10933 #[serde(default)]
10934 pub null_handling: Option<Box<Expression>>,
10935 #[serde(default)]
10936 pub return_type: Option<Box<Expression>>,
10937 #[serde(default)]
10938 pub strict: Option<Box<Expression>>,
10939}
10940
10941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10943#[cfg_attr(feature = "bindings", derive(TS))]
10944pub struct JSONExists {
10945 pub this: Box<Expression>,
10946 #[serde(default)]
10947 pub path: Option<Box<Expression>>,
10948 #[serde(default)]
10949 pub passing: Option<Box<Expression>>,
10950 #[serde(default)]
10951 pub on_condition: Option<Box<Expression>>,
10952 #[serde(default)]
10953 pub from_dcolonqmark: Option<Box<Expression>>,
10954}
10955
10956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10958#[cfg_attr(feature = "bindings", derive(TS))]
10959pub struct JSONColumnDef {
10960 #[serde(default)]
10961 pub this: Option<Box<Expression>>,
10962 #[serde(default)]
10963 pub kind: Option<String>,
10964 #[serde(default)]
10965 pub path: Option<Box<Expression>>,
10966 #[serde(default)]
10967 pub nested_schema: Option<Box<Expression>>,
10968 #[serde(default)]
10969 pub ordinality: Option<Box<Expression>>,
10970}
10971
10972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10974#[cfg_attr(feature = "bindings", derive(TS))]
10975pub struct JSONSchema {
10976 #[serde(default)]
10977 pub expressions: Vec<Expression>,
10978}
10979
10980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10982#[cfg_attr(feature = "bindings", derive(TS))]
10983pub struct JSONSet {
10984 pub this: Box<Expression>,
10985 #[serde(default)]
10986 pub expressions: Vec<Expression>,
10987}
10988
10989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10991#[cfg_attr(feature = "bindings", derive(TS))]
10992pub struct JSONStripNulls {
10993 pub this: Box<Expression>,
10994 #[serde(default)]
10995 pub expression: Option<Box<Expression>>,
10996 #[serde(default)]
10997 pub include_arrays: Option<Box<Expression>>,
10998 #[serde(default)]
10999 pub remove_empty: Option<Box<Expression>>,
11000}
11001
11002#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11004#[cfg_attr(feature = "bindings", derive(TS))]
11005pub struct JSONValue {
11006 pub this: Box<Expression>,
11007 #[serde(default)]
11008 pub path: Option<Box<Expression>>,
11009 #[serde(default)]
11010 pub returning: Option<Box<Expression>>,
11011 #[serde(default)]
11012 pub on_condition: Option<Box<Expression>>,
11013}
11014
11015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11017#[cfg_attr(feature = "bindings", derive(TS))]
11018pub struct JSONValueArray {
11019 pub this: Box<Expression>,
11020 #[serde(default)]
11021 pub expression: Option<Box<Expression>>,
11022}
11023
11024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11026#[cfg_attr(feature = "bindings", derive(TS))]
11027pub struct JSONRemove {
11028 pub this: Box<Expression>,
11029 #[serde(default)]
11030 pub expressions: Vec<Expression>,
11031}
11032
11033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11035#[cfg_attr(feature = "bindings", derive(TS))]
11036pub struct JSONTable {
11037 pub this: Box<Expression>,
11038 #[serde(default)]
11039 pub schema: Option<Box<Expression>>,
11040 #[serde(default)]
11041 pub path: Option<Box<Expression>>,
11042 #[serde(default)]
11043 pub error_handling: Option<Box<Expression>>,
11044 #[serde(default)]
11045 pub empty_handling: Option<Box<Expression>>,
11046}
11047
11048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11050#[cfg_attr(feature = "bindings", derive(TS))]
11051pub struct JSONType {
11052 pub this: Box<Expression>,
11053 #[serde(default)]
11054 pub expression: Option<Box<Expression>>,
11055}
11056
11057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11059#[cfg_attr(feature = "bindings", derive(TS))]
11060pub struct ObjectInsert {
11061 pub this: Box<Expression>,
11062 #[serde(default)]
11063 pub key: Option<Box<Expression>>,
11064 #[serde(default)]
11065 pub value: Option<Box<Expression>>,
11066 #[serde(default)]
11067 pub update_flag: Option<Box<Expression>>,
11068}
11069
11070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11072#[cfg_attr(feature = "bindings", derive(TS))]
11073pub struct OpenJSONColumnDef {
11074 pub this: Box<Expression>,
11075 pub kind: String,
11076 #[serde(default)]
11077 pub path: Option<Box<Expression>>,
11078 #[serde(default)]
11079 pub as_json: Option<Box<Expression>>,
11080 #[serde(default, skip_serializing_if = "Option::is_none")]
11082 pub data_type: Option<DataType>,
11083}
11084
11085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11087#[cfg_attr(feature = "bindings", derive(TS))]
11088pub struct OpenJSON {
11089 pub this: Box<Expression>,
11090 #[serde(default)]
11091 pub path: Option<Box<Expression>>,
11092 #[serde(default)]
11093 pub expressions: Vec<Expression>,
11094}
11095
11096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11098#[cfg_attr(feature = "bindings", derive(TS))]
11099pub struct JSONBExists {
11100 pub this: Box<Expression>,
11101 #[serde(default)]
11102 pub path: Option<Box<Expression>>,
11103}
11104
11105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11107#[cfg_attr(feature = "bindings", derive(TS))]
11108pub struct JSONCast {
11109 pub this: Box<Expression>,
11110 pub to: DataType,
11111}
11112
11113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11115#[cfg_attr(feature = "bindings", derive(TS))]
11116pub struct JSONExtract {
11117 pub this: Box<Expression>,
11118 pub expression: Box<Expression>,
11119 #[serde(default)]
11120 pub only_json_types: Option<Box<Expression>>,
11121 #[serde(default)]
11122 pub expressions: Vec<Expression>,
11123 #[serde(default)]
11124 pub variant_extract: Option<Box<Expression>>,
11125 #[serde(default)]
11126 pub json_query: Option<Box<Expression>>,
11127 #[serde(default)]
11128 pub option: Option<Box<Expression>>,
11129 #[serde(default)]
11130 pub quote: Option<Box<Expression>>,
11131 #[serde(default)]
11132 pub on_condition: Option<Box<Expression>>,
11133 #[serde(default)]
11134 pub requires_json: Option<Box<Expression>>,
11135}
11136
11137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11139#[cfg_attr(feature = "bindings", derive(TS))]
11140pub struct JSONExtractQuote {
11141 #[serde(default)]
11142 pub option: Option<Box<Expression>>,
11143 #[serde(default)]
11144 pub scalar: Option<Box<Expression>>,
11145}
11146
11147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11149#[cfg_attr(feature = "bindings", derive(TS))]
11150pub struct JSONExtractArray {
11151 pub this: Box<Expression>,
11152 #[serde(default)]
11153 pub expression: Option<Box<Expression>>,
11154}
11155
11156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11158#[cfg_attr(feature = "bindings", derive(TS))]
11159pub struct JSONExtractScalar {
11160 pub this: Box<Expression>,
11161 pub expression: Box<Expression>,
11162 #[serde(default)]
11163 pub only_json_types: Option<Box<Expression>>,
11164 #[serde(default)]
11165 pub expressions: Vec<Expression>,
11166 #[serde(default)]
11167 pub json_type: Option<Box<Expression>>,
11168 #[serde(default)]
11169 pub scalar_only: Option<Box<Expression>>,
11170}
11171
11172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11174#[cfg_attr(feature = "bindings", derive(TS))]
11175pub struct JSONBExtractScalar {
11176 pub this: Box<Expression>,
11177 pub expression: Box<Expression>,
11178 #[serde(default)]
11179 pub json_type: Option<Box<Expression>>,
11180}
11181
11182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11184#[cfg_attr(feature = "bindings", derive(TS))]
11185pub struct JSONFormat {
11186 #[serde(default)]
11187 pub this: Option<Box<Expression>>,
11188 #[serde(default)]
11189 pub options: Vec<Expression>,
11190 #[serde(default)]
11191 pub is_json: Option<Box<Expression>>,
11192 #[serde(default)]
11193 pub to_json: Option<Box<Expression>>,
11194}
11195
11196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11198#[cfg_attr(feature = "bindings", derive(TS))]
11199pub struct JSONArrayAppend {
11200 pub this: Box<Expression>,
11201 #[serde(default)]
11202 pub expressions: Vec<Expression>,
11203}
11204
11205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11207#[cfg_attr(feature = "bindings", derive(TS))]
11208pub struct JSONArrayContains {
11209 pub this: Box<Expression>,
11210 pub expression: Box<Expression>,
11211 #[serde(default)]
11212 pub json_type: Option<Box<Expression>>,
11213}
11214
11215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11217#[cfg_attr(feature = "bindings", derive(TS))]
11218pub struct JSONArrayInsert {
11219 pub this: Box<Expression>,
11220 #[serde(default)]
11221 pub expressions: Vec<Expression>,
11222}
11223
11224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11226#[cfg_attr(feature = "bindings", derive(TS))]
11227pub struct ParseJSON {
11228 pub this: Box<Expression>,
11229 #[serde(default)]
11230 pub expression: Option<Box<Expression>>,
11231 #[serde(default)]
11232 pub safe: Option<Box<Expression>>,
11233}
11234
11235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11237#[cfg_attr(feature = "bindings", derive(TS))]
11238pub struct ParseUrl {
11239 pub this: Box<Expression>,
11240 #[serde(default)]
11241 pub part_to_extract: Option<Box<Expression>>,
11242 #[serde(default)]
11243 pub key: Option<Box<Expression>>,
11244 #[serde(default)]
11245 pub permissive: Option<Box<Expression>>,
11246}
11247
11248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11250#[cfg_attr(feature = "bindings", derive(TS))]
11251pub struct ParseIp {
11252 pub this: Box<Expression>,
11253 #[serde(default)]
11254 pub type_: Option<Box<Expression>>,
11255 #[serde(default)]
11256 pub permissive: Option<Box<Expression>>,
11257}
11258
11259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11261#[cfg_attr(feature = "bindings", derive(TS))]
11262pub struct ParseTime {
11263 pub this: Box<Expression>,
11264 pub format: String,
11265}
11266
11267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11269#[cfg_attr(feature = "bindings", derive(TS))]
11270pub struct ParseDatetime {
11271 pub this: Box<Expression>,
11272 #[serde(default)]
11273 pub format: Option<String>,
11274 #[serde(default)]
11275 pub zone: Option<Box<Expression>>,
11276}
11277
11278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11280#[cfg_attr(feature = "bindings", derive(TS))]
11281pub struct Map {
11282 #[serde(default)]
11283 pub keys: Vec<Expression>,
11284 #[serde(default)]
11285 pub values: Vec<Expression>,
11286}
11287
11288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11290#[cfg_attr(feature = "bindings", derive(TS))]
11291pub struct MapCat {
11292 pub this: Box<Expression>,
11293 pub expression: Box<Expression>,
11294}
11295
11296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11298#[cfg_attr(feature = "bindings", derive(TS))]
11299pub struct MapDelete {
11300 pub this: Box<Expression>,
11301 #[serde(default)]
11302 pub expressions: Vec<Expression>,
11303}
11304
11305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11307#[cfg_attr(feature = "bindings", derive(TS))]
11308pub struct MapInsert {
11309 pub this: Box<Expression>,
11310 #[serde(default)]
11311 pub key: Option<Box<Expression>>,
11312 #[serde(default)]
11313 pub value: Option<Box<Expression>>,
11314 #[serde(default)]
11315 pub update_flag: Option<Box<Expression>>,
11316}
11317
11318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11320#[cfg_attr(feature = "bindings", derive(TS))]
11321pub struct MapPick {
11322 pub this: Box<Expression>,
11323 #[serde(default)]
11324 pub expressions: Vec<Expression>,
11325}
11326
11327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11329#[cfg_attr(feature = "bindings", derive(TS))]
11330pub struct ScopeResolution {
11331 #[serde(default)]
11332 pub this: Option<Box<Expression>>,
11333 pub expression: Box<Expression>,
11334}
11335
11336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11338#[cfg_attr(feature = "bindings", derive(TS))]
11339pub struct Slice {
11340 #[serde(default)]
11341 pub this: Option<Box<Expression>>,
11342 #[serde(default)]
11343 pub expression: Option<Box<Expression>>,
11344 #[serde(default)]
11345 pub step: Option<Box<Expression>>,
11346}
11347
11348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11350#[cfg_attr(feature = "bindings", derive(TS))]
11351pub struct VarMap {
11352 #[serde(default)]
11353 pub keys: Vec<Expression>,
11354 #[serde(default)]
11355 pub values: Vec<Expression>,
11356}
11357
11358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11360#[cfg_attr(feature = "bindings", derive(TS))]
11361pub struct MatchAgainst {
11362 pub this: Box<Expression>,
11363 #[serde(default)]
11364 pub expressions: Vec<Expression>,
11365 #[serde(default)]
11366 pub modifier: Option<Box<Expression>>,
11367}
11368
11369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11371#[cfg_attr(feature = "bindings", derive(TS))]
11372pub struct MD5Digest {
11373 pub this: Box<Expression>,
11374 #[serde(default)]
11375 pub expressions: Vec<Expression>,
11376}
11377
11378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11380#[cfg_attr(feature = "bindings", derive(TS))]
11381pub struct Monthname {
11382 pub this: Box<Expression>,
11383 #[serde(default)]
11384 pub abbreviated: Option<Box<Expression>>,
11385}
11386
11387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11389#[cfg_attr(feature = "bindings", derive(TS))]
11390pub struct Ntile {
11391 #[serde(default)]
11392 pub this: Option<Box<Expression>>,
11393}
11394
11395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11397#[cfg_attr(feature = "bindings", derive(TS))]
11398pub struct Normalize {
11399 pub this: Box<Expression>,
11400 #[serde(default)]
11401 pub form: Option<Box<Expression>>,
11402 #[serde(default)]
11403 pub is_casefold: Option<Box<Expression>>,
11404}
11405
11406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11408#[cfg_attr(feature = "bindings", derive(TS))]
11409pub struct Normal {
11410 pub this: Box<Expression>,
11411 #[serde(default)]
11412 pub stddev: Option<Box<Expression>>,
11413 #[serde(default)]
11414 pub gen: Option<Box<Expression>>,
11415}
11416
11417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11419#[cfg_attr(feature = "bindings", derive(TS))]
11420pub struct Predict {
11421 pub this: Box<Expression>,
11422 pub expression: Box<Expression>,
11423 #[serde(default)]
11424 pub params_struct: Option<Box<Expression>>,
11425}
11426
11427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11429#[cfg_attr(feature = "bindings", derive(TS))]
11430pub struct MLTranslate {
11431 pub this: Box<Expression>,
11432 pub expression: Box<Expression>,
11433 #[serde(default)]
11434 pub params_struct: Option<Box<Expression>>,
11435}
11436
11437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11439#[cfg_attr(feature = "bindings", derive(TS))]
11440pub struct FeaturesAtTime {
11441 pub this: Box<Expression>,
11442 #[serde(default)]
11443 pub time: Option<Box<Expression>>,
11444 #[serde(default)]
11445 pub num_rows: Option<Box<Expression>>,
11446 #[serde(default)]
11447 pub ignore_feature_nulls: Option<Box<Expression>>,
11448}
11449
11450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11452#[cfg_attr(feature = "bindings", derive(TS))]
11453pub struct GenerateEmbedding {
11454 pub this: Box<Expression>,
11455 pub expression: Box<Expression>,
11456 #[serde(default)]
11457 pub params_struct: Option<Box<Expression>>,
11458 #[serde(default)]
11459 pub is_text: Option<Box<Expression>>,
11460}
11461
11462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11464#[cfg_attr(feature = "bindings", derive(TS))]
11465pub struct MLForecast {
11466 pub this: Box<Expression>,
11467 #[serde(default)]
11468 pub expression: Option<Box<Expression>>,
11469 #[serde(default)]
11470 pub params_struct: Option<Box<Expression>>,
11471}
11472
11473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11475#[cfg_attr(feature = "bindings", derive(TS))]
11476pub struct ModelAttribute {
11477 pub this: Box<Expression>,
11478 pub expression: Box<Expression>,
11479}
11480
11481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11483#[cfg_attr(feature = "bindings", derive(TS))]
11484pub struct VectorSearch {
11485 pub this: Box<Expression>,
11486 #[serde(default)]
11487 pub column_to_search: Option<Box<Expression>>,
11488 #[serde(default)]
11489 pub query_table: Option<Box<Expression>>,
11490 #[serde(default)]
11491 pub query_column_to_search: Option<Box<Expression>>,
11492 #[serde(default)]
11493 pub top_k: Option<Box<Expression>>,
11494 #[serde(default)]
11495 pub distance_type: Option<Box<Expression>>,
11496 #[serde(default)]
11497 pub options: Vec<Expression>,
11498}
11499
11500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11502#[cfg_attr(feature = "bindings", derive(TS))]
11503pub struct Quantile {
11504 pub this: Box<Expression>,
11505 #[serde(default)]
11506 pub quantile: Option<Box<Expression>>,
11507}
11508
11509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11511#[cfg_attr(feature = "bindings", derive(TS))]
11512pub struct ApproxQuantile {
11513 pub this: Box<Expression>,
11514 #[serde(default)]
11515 pub quantile: Option<Box<Expression>>,
11516 #[serde(default)]
11517 pub accuracy: Option<Box<Expression>>,
11518 #[serde(default)]
11519 pub weight: Option<Box<Expression>>,
11520 #[serde(default)]
11521 pub error_tolerance: Option<Box<Expression>>,
11522}
11523
11524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11526#[cfg_attr(feature = "bindings", derive(TS))]
11527pub struct ApproxPercentileEstimate {
11528 pub this: Box<Expression>,
11529 #[serde(default)]
11530 pub percentile: Option<Box<Expression>>,
11531}
11532
11533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11535#[cfg_attr(feature = "bindings", derive(TS))]
11536pub struct Randn {
11537 #[serde(default)]
11538 pub this: Option<Box<Expression>>,
11539}
11540
11541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11543#[cfg_attr(feature = "bindings", derive(TS))]
11544pub struct Randstr {
11545 pub this: Box<Expression>,
11546 #[serde(default)]
11547 pub generator: Option<Box<Expression>>,
11548}
11549
11550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11552#[cfg_attr(feature = "bindings", derive(TS))]
11553pub struct RangeN {
11554 pub this: Box<Expression>,
11555 #[serde(default)]
11556 pub expressions: Vec<Expression>,
11557 #[serde(default)]
11558 pub each: Option<Box<Expression>>,
11559}
11560
11561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11563#[cfg_attr(feature = "bindings", derive(TS))]
11564pub struct RangeBucket {
11565 pub this: Box<Expression>,
11566 pub expression: Box<Expression>,
11567}
11568
11569#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11571#[cfg_attr(feature = "bindings", derive(TS))]
11572pub struct ReadCSV {
11573 pub this: Box<Expression>,
11574 #[serde(default)]
11575 pub expressions: Vec<Expression>,
11576}
11577
11578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11580#[cfg_attr(feature = "bindings", derive(TS))]
11581pub struct ReadParquet {
11582 #[serde(default)]
11583 pub expressions: Vec<Expression>,
11584}
11585
11586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11588#[cfg_attr(feature = "bindings", derive(TS))]
11589pub struct Reduce {
11590 pub this: Box<Expression>,
11591 #[serde(default)]
11592 pub initial: Option<Box<Expression>>,
11593 #[serde(default)]
11594 pub merge: Option<Box<Expression>>,
11595 #[serde(default)]
11596 pub finish: Option<Box<Expression>>,
11597}
11598
11599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11601#[cfg_attr(feature = "bindings", derive(TS))]
11602pub struct RegexpExtractAll {
11603 pub this: Box<Expression>,
11604 pub expression: Box<Expression>,
11605 #[serde(default)]
11606 pub group: Option<Box<Expression>>,
11607 #[serde(default)]
11608 pub parameters: Option<Box<Expression>>,
11609 #[serde(default)]
11610 pub position: Option<Box<Expression>>,
11611 #[serde(default)]
11612 pub occurrence: Option<Box<Expression>>,
11613}
11614
11615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11617#[cfg_attr(feature = "bindings", derive(TS))]
11618pub struct RegexpILike {
11619 pub this: Box<Expression>,
11620 pub expression: Box<Expression>,
11621 #[serde(default)]
11622 pub flag: Option<Box<Expression>>,
11623}
11624
11625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11627#[cfg_attr(feature = "bindings", derive(TS))]
11628pub struct RegexpFullMatch {
11629 pub this: Box<Expression>,
11630 pub expression: Box<Expression>,
11631 #[serde(default)]
11632 pub options: Vec<Expression>,
11633}
11634
11635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11637#[cfg_attr(feature = "bindings", derive(TS))]
11638pub struct RegexpInstr {
11639 pub this: Box<Expression>,
11640 pub expression: Box<Expression>,
11641 #[serde(default)]
11642 pub position: Option<Box<Expression>>,
11643 #[serde(default)]
11644 pub occurrence: Option<Box<Expression>>,
11645 #[serde(default)]
11646 pub option: Option<Box<Expression>>,
11647 #[serde(default)]
11648 pub parameters: Option<Box<Expression>>,
11649 #[serde(default)]
11650 pub group: Option<Box<Expression>>,
11651}
11652
11653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11655#[cfg_attr(feature = "bindings", derive(TS))]
11656pub struct RegexpSplit {
11657 pub this: Box<Expression>,
11658 pub expression: Box<Expression>,
11659 #[serde(default)]
11660 pub limit: Option<Box<Expression>>,
11661}
11662
11663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11665#[cfg_attr(feature = "bindings", derive(TS))]
11666pub struct RegexpCount {
11667 pub this: Box<Expression>,
11668 pub expression: Box<Expression>,
11669 #[serde(default)]
11670 pub position: Option<Box<Expression>>,
11671 #[serde(default)]
11672 pub parameters: Option<Box<Expression>>,
11673}
11674
11675#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11677#[cfg_attr(feature = "bindings", derive(TS))]
11678pub struct RegrValx {
11679 pub this: Box<Expression>,
11680 pub expression: Box<Expression>,
11681}
11682
11683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11685#[cfg_attr(feature = "bindings", derive(TS))]
11686pub struct RegrValy {
11687 pub this: Box<Expression>,
11688 pub expression: Box<Expression>,
11689}
11690
11691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11693#[cfg_attr(feature = "bindings", derive(TS))]
11694pub struct RegrAvgy {
11695 pub this: Box<Expression>,
11696 pub expression: Box<Expression>,
11697}
11698
11699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11701#[cfg_attr(feature = "bindings", derive(TS))]
11702pub struct RegrAvgx {
11703 pub this: Box<Expression>,
11704 pub expression: Box<Expression>,
11705}
11706
11707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11709#[cfg_attr(feature = "bindings", derive(TS))]
11710pub struct RegrCount {
11711 pub this: Box<Expression>,
11712 pub expression: Box<Expression>,
11713}
11714
11715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11717#[cfg_attr(feature = "bindings", derive(TS))]
11718pub struct RegrIntercept {
11719 pub this: Box<Expression>,
11720 pub expression: Box<Expression>,
11721}
11722
11723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11725#[cfg_attr(feature = "bindings", derive(TS))]
11726pub struct RegrR2 {
11727 pub this: Box<Expression>,
11728 pub expression: Box<Expression>,
11729}
11730
11731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11733#[cfg_attr(feature = "bindings", derive(TS))]
11734pub struct RegrSxx {
11735 pub this: Box<Expression>,
11736 pub expression: Box<Expression>,
11737}
11738
11739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11741#[cfg_attr(feature = "bindings", derive(TS))]
11742pub struct RegrSxy {
11743 pub this: Box<Expression>,
11744 pub expression: Box<Expression>,
11745}
11746
11747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11749#[cfg_attr(feature = "bindings", derive(TS))]
11750pub struct RegrSyy {
11751 pub this: Box<Expression>,
11752 pub expression: Box<Expression>,
11753}
11754
11755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11757#[cfg_attr(feature = "bindings", derive(TS))]
11758pub struct RegrSlope {
11759 pub this: Box<Expression>,
11760 pub expression: Box<Expression>,
11761}
11762
11763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11765#[cfg_attr(feature = "bindings", derive(TS))]
11766pub struct SafeAdd {
11767 pub this: Box<Expression>,
11768 pub expression: Box<Expression>,
11769}
11770
11771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11773#[cfg_attr(feature = "bindings", derive(TS))]
11774pub struct SafeDivide {
11775 pub this: Box<Expression>,
11776 pub expression: Box<Expression>,
11777}
11778
11779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11781#[cfg_attr(feature = "bindings", derive(TS))]
11782pub struct SafeMultiply {
11783 pub this: Box<Expression>,
11784 pub expression: Box<Expression>,
11785}
11786
11787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11789#[cfg_attr(feature = "bindings", derive(TS))]
11790pub struct SafeSubtract {
11791 pub this: Box<Expression>,
11792 pub expression: Box<Expression>,
11793}
11794
11795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11797#[cfg_attr(feature = "bindings", derive(TS))]
11798pub struct SHA2 {
11799 pub this: Box<Expression>,
11800 #[serde(default)]
11801 pub length: Option<i64>,
11802}
11803
11804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11806#[cfg_attr(feature = "bindings", derive(TS))]
11807pub struct SHA2Digest {
11808 pub this: Box<Expression>,
11809 #[serde(default)]
11810 pub length: Option<i64>,
11811}
11812
11813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11815#[cfg_attr(feature = "bindings", derive(TS))]
11816pub struct SortArray {
11817 pub this: Box<Expression>,
11818 #[serde(default)]
11819 pub asc: Option<Box<Expression>>,
11820 #[serde(default)]
11821 pub nulls_first: Option<Box<Expression>>,
11822}
11823
11824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11826#[cfg_attr(feature = "bindings", derive(TS))]
11827pub struct SplitPart {
11828 pub this: Box<Expression>,
11829 #[serde(default)]
11830 pub delimiter: Option<Box<Expression>>,
11831 #[serde(default)]
11832 pub part_index: Option<Box<Expression>>,
11833}
11834
11835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11837#[cfg_attr(feature = "bindings", derive(TS))]
11838pub struct SubstringIndex {
11839 pub this: Box<Expression>,
11840 #[serde(default)]
11841 pub delimiter: Option<Box<Expression>>,
11842 #[serde(default)]
11843 pub count: Option<Box<Expression>>,
11844}
11845
11846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11848#[cfg_attr(feature = "bindings", derive(TS))]
11849pub struct StandardHash {
11850 pub this: Box<Expression>,
11851 #[serde(default)]
11852 pub expression: Option<Box<Expression>>,
11853}
11854
11855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11857#[cfg_attr(feature = "bindings", derive(TS))]
11858pub struct StrPosition {
11859 pub this: Box<Expression>,
11860 #[serde(default)]
11861 pub substr: Option<Box<Expression>>,
11862 #[serde(default)]
11863 pub position: Option<Box<Expression>>,
11864 #[serde(default)]
11865 pub occurrence: Option<Box<Expression>>,
11866}
11867
11868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11870#[cfg_attr(feature = "bindings", derive(TS))]
11871pub struct Search {
11872 pub this: Box<Expression>,
11873 pub expression: Box<Expression>,
11874 #[serde(default)]
11875 pub json_scope: Option<Box<Expression>>,
11876 #[serde(default)]
11877 pub analyzer: Option<Box<Expression>>,
11878 #[serde(default)]
11879 pub analyzer_options: Option<Box<Expression>>,
11880 #[serde(default)]
11881 pub search_mode: Option<Box<Expression>>,
11882}
11883
11884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11886#[cfg_attr(feature = "bindings", derive(TS))]
11887pub struct SearchIp {
11888 pub this: Box<Expression>,
11889 pub expression: Box<Expression>,
11890}
11891
11892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11894#[cfg_attr(feature = "bindings", derive(TS))]
11895pub struct StrToDate {
11896 pub this: Box<Expression>,
11897 #[serde(default)]
11898 pub format: Option<String>,
11899 #[serde(default)]
11900 pub safe: Option<Box<Expression>>,
11901}
11902
11903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11905#[cfg_attr(feature = "bindings", derive(TS))]
11906pub struct StrToTime {
11907 pub this: Box<Expression>,
11908 pub format: String,
11909 #[serde(default)]
11910 pub zone: Option<Box<Expression>>,
11911 #[serde(default)]
11912 pub safe: Option<Box<Expression>>,
11913 #[serde(default)]
11914 pub target_type: Option<Box<Expression>>,
11915}
11916
11917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11919#[cfg_attr(feature = "bindings", derive(TS))]
11920pub struct StrToUnix {
11921 #[serde(default)]
11922 pub this: Option<Box<Expression>>,
11923 #[serde(default)]
11924 pub format: Option<String>,
11925}
11926
11927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11929#[cfg_attr(feature = "bindings", derive(TS))]
11930pub struct StrToMap {
11931 pub this: Box<Expression>,
11932 #[serde(default)]
11933 pub pair_delim: Option<Box<Expression>>,
11934 #[serde(default)]
11935 pub key_value_delim: Option<Box<Expression>>,
11936 #[serde(default)]
11937 pub duplicate_resolution_callback: Option<Box<Expression>>,
11938}
11939
11940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11942#[cfg_attr(feature = "bindings", derive(TS))]
11943pub struct NumberToStr {
11944 pub this: Box<Expression>,
11945 pub format: String,
11946 #[serde(default)]
11947 pub culture: Option<Box<Expression>>,
11948}
11949
11950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11952#[cfg_attr(feature = "bindings", derive(TS))]
11953pub struct FromBase {
11954 pub this: Box<Expression>,
11955 pub expression: Box<Expression>,
11956}
11957
11958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11960#[cfg_attr(feature = "bindings", derive(TS))]
11961pub struct Stuff {
11962 pub this: Box<Expression>,
11963 #[serde(default)]
11964 pub start: Option<Box<Expression>>,
11965 #[serde(default)]
11966 pub length: Option<i64>,
11967 pub expression: Box<Expression>,
11968}
11969
11970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11972#[cfg_attr(feature = "bindings", derive(TS))]
11973pub struct TimeToStr {
11974 pub this: Box<Expression>,
11975 pub format: String,
11976 #[serde(default)]
11977 pub culture: Option<Box<Expression>>,
11978 #[serde(default)]
11979 pub zone: Option<Box<Expression>>,
11980}
11981
11982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11984#[cfg_attr(feature = "bindings", derive(TS))]
11985pub struct TimeStrToTime {
11986 pub this: Box<Expression>,
11987 #[serde(default)]
11988 pub zone: Option<Box<Expression>>,
11989}
11990
11991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11993#[cfg_attr(feature = "bindings", derive(TS))]
11994pub struct TsOrDsAdd {
11995 pub this: Box<Expression>,
11996 pub expression: Box<Expression>,
11997 #[serde(default)]
11998 pub unit: Option<String>,
11999 #[serde(default)]
12000 pub return_type: Option<Box<Expression>>,
12001}
12002
12003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12005#[cfg_attr(feature = "bindings", derive(TS))]
12006pub struct TsOrDsDiff {
12007 pub this: Box<Expression>,
12008 pub expression: Box<Expression>,
12009 #[serde(default)]
12010 pub unit: Option<String>,
12011}
12012
12013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12015#[cfg_attr(feature = "bindings", derive(TS))]
12016pub struct TsOrDsToDate {
12017 pub this: Box<Expression>,
12018 #[serde(default)]
12019 pub format: Option<String>,
12020 #[serde(default)]
12021 pub safe: Option<Box<Expression>>,
12022}
12023
12024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12026#[cfg_attr(feature = "bindings", derive(TS))]
12027pub struct TsOrDsToTime {
12028 pub this: Box<Expression>,
12029 #[serde(default)]
12030 pub format: Option<String>,
12031 #[serde(default)]
12032 pub safe: Option<Box<Expression>>,
12033}
12034
12035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12037#[cfg_attr(feature = "bindings", derive(TS))]
12038pub struct Unhex {
12039 pub this: Box<Expression>,
12040 #[serde(default)]
12041 pub expression: Option<Box<Expression>>,
12042}
12043
12044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12046#[cfg_attr(feature = "bindings", derive(TS))]
12047pub struct Uniform {
12048 pub this: Box<Expression>,
12049 pub expression: Box<Expression>,
12050 #[serde(default)]
12051 pub gen: Option<Box<Expression>>,
12052 #[serde(default)]
12053 pub seed: Option<Box<Expression>>,
12054}
12055
12056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12058#[cfg_attr(feature = "bindings", derive(TS))]
12059pub struct UnixToStr {
12060 pub this: Box<Expression>,
12061 #[serde(default)]
12062 pub format: Option<String>,
12063}
12064
12065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12067#[cfg_attr(feature = "bindings", derive(TS))]
12068pub struct UnixToTime {
12069 pub this: Box<Expression>,
12070 #[serde(default)]
12071 pub scale: Option<i64>,
12072 #[serde(default)]
12073 pub zone: Option<Box<Expression>>,
12074 #[serde(default)]
12075 pub hours: Option<Box<Expression>>,
12076 #[serde(default)]
12077 pub minutes: Option<Box<Expression>>,
12078 #[serde(default)]
12079 pub format: Option<String>,
12080 #[serde(default)]
12081 pub target_type: Option<Box<Expression>>,
12082}
12083
12084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12086#[cfg_attr(feature = "bindings", derive(TS))]
12087pub struct Uuid {
12088 #[serde(default)]
12089 pub this: Option<Box<Expression>>,
12090 #[serde(default)]
12091 pub name: Option<String>,
12092 #[serde(default)]
12093 pub is_string: Option<Box<Expression>>,
12094}
12095
12096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12098#[cfg_attr(feature = "bindings", derive(TS))]
12099pub struct TimestampFromParts {
12100 #[serde(default)]
12101 pub zone: Option<Box<Expression>>,
12102 #[serde(default)]
12103 pub milli: Option<Box<Expression>>,
12104 #[serde(default)]
12105 pub this: Option<Box<Expression>>,
12106 #[serde(default)]
12107 pub expression: Option<Box<Expression>>,
12108}
12109
12110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12112#[cfg_attr(feature = "bindings", derive(TS))]
12113pub struct TimestampTzFromParts {
12114 #[serde(default)]
12115 pub zone: Option<Box<Expression>>,
12116}
12117
12118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12120#[cfg_attr(feature = "bindings", derive(TS))]
12121pub struct Corr {
12122 pub this: Box<Expression>,
12123 pub expression: Box<Expression>,
12124 #[serde(default)]
12125 pub null_on_zero_variance: Option<Box<Expression>>,
12126}
12127
12128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12130#[cfg_attr(feature = "bindings", derive(TS))]
12131pub struct WidthBucket {
12132 pub this: Box<Expression>,
12133 #[serde(default)]
12134 pub min_value: Option<Box<Expression>>,
12135 #[serde(default)]
12136 pub max_value: Option<Box<Expression>>,
12137 #[serde(default)]
12138 pub num_buckets: Option<Box<Expression>>,
12139 #[serde(default)]
12140 pub threshold: Option<Box<Expression>>,
12141}
12142
12143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12145#[cfg_attr(feature = "bindings", derive(TS))]
12146pub struct CovarSamp {
12147 pub this: Box<Expression>,
12148 pub expression: Box<Expression>,
12149}
12150
12151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12153#[cfg_attr(feature = "bindings", derive(TS))]
12154pub struct CovarPop {
12155 pub this: Box<Expression>,
12156 pub expression: Box<Expression>,
12157}
12158
12159#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12161#[cfg_attr(feature = "bindings", derive(TS))]
12162pub struct Week {
12163 pub this: Box<Expression>,
12164 #[serde(default)]
12165 pub mode: Option<Box<Expression>>,
12166}
12167
12168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12170#[cfg_attr(feature = "bindings", derive(TS))]
12171pub struct XMLElement {
12172 pub this: Box<Expression>,
12173 #[serde(default)]
12174 pub expressions: Vec<Expression>,
12175 #[serde(default)]
12176 pub evalname: Option<Box<Expression>>,
12177}
12178
12179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12181#[cfg_attr(feature = "bindings", derive(TS))]
12182pub struct XMLGet {
12183 pub this: Box<Expression>,
12184 pub expression: Box<Expression>,
12185 #[serde(default)]
12186 pub instance: Option<Box<Expression>>,
12187}
12188
12189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12191#[cfg_attr(feature = "bindings", derive(TS))]
12192pub struct XMLTable {
12193 pub this: Box<Expression>,
12194 #[serde(default)]
12195 pub namespaces: Option<Box<Expression>>,
12196 #[serde(default)]
12197 pub passing: Option<Box<Expression>>,
12198 #[serde(default)]
12199 pub columns: Vec<Expression>,
12200 #[serde(default)]
12201 pub by_ref: Option<Box<Expression>>,
12202}
12203
12204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12206#[cfg_attr(feature = "bindings", derive(TS))]
12207pub struct XMLKeyValueOption {
12208 pub this: Box<Expression>,
12209 #[serde(default)]
12210 pub expression: Option<Box<Expression>>,
12211}
12212
12213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12215#[cfg_attr(feature = "bindings", derive(TS))]
12216pub struct Zipf {
12217 pub this: Box<Expression>,
12218 #[serde(default)]
12219 pub elementcount: Option<Box<Expression>>,
12220 #[serde(default)]
12221 pub gen: Option<Box<Expression>>,
12222}
12223
12224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12226#[cfg_attr(feature = "bindings", derive(TS))]
12227pub struct Merge {
12228 pub this: Box<Expression>,
12229 pub using: Box<Expression>,
12230 #[serde(default)]
12231 pub on: Option<Box<Expression>>,
12232 #[serde(default)]
12233 pub using_cond: Option<Box<Expression>>,
12234 #[serde(default)]
12235 pub whens: Option<Box<Expression>>,
12236 #[serde(default)]
12237 pub with_: Option<Box<Expression>>,
12238 #[serde(default)]
12239 pub returning: Option<Box<Expression>>,
12240}
12241
12242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12244#[cfg_attr(feature = "bindings", derive(TS))]
12245pub struct When {
12246 #[serde(default)]
12247 pub matched: Option<Box<Expression>>,
12248 #[serde(default)]
12249 pub source: Option<Box<Expression>>,
12250 #[serde(default)]
12251 pub condition: Option<Box<Expression>>,
12252 pub then: Box<Expression>,
12253}
12254
12255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12257#[cfg_attr(feature = "bindings", derive(TS))]
12258pub struct Whens {
12259 #[serde(default)]
12260 pub expressions: Vec<Expression>,
12261}
12262
12263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12265#[cfg_attr(feature = "bindings", derive(TS))]
12266pub struct NextValueFor {
12267 pub this: Box<Expression>,
12268 #[serde(default)]
12269 pub order: Option<Box<Expression>>,
12270}
12271
12272
12273#[cfg(test)]
12274mod tests {
12275 use super::*;
12276
12277 #[test]
12278 #[cfg(feature = "bindings")]
12279 fn export_typescript_types() {
12280 Expression::export_all(&ts_rs::Config::default()).expect("Failed to export Expression types");
12283 }
12284
12285 #[test]
12286 fn test_simple_select_builder() {
12287 let select = Select::new()
12288 .column(Expression::star())
12289 .from(Expression::Table(TableRef::new("users")));
12290
12291 assert_eq!(select.expressions.len(), 1);
12292 assert!(select.from.is_some());
12293 }
12294
12295 #[test]
12296 fn test_expression_alias() {
12297 let expr = Expression::column("id").alias("user_id");
12298
12299 match expr {
12300 Expression::Alias(a) => {
12301 assert_eq!(a.alias.name, "user_id");
12302 }
12303 _ => panic!("Expected Alias"),
12304 }
12305 }
12306
12307 #[test]
12308 fn test_literal_creation() {
12309 let num = Expression::number(42);
12310 let str = Expression::string("hello");
12311
12312 match num {
12313 Expression::Literal(Literal::Number(n)) => assert_eq!(n, "42"),
12314 _ => panic!("Expected Number"),
12315 }
12316
12317 match str {
12318 Expression::Literal(Literal::String(s)) => assert_eq!(s, "hello"),
12319 _ => panic!("Expected String"),
12320 }
12321 }
12322
12323 #[test]
12324 fn test_expression_sql() {
12325 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
12326 assert_eq!(expr.sql(), "SELECT 1 + 2");
12327 }
12328
12329 #[test]
12330 fn test_expression_sql_for() {
12331 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
12332 let sql = expr.sql_for(crate::DialectType::Generic);
12333 assert!(sql.contains("IF"));
12334 }
12335}