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 Pivot(Box<Pivot>),
100 PivotAlias(Box<PivotAlias>),
101 Unpivot(Box<Unpivot>),
102 Values(Box<Values>),
103 PreWhere(Box<PreWhere>),
104 Stream(Box<Stream>),
105 UsingData(Box<UsingData>),
106 XmlNamespace(Box<XmlNamespace>),
107
108 Insert(Box<Insert>),
110 Update(Box<Update>),
111 Delete(Box<Delete>),
112 Copy(Box<CopyStmt>),
113 Put(Box<PutStmt>),
114 StageReference(Box<StageReference>),
115
116 Alias(Box<Alias>),
118 Cast(Box<Cast>),
119 Collation(Box<CollationExpr>),
120 Case(Box<Case>),
121
122 And(Box<BinaryOp>),
124 Or(Box<BinaryOp>),
125 Add(Box<BinaryOp>),
126 Sub(Box<BinaryOp>),
127 Mul(Box<BinaryOp>),
128 Div(Box<BinaryOp>),
129 Mod(Box<BinaryOp>),
130 Eq(Box<BinaryOp>),
131 Neq(Box<BinaryOp>),
132 Lt(Box<BinaryOp>),
133 Lte(Box<BinaryOp>),
134 Gt(Box<BinaryOp>),
135 Gte(Box<BinaryOp>),
136 Like(Box<LikeOp>),
137 ILike(Box<LikeOp>),
138 Match(Box<BinaryOp>),
140 BitwiseAnd(Box<BinaryOp>),
141 BitwiseOr(Box<BinaryOp>),
142 BitwiseXor(Box<BinaryOp>),
143 Concat(Box<BinaryOp>),
144 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>),
160 Neg(Box<UnaryOp>),
161 BitwiseNot(Box<UnaryOp>),
162
163 In(Box<In>),
165 Between(Box<Between>),
166 IsNull(Box<IsNull>),
167 IsTrue(Box<IsTrueFalse>),
168 IsFalse(Box<IsTrueFalse>),
169 IsJson(Box<IsJson>),
170 Is(Box<BinaryOp>), Exists(Box<Exists>),
172 MemberOf(Box<BinaryOp>),
174
175 Function(Box<Function>),
177 AggregateFunction(Box<AggregateFunction>),
178 WindowFunction(Box<WindowFunction>),
179
180 From(Box<From>),
182 Join(Box<Join>),
183 JoinedTable(Box<JoinedTable>),
184 Where(Box<Where>),
185 GroupBy(Box<GroupBy>),
186 Having(Box<Having>),
187 OrderBy(Box<OrderBy>),
188 Limit(Box<Limit>),
189 Offset(Box<Offset>),
190 Qualify(Box<Qualify>),
191 With(Box<With>),
192 Cte(Box<Cte>),
193 DistributeBy(Box<DistributeBy>),
194 ClusterBy(Box<ClusterBy>),
195 SortBy(Box<SortBy>),
196 LateralView(Box<LateralView>),
197 Hint(Box<Hint>),
198 Pseudocolumn(Pseudocolumn),
199
200 Connect(Box<Connect>),
202 Prior(Box<Prior>),
203 ConnectByRoot(Box<ConnectByRoot>),
204
205 MatchRecognize(Box<MatchRecognize>),
207
208 Ordered(Box<Ordered>),
210
211 Window(Box<WindowSpec>),
213 Over(Box<Over>),
214 WithinGroup(Box<WithinGroup>),
215
216 DataType(DataType),
218
219 Array(Box<Array>),
221 Struct(Box<Struct>),
222 Tuple(Box<Tuple>),
223
224 Interval(Box<Interval>),
226
227 ConcatWs(Box<ConcatWs>),
229 Substring(Box<SubstringFunc>),
230 Upper(Box<UnaryFunc>),
231 Lower(Box<UnaryFunc>),
232 Length(Box<UnaryFunc>),
233 Trim(Box<TrimFunc>),
234 LTrim(Box<UnaryFunc>),
235 RTrim(Box<UnaryFunc>),
236 Replace(Box<ReplaceFunc>),
237 Reverse(Box<UnaryFunc>),
238 Left(Box<LeftRightFunc>),
239 Right(Box<LeftRightFunc>),
240 Repeat(Box<RepeatFunc>),
241 Lpad(Box<PadFunc>),
242 Rpad(Box<PadFunc>),
243 Split(Box<SplitFunc>),
244 RegexpLike(Box<RegexpFunc>),
245 RegexpReplace(Box<RegexpReplaceFunc>),
246 RegexpExtract(Box<RegexpExtractFunc>),
247 Overlay(Box<OverlayFunc>),
248
249 Abs(Box<UnaryFunc>),
251 Round(Box<RoundFunc>),
252 Floor(Box<FloorFunc>),
253 Ceil(Box<CeilFunc>),
254 Power(Box<BinaryFunc>),
255 Sqrt(Box<UnaryFunc>),
256 Cbrt(Box<UnaryFunc>),
257 Ln(Box<UnaryFunc>),
258 Log(Box<LogFunc>),
259 Exp(Box<UnaryFunc>),
260 Sign(Box<UnaryFunc>),
261 Greatest(Box<VarArgFunc>),
262 Least(Box<VarArgFunc>),
263
264 CurrentDate(CurrentDate),
266 CurrentTime(CurrentTime),
267 CurrentTimestamp(CurrentTimestamp),
268 CurrentTimestampLTZ(CurrentTimestampLTZ),
269 AtTimeZone(Box<AtTimeZone>),
270 DateAdd(Box<DateAddFunc>),
271 DateSub(Box<DateAddFunc>),
272 DateDiff(Box<DateDiffFunc>),
273 DateTrunc(Box<DateTruncFunc>),
274 Extract(Box<ExtractFunc>),
275 ToDate(Box<ToDateFunc>),
276 ToTimestamp(Box<ToTimestampFunc>),
277 Date(Box<UnaryFunc>),
278 Time(Box<UnaryFunc>),
279 DateFromUnixDate(Box<UnaryFunc>),
280 UnixDate(Box<UnaryFunc>),
281 UnixSeconds(Box<UnaryFunc>),
282 UnixMillis(Box<UnaryFunc>),
283 UnixMicros(Box<UnaryFunc>),
284 UnixToTimeStr(Box<BinaryFunc>),
285 TimeStrToDate(Box<UnaryFunc>),
286 DateToDi(Box<UnaryFunc>),
287 DiToDate(Box<UnaryFunc>),
288 TsOrDiToDi(Box<UnaryFunc>),
289 TsOrDsToDatetime(Box<UnaryFunc>),
290 TsOrDsToTimestamp(Box<UnaryFunc>),
291 YearOfWeek(Box<UnaryFunc>),
292 YearOfWeekIso(Box<UnaryFunc>),
293
294 Coalesce(Box<VarArgFunc>),
296 NullIf(Box<BinaryFunc>),
297 IfFunc(Box<IfFunc>),
298 IfNull(Box<BinaryFunc>),
299 Nvl(Box<BinaryFunc>),
300 Nvl2(Box<Nvl2Func>),
301
302 TryCast(Box<Cast>),
304 SafeCast(Box<Cast>),
305
306 Count(Box<CountFunc>),
308 Sum(Box<AggFunc>),
309 Avg(Box<AggFunc>),
310 Min(Box<AggFunc>),
311 Max(Box<AggFunc>),
312 GroupConcat(Box<GroupConcatFunc>),
313 StringAgg(Box<StringAggFunc>),
314 ListAgg(Box<ListAggFunc>),
315 ArrayAgg(Box<AggFunc>),
316 CountIf(Box<AggFunc>),
317 SumIf(Box<SumIfFunc>),
318 Stddev(Box<AggFunc>),
319 StddevPop(Box<AggFunc>),
320 StddevSamp(Box<AggFunc>),
321 Variance(Box<AggFunc>),
322 VarPop(Box<AggFunc>),
323 VarSamp(Box<AggFunc>),
324 Median(Box<AggFunc>),
325 Mode(Box<AggFunc>),
326 First(Box<AggFunc>),
327 Last(Box<AggFunc>),
328 AnyValue(Box<AggFunc>),
329 ApproxDistinct(Box<AggFunc>),
330 ApproxCountDistinct(Box<AggFunc>),
331 ApproxPercentile(Box<ApproxPercentileFunc>),
332 Percentile(Box<PercentileFunc>),
333 LogicalAnd(Box<AggFunc>),
334 LogicalOr(Box<AggFunc>),
335 Skewness(Box<AggFunc>),
336 BitwiseCount(Box<UnaryFunc>),
337 ArrayConcatAgg(Box<AggFunc>),
338 ArrayUniqueAgg(Box<AggFunc>),
339 BoolXorAgg(Box<AggFunc>),
340
341 RowNumber(RowNumber),
343 Rank(Rank),
344 DenseRank(DenseRank),
345 NTile(Box<NTileFunc>),
346 Lead(Box<LeadLagFunc>),
347 Lag(Box<LeadLagFunc>),
348 FirstValue(Box<ValueFunc>),
349 LastValue(Box<ValueFunc>),
350 NthValue(Box<NthValueFunc>),
351 PercentRank(PercentRank),
352 CumeDist(CumeDist),
353 PercentileCont(Box<PercentileFunc>),
354 PercentileDisc(Box<PercentileFunc>),
355
356 Contains(Box<BinaryFunc>),
358 StartsWith(Box<BinaryFunc>),
359 EndsWith(Box<BinaryFunc>),
360 Position(Box<PositionFunc>),
361 Initcap(Box<UnaryFunc>),
362 Ascii(Box<UnaryFunc>),
363 Chr(Box<UnaryFunc>),
364 CharFunc(Box<CharFunc>),
366 Soundex(Box<UnaryFunc>),
367 Levenshtein(Box<BinaryFunc>),
368 ByteLength(Box<UnaryFunc>),
369 Hex(Box<UnaryFunc>),
370 LowerHex(Box<UnaryFunc>),
371 Unicode(Box<UnaryFunc>),
372
373 ModFunc(Box<BinaryFunc>),
375 Random(Random),
376 Rand(Box<Rand>),
377 TruncFunc(Box<TruncateFunc>),
378 Pi(Pi),
379 Radians(Box<UnaryFunc>),
380 Degrees(Box<UnaryFunc>),
381 Sin(Box<UnaryFunc>),
382 Cos(Box<UnaryFunc>),
383 Tan(Box<UnaryFunc>),
384 Asin(Box<UnaryFunc>),
385 Acos(Box<UnaryFunc>),
386 Atan(Box<UnaryFunc>),
387 Atan2(Box<BinaryFunc>),
388 IsNan(Box<UnaryFunc>),
389 IsInf(Box<UnaryFunc>),
390 IntDiv(Box<BinaryFunc>),
391
392 Decode(Box<DecodeFunc>),
394
395 DateFormat(Box<DateFormatFunc>),
397 FormatDate(Box<DateFormatFunc>),
398 Year(Box<UnaryFunc>),
399 Month(Box<UnaryFunc>),
400 Day(Box<UnaryFunc>),
401 Hour(Box<UnaryFunc>),
402 Minute(Box<UnaryFunc>),
403 Second(Box<UnaryFunc>),
404 DayOfWeek(Box<UnaryFunc>),
405 DayOfWeekIso(Box<UnaryFunc>),
406 DayOfMonth(Box<UnaryFunc>),
407 DayOfYear(Box<UnaryFunc>),
408 WeekOfYear(Box<UnaryFunc>),
409 Quarter(Box<UnaryFunc>),
410 AddMonths(Box<BinaryFunc>),
411 MonthsBetween(Box<BinaryFunc>),
412 LastDay(Box<LastDayFunc>),
413 NextDay(Box<BinaryFunc>),
414 Epoch(Box<UnaryFunc>),
415 EpochMs(Box<UnaryFunc>),
416 FromUnixtime(Box<FromUnixtimeFunc>),
417 UnixTimestamp(Box<UnixTimestampFunc>),
418 MakeDate(Box<MakeDateFunc>),
419 MakeTimestamp(Box<MakeTimestampFunc>),
420 TimestampTrunc(Box<DateTruncFunc>),
421 TimeStrToUnix(Box<UnaryFunc>),
422
423 SessionUser(SessionUser),
425
426 SHA(Box<UnaryFunc>),
428 SHA1Digest(Box<UnaryFunc>),
429
430 TimeToUnix(Box<UnaryFunc>),
432
433 ArrayFunc(Box<ArrayConstructor>),
435 ArrayLength(Box<UnaryFunc>),
436 ArraySize(Box<UnaryFunc>),
437 Cardinality(Box<UnaryFunc>),
438 ArrayContains(Box<BinaryFunc>),
439 ArrayPosition(Box<BinaryFunc>),
440 ArrayAppend(Box<BinaryFunc>),
441 ArrayPrepend(Box<BinaryFunc>),
442 ArrayConcat(Box<VarArgFunc>),
443 ArraySort(Box<ArraySortFunc>),
444 ArrayReverse(Box<UnaryFunc>),
445 ArrayDistinct(Box<UnaryFunc>),
446 ArrayJoin(Box<ArrayJoinFunc>),
447 ArrayToString(Box<ArrayJoinFunc>),
448 Unnest(Box<UnnestFunc>),
449 Explode(Box<UnaryFunc>),
450 ExplodeOuter(Box<UnaryFunc>),
451 ArrayFilter(Box<ArrayFilterFunc>),
452 ArrayTransform(Box<ArrayTransformFunc>),
453 ArrayFlatten(Box<UnaryFunc>),
454 ArrayCompact(Box<UnaryFunc>),
455 ArrayIntersect(Box<BinaryFunc>),
456 ArrayUnion(Box<BinaryFunc>),
457 ArrayExcept(Box<BinaryFunc>),
458 ArrayRemove(Box<BinaryFunc>),
459 ArrayZip(Box<VarArgFunc>),
460 Sequence(Box<SequenceFunc>),
461 Generate(Box<SequenceFunc>),
462 ExplodingGenerateSeries(Box<SequenceFunc>),
463 ToArray(Box<UnaryFunc>),
464 StarMap(Box<BinaryFunc>),
465
466 StructFunc(Box<StructConstructor>),
468 StructExtract(Box<StructExtractFunc>),
469 NamedStruct(Box<NamedStructFunc>),
470
471 MapFunc(Box<MapConstructor>),
473 MapFromEntries(Box<UnaryFunc>),
474 MapFromArrays(Box<BinaryFunc>),
475 MapKeys(Box<UnaryFunc>),
476 MapValues(Box<UnaryFunc>),
477 MapContainsKey(Box<BinaryFunc>),
478 MapConcat(Box<VarArgFunc>),
479 ElementAt(Box<BinaryFunc>),
480 TransformKeys(Box<TransformFunc>),
481 TransformValues(Box<TransformFunc>),
482
483 JsonExtract(Box<JsonExtractFunc>),
485 JsonExtractScalar(Box<JsonExtractFunc>),
486 JsonExtractPath(Box<JsonPathFunc>),
487 JsonArray(Box<VarArgFunc>),
488 JsonObject(Box<JsonObjectFunc>),
489 JsonQuery(Box<JsonExtractFunc>),
490 JsonValue(Box<JsonExtractFunc>),
491 JsonArrayLength(Box<UnaryFunc>),
492 JsonKeys(Box<UnaryFunc>),
493 JsonType(Box<UnaryFunc>),
494 ParseJson(Box<UnaryFunc>),
495 ToJson(Box<UnaryFunc>),
496 JsonSet(Box<JsonModifyFunc>),
497 JsonInsert(Box<JsonModifyFunc>),
498 JsonRemove(Box<JsonPathFunc>),
499 JsonMergePatch(Box<BinaryFunc>),
500 JsonArrayAgg(Box<JsonArrayAggFunc>),
501 JsonObjectAgg(Box<JsonObjectAggFunc>),
502
503 Convert(Box<ConvertFunc>),
505 Typeof(Box<UnaryFunc>),
506
507 Lambda(Box<LambdaExpr>),
509 Parameter(Box<Parameter>),
510 Placeholder(Placeholder),
511 NamedArgument(Box<NamedArgument>),
512 TableArgument(Box<TableArgument>),
515 SqlComment(Box<SqlComment>),
516
517 NullSafeEq(Box<BinaryOp>),
519 NullSafeNeq(Box<BinaryOp>),
520 Glob(Box<BinaryOp>),
521 SimilarTo(Box<SimilarToExpr>),
522 Any(Box<QuantifiedExpr>),
523 All(Box<QuantifiedExpr>),
524 Overlaps(Box<OverlapsExpr>),
525
526 BitwiseLeftShift(Box<BinaryOp>),
528 BitwiseRightShift(Box<BinaryOp>),
529 BitwiseAndAgg(Box<AggFunc>),
530 BitwiseOrAgg(Box<AggFunc>),
531 BitwiseXorAgg(Box<AggFunc>),
532
533 Subscript(Box<Subscript>),
535 Dot(Box<DotAccess>),
536 MethodCall(Box<MethodCall>),
537 ArraySlice(Box<ArraySlice>),
538
539 CreateTable(Box<CreateTable>),
541 DropTable(Box<DropTable>),
542 AlterTable(Box<AlterTable>),
543 CreateIndex(Box<CreateIndex>),
544 DropIndex(Box<DropIndex>),
545 CreateView(Box<CreateView>),
546 DropView(Box<DropView>),
547 AlterView(Box<AlterView>),
548 AlterIndex(Box<AlterIndex>),
549 Truncate(Box<Truncate>),
550 Use(Box<Use>),
551 Cache(Box<Cache>),
552 Uncache(Box<Uncache>),
553 LoadData(Box<LoadData>),
554 Pragma(Box<Pragma>),
555 Grant(Box<Grant>),
556 Revoke(Box<Revoke>),
557 Comment(Box<Comment>),
558 SetStatement(Box<SetStatement>),
559 CreateSchema(Box<CreateSchema>),
561 DropSchema(Box<DropSchema>),
562 DropNamespace(Box<DropNamespace>),
563 CreateDatabase(Box<CreateDatabase>),
564 DropDatabase(Box<DropDatabase>),
565 CreateFunction(Box<CreateFunction>),
566 DropFunction(Box<DropFunction>),
567 CreateProcedure(Box<CreateProcedure>),
568 DropProcedure(Box<DropProcedure>),
569 CreateSequence(Box<CreateSequence>),
570 DropSequence(Box<DropSequence>),
571 AlterSequence(Box<AlterSequence>),
572 CreateTrigger(Box<CreateTrigger>),
573 DropTrigger(Box<DropTrigger>),
574 CreateType(Box<CreateType>),
575 DropType(Box<DropType>),
576 Describe(Box<Describe>),
577 Show(Box<Show>),
578
579 Command(Box<Command>),
581 Kill(Box<Kill>),
582 Execute(Box<ExecuteStatement>),
584
585 Raw(Raw),
587
588 Paren(Box<Paren>),
590
591 Annotated(Box<Annotated>),
593
594 Refresh(Box<Refresh>),
597 LockingStatement(Box<LockingStatement>),
598 SequenceProperties(Box<SequenceProperties>),
599 TruncateTable(Box<TruncateTable>),
600 Clone(Box<Clone>),
601 Attach(Box<Attach>),
602 Detach(Box<Detach>),
603 Install(Box<Install>),
604 Summarize(Box<Summarize>),
605 Declare(Box<Declare>),
606 DeclareItem(Box<DeclareItem>),
607 Set(Box<Set>),
608 Heredoc(Box<Heredoc>),
609 SetItem(Box<SetItem>),
610 QueryBand(Box<QueryBand>),
611 UserDefinedFunction(Box<UserDefinedFunction>),
612 RecursiveWithSearch(Box<RecursiveWithSearch>),
613 ProjectionDef(Box<ProjectionDef>),
614 TableAlias(Box<TableAlias>),
615 ByteString(Box<ByteString>),
616 HexStringExpr(Box<HexStringExpr>),
617 UnicodeString(Box<UnicodeString>),
618 ColumnPosition(Box<ColumnPosition>),
619 ColumnDef(Box<ColumnDef>),
620 AlterColumn(Box<AlterColumn>),
621 AlterSortKey(Box<AlterSortKey>),
622 AlterSet(Box<AlterSet>),
623 RenameColumn(Box<RenameColumn>),
624 Comprehension(Box<Comprehension>),
625 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
626 MergeTreeTTL(Box<MergeTreeTTL>),
627 IndexConstraintOption(Box<IndexConstraintOption>),
628 ColumnConstraint(Box<ColumnConstraint>),
629 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
630 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
631 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
632 CheckColumnConstraint(Box<CheckColumnConstraint>),
633 CompressColumnConstraint(Box<CompressColumnConstraint>),
634 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
635 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
636 WithOperator(Box<WithOperator>),
637 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
638 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
639 CommentColumnConstraint(CommentColumnConstraint),
640 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
641 IndexColumnConstraint(Box<IndexColumnConstraint>),
642 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
643 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
644 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
645 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
646 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
647 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
648 InOutColumnConstraint(Box<InOutColumnConstraint>),
649 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
650 PathColumnConstraint(Box<PathColumnConstraint>),
651 Constraint(Box<Constraint>),
652 Export(Box<Export>),
653 Filter(Box<Filter>),
654 Changes(Box<Changes>),
655 CopyParameter(Box<CopyParameter>),
656 Credentials(Box<Credentials>),
657 Directory(Box<Directory>),
658 ForeignKey(Box<ForeignKey>),
659 ColumnPrefix(Box<ColumnPrefix>),
660 PrimaryKey(Box<PrimaryKey>),
661 IntoClause(Box<IntoClause>),
662 JoinHint(Box<JoinHint>),
663 Opclass(Box<Opclass>),
664 Index(Box<Index>),
665 IndexParameters(Box<IndexParameters>),
666 ConditionalInsert(Box<ConditionalInsert>),
667 MultitableInserts(Box<MultitableInserts>),
668 OnConflict(Box<OnConflict>),
669 OnCondition(Box<OnCondition>),
670 Returning(Box<Returning>),
671 Introducer(Box<Introducer>),
672 PartitionRange(Box<PartitionRange>),
673 Fetch(Box<Fetch>),
674 Group(Box<Group>),
675 Cube(Box<Cube>),
676 Rollup(Box<Rollup>),
677 GroupingSets(Box<GroupingSets>),
678 LimitOptions(Box<LimitOptions>),
679 Lateral(Box<Lateral>),
680 TableFromRows(Box<TableFromRows>),
681 RowsFrom(Box<RowsFrom>),
682 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
683 WithFill(Box<WithFill>),
684 Property(Box<Property>),
685 GrantPrivilege(Box<GrantPrivilege>),
686 GrantPrincipal(Box<GrantPrincipal>),
687 AllowedValuesProperty(Box<AllowedValuesProperty>),
688 AlgorithmProperty(Box<AlgorithmProperty>),
689 AutoIncrementProperty(Box<AutoIncrementProperty>),
690 AutoRefreshProperty(Box<AutoRefreshProperty>),
691 BackupProperty(Box<BackupProperty>),
692 BuildProperty(Box<BuildProperty>),
693 BlockCompressionProperty(Box<BlockCompressionProperty>),
694 CharacterSetProperty(Box<CharacterSetProperty>),
695 ChecksumProperty(Box<ChecksumProperty>),
696 CollateProperty(Box<CollateProperty>),
697 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
698 DataDeletionProperty(Box<DataDeletionProperty>),
699 DefinerProperty(Box<DefinerProperty>),
700 DistKeyProperty(Box<DistKeyProperty>),
701 DistributedByProperty(Box<DistributedByProperty>),
702 DistStyleProperty(Box<DistStyleProperty>),
703 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
704 EngineProperty(Box<EngineProperty>),
705 ToTableProperty(Box<ToTableProperty>),
706 ExecuteAsProperty(Box<ExecuteAsProperty>),
707 ExternalProperty(Box<ExternalProperty>),
708 FallbackProperty(Box<FallbackProperty>),
709 FileFormatProperty(Box<FileFormatProperty>),
710 CredentialsProperty(Box<CredentialsProperty>),
711 FreespaceProperty(Box<FreespaceProperty>),
712 InheritsProperty(Box<InheritsProperty>),
713 InputModelProperty(Box<InputModelProperty>),
714 OutputModelProperty(Box<OutputModelProperty>),
715 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
716 JournalProperty(Box<JournalProperty>),
717 LanguageProperty(Box<LanguageProperty>),
718 EnviromentProperty(Box<EnviromentProperty>),
719 ClusteredByProperty(Box<ClusteredByProperty>),
720 DictProperty(Box<DictProperty>),
721 DictRange(Box<DictRange>),
722 OnCluster(Box<OnCluster>),
723 LikeProperty(Box<LikeProperty>),
724 LocationProperty(Box<LocationProperty>),
725 LockProperty(Box<LockProperty>),
726 LockingProperty(Box<LockingProperty>),
727 LogProperty(Box<LogProperty>),
728 MaterializedProperty(Box<MaterializedProperty>),
729 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
730 OnProperty(Box<OnProperty>),
731 OnCommitProperty(Box<OnCommitProperty>),
732 PartitionedByProperty(Box<PartitionedByProperty>),
733 PartitionedByBucket(Box<PartitionedByBucket>),
734 PartitionByTruncate(Box<PartitionByTruncate>),
735 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
736 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
737 PartitionByListProperty(Box<PartitionByListProperty>),
738 PartitionList(Box<PartitionList>),
739 Partition(Box<Partition>),
740 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
741 UniqueKeyProperty(Box<UniqueKeyProperty>),
742 RollupProperty(Box<RollupProperty>),
743 PartitionBoundSpec(Box<PartitionBoundSpec>),
744 PartitionedOfProperty(Box<PartitionedOfProperty>),
745 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
746 ReturnsProperty(Box<ReturnsProperty>),
747 RowFormatProperty(Box<RowFormatProperty>),
748 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
749 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
750 QueryTransform(Box<QueryTransform>),
751 SampleProperty(Box<SampleProperty>),
752 SecurityProperty(Box<SecurityProperty>),
753 SchemaCommentProperty(Box<SchemaCommentProperty>),
754 SemanticView(Box<SemanticView>),
755 SerdeProperties(Box<SerdeProperties>),
756 SetProperty(Box<SetProperty>),
757 SharingProperty(Box<SharingProperty>),
758 SetConfigProperty(Box<SetConfigProperty>),
759 SettingsProperty(Box<SettingsProperty>),
760 SortKeyProperty(Box<SortKeyProperty>),
761 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
762 SqlSecurityProperty(Box<SqlSecurityProperty>),
763 StabilityProperty(Box<StabilityProperty>),
764 StorageHandlerProperty(Box<StorageHandlerProperty>),
765 TemporaryProperty(Box<TemporaryProperty>),
766 Tags(Box<Tags>),
767 TransformModelProperty(Box<TransformModelProperty>),
768 TransientProperty(Box<TransientProperty>),
769 UsingTemplateProperty(Box<UsingTemplateProperty>),
770 ViewAttributeProperty(Box<ViewAttributeProperty>),
771 VolatileProperty(Box<VolatileProperty>),
772 WithDataProperty(Box<WithDataProperty>),
773 WithJournalTableProperty(Box<WithJournalTableProperty>),
774 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
775 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
776 WithProcedureOptions(Box<WithProcedureOptions>),
777 EncodeProperty(Box<EncodeProperty>),
778 IncludeProperty(Box<IncludeProperty>),
779 Properties(Box<Properties>),
780 InputOutputFormat(Box<InputOutputFormat>),
781 Reference(Box<Reference>),
782 QueryOption(Box<QueryOption>),
783 WithTableHint(Box<WithTableHint>),
784 IndexTableHint(Box<IndexTableHint>),
785 HistoricalData(Box<HistoricalData>),
786 Get(Box<Get>),
787 SetOperation(Box<SetOperation>),
788 Var(Box<Var>),
789 Version(Box<Version>),
790 Schema(Box<Schema>),
791 Lock(Box<Lock>),
792 TableSample(Box<TableSample>),
793 Tag(Box<Tag>),
794 UnpivotColumns(Box<UnpivotColumns>),
795 WindowSpec(Box<WindowSpec>),
796 SessionParameter(Box<SessionParameter>),
797 PseudoType(Box<PseudoType>),
798 ObjectIdentifier(Box<ObjectIdentifier>),
799 Transaction(Box<Transaction>),
800 Commit(Box<Commit>),
801 Rollback(Box<Rollback>),
802 AlterSession(Box<AlterSession>),
803 Analyze(Box<Analyze>),
804 AnalyzeStatistics(Box<AnalyzeStatistics>),
805 AnalyzeHistogram(Box<AnalyzeHistogram>),
806 AnalyzeSample(Box<AnalyzeSample>),
807 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
808 AnalyzeDelete(Box<AnalyzeDelete>),
809 AnalyzeWith(Box<AnalyzeWith>),
810 AnalyzeValidate(Box<AnalyzeValidate>),
811 AddPartition(Box<AddPartition>),
812 AttachOption(Box<AttachOption>),
813 DropPartition(Box<DropPartition>),
814 ReplacePartition(Box<ReplacePartition>),
815 DPipe(Box<DPipe>),
816 Operator(Box<Operator>),
817 PivotAny(Box<PivotAny>),
818 Aliases(Box<Aliases>),
819 AtIndex(Box<AtIndex>),
820 FromTimeZone(Box<FromTimeZone>),
821 FormatPhrase(Box<FormatPhrase>),
822 ForIn(Box<ForIn>),
823 TimeUnit(Box<TimeUnit>),
824 IntervalOp(Box<IntervalOp>),
825 IntervalSpan(Box<IntervalSpan>),
826 HavingMax(Box<HavingMax>),
827 CosineDistance(Box<CosineDistance>),
828 DotProduct(Box<DotProduct>),
829 EuclideanDistance(Box<EuclideanDistance>),
830 ManhattanDistance(Box<ManhattanDistance>),
831 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
832 Booland(Box<Booland>),
833 Boolor(Box<Boolor>),
834 ParameterizedAgg(Box<ParameterizedAgg>),
835 ArgMax(Box<ArgMax>),
836 ArgMin(Box<ArgMin>),
837 ApproxTopK(Box<ApproxTopK>),
838 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
839 ApproxTopKCombine(Box<ApproxTopKCombine>),
840 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
841 ApproxTopSum(Box<ApproxTopSum>),
842 ApproxQuantiles(Box<ApproxQuantiles>),
843 Minhash(Box<Minhash>),
844 FarmFingerprint(Box<FarmFingerprint>),
845 Float64(Box<Float64>),
846 Transform(Box<Transform>),
847 Translate(Box<Translate>),
848 Grouping(Box<Grouping>),
849 GroupingId(Box<GroupingId>),
850 Anonymous(Box<Anonymous>),
851 AnonymousAggFunc(Box<AnonymousAggFunc>),
852 CombinedAggFunc(Box<CombinedAggFunc>),
853 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
854 HashAgg(Box<HashAgg>),
855 Hll(Box<Hll>),
856 Apply(Box<Apply>),
857 ToBoolean(Box<ToBoolean>),
858 List(Box<List>),
859 ToMap(Box<ToMap>),
860 Pad(Box<Pad>),
861 ToChar(Box<ToChar>),
862 ToNumber(Box<ToNumber>),
863 ToDouble(Box<ToDouble>),
864 Int64(Box<UnaryFunc>),
865 StringFunc(Box<StringFunc>),
866 ToDecfloat(Box<ToDecfloat>),
867 TryToDecfloat(Box<TryToDecfloat>),
868 ToFile(Box<ToFile>),
869 Columns(Box<Columns>),
870 ConvertToCharset(Box<ConvertToCharset>),
871 ConvertTimezone(Box<ConvertTimezone>),
872 GenerateSeries(Box<GenerateSeries>),
873 AIAgg(Box<AIAgg>),
874 AIClassify(Box<AIClassify>),
875 ArrayAll(Box<ArrayAll>),
876 ArrayAny(Box<ArrayAny>),
877 ArrayConstructCompact(Box<ArrayConstructCompact>),
878 StPoint(Box<StPoint>),
879 StDistance(Box<StDistance>),
880 StringToArray(Box<StringToArray>),
881 ArraySum(Box<ArraySum>),
882 ObjectAgg(Box<ObjectAgg>),
883 CastToStrType(Box<CastToStrType>),
884 CheckJson(Box<CheckJson>),
885 CheckXml(Box<CheckXml>),
886 TranslateCharacters(Box<TranslateCharacters>),
887 CurrentSchemas(Box<CurrentSchemas>),
888 CurrentDatetime(Box<CurrentDatetime>),
889 Localtime(Box<Localtime>),
890 Localtimestamp(Box<Localtimestamp>),
891 Systimestamp(Box<Systimestamp>),
892 CurrentSchema(Box<CurrentSchema>),
893 CurrentUser(Box<CurrentUser>),
894 UtcTime(Box<UtcTime>),
895 UtcTimestamp(Box<UtcTimestamp>),
896 Timestamp(Box<TimestampFunc>),
897 DateBin(Box<DateBin>),
898 Datetime(Box<Datetime>),
899 DatetimeAdd(Box<DatetimeAdd>),
900 DatetimeSub(Box<DatetimeSub>),
901 DatetimeDiff(Box<DatetimeDiff>),
902 DatetimeTrunc(Box<DatetimeTrunc>),
903 Dayname(Box<Dayname>),
904 MakeInterval(Box<MakeInterval>),
905 PreviousDay(Box<PreviousDay>),
906 Elt(Box<Elt>),
907 TimestampAdd(Box<TimestampAdd>),
908 TimestampSub(Box<TimestampSub>),
909 TimestampDiff(Box<TimestampDiff>),
910 TimeSlice(Box<TimeSlice>),
911 TimeAdd(Box<TimeAdd>),
912 TimeSub(Box<TimeSub>),
913 TimeDiff(Box<TimeDiff>),
914 TimeTrunc(Box<TimeTrunc>),
915 DateFromParts(Box<DateFromParts>),
916 TimeFromParts(Box<TimeFromParts>),
917 DecodeCase(Box<DecodeCase>),
918 Decrypt(Box<Decrypt>),
919 DecryptRaw(Box<DecryptRaw>),
920 Encode(Box<Encode>),
921 Encrypt(Box<Encrypt>),
922 EncryptRaw(Box<EncryptRaw>),
923 EqualNull(Box<EqualNull>),
924 ToBinary(Box<ToBinary>),
925 Base64DecodeBinary(Box<Base64DecodeBinary>),
926 Base64DecodeString(Box<Base64DecodeString>),
927 Base64Encode(Box<Base64Encode>),
928 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
929 TryBase64DecodeString(Box<TryBase64DecodeString>),
930 GapFill(Box<GapFill>),
931 GenerateDateArray(Box<GenerateDateArray>),
932 GenerateTimestampArray(Box<GenerateTimestampArray>),
933 GetExtract(Box<GetExtract>),
934 Getbit(Box<Getbit>),
935 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
936 HexEncode(Box<HexEncode>),
937 Compress(Box<Compress>),
938 DecompressBinary(Box<DecompressBinary>),
939 DecompressString(Box<DecompressString>),
940 Xor(Box<Xor>),
941 Nullif(Box<Nullif>),
942 JSON(Box<JSON>),
943 JSONPath(Box<JSONPath>),
944 JSONPathFilter(Box<JSONPathFilter>),
945 JSONPathKey(Box<JSONPathKey>),
946 JSONPathRecursive(Box<JSONPathRecursive>),
947 JSONPathScript(Box<JSONPathScript>),
948 JSONPathSlice(Box<JSONPathSlice>),
949 JSONPathSelector(Box<JSONPathSelector>),
950 JSONPathSubscript(Box<JSONPathSubscript>),
951 JSONPathUnion(Box<JSONPathUnion>),
952 Format(Box<Format>),
953 JSONKeys(Box<JSONKeys>),
954 JSONKeyValue(Box<JSONKeyValue>),
955 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
956 JSONObject(Box<JSONObject>),
957 JSONObjectAgg(Box<JSONObjectAgg>),
958 JSONBObjectAgg(Box<JSONBObjectAgg>),
959 JSONArray(Box<JSONArray>),
960 JSONArrayAgg(Box<JSONArrayAgg>),
961 JSONExists(Box<JSONExists>),
962 JSONColumnDef(Box<JSONColumnDef>),
963 JSONSchema(Box<JSONSchema>),
964 JSONSet(Box<JSONSet>),
965 JSONStripNulls(Box<JSONStripNulls>),
966 JSONValue(Box<JSONValue>),
967 JSONValueArray(Box<JSONValueArray>),
968 JSONRemove(Box<JSONRemove>),
969 JSONTable(Box<JSONTable>),
970 JSONType(Box<JSONType>),
971 ObjectInsert(Box<ObjectInsert>),
972 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
973 OpenJSON(Box<OpenJSON>),
974 JSONBExists(Box<JSONBExists>),
975 JSONBContains(Box<BinaryFunc>),
976 JSONBExtract(Box<BinaryFunc>),
977 JSONCast(Box<JSONCast>),
978 JSONExtract(Box<JSONExtract>),
979 JSONExtractQuote(Box<JSONExtractQuote>),
980 JSONExtractArray(Box<JSONExtractArray>),
981 JSONExtractScalar(Box<JSONExtractScalar>),
982 JSONBExtractScalar(Box<JSONBExtractScalar>),
983 JSONFormat(Box<JSONFormat>),
984 JSONBool(Box<UnaryFunc>),
985 JSONPathRoot(JSONPathRoot),
986 JSONArrayAppend(Box<JSONArrayAppend>),
987 JSONArrayContains(Box<JSONArrayContains>),
988 JSONArrayInsert(Box<JSONArrayInsert>),
989 ParseJSON(Box<ParseJSON>),
990 ParseUrl(Box<ParseUrl>),
991 ParseIp(Box<ParseIp>),
992 ParseTime(Box<ParseTime>),
993 ParseDatetime(Box<ParseDatetime>),
994 Map(Box<Map>),
995 MapCat(Box<MapCat>),
996 MapDelete(Box<MapDelete>),
997 MapInsert(Box<MapInsert>),
998 MapPick(Box<MapPick>),
999 ScopeResolution(Box<ScopeResolution>),
1000 Slice(Box<Slice>),
1001 VarMap(Box<VarMap>),
1002 MatchAgainst(Box<MatchAgainst>),
1003 MD5Digest(Box<MD5Digest>),
1004 MD5NumberLower64(Box<UnaryFunc>),
1005 MD5NumberUpper64(Box<UnaryFunc>),
1006 Monthname(Box<Monthname>),
1007 Ntile(Box<Ntile>),
1008 Normalize(Box<Normalize>),
1009 Normal(Box<Normal>),
1010 Predict(Box<Predict>),
1011 MLTranslate(Box<MLTranslate>),
1012 FeaturesAtTime(Box<FeaturesAtTime>),
1013 GenerateEmbedding(Box<GenerateEmbedding>),
1014 MLForecast(Box<MLForecast>),
1015 ModelAttribute(Box<ModelAttribute>),
1016 VectorSearch(Box<VectorSearch>),
1017 Quantile(Box<Quantile>),
1018 ApproxQuantile(Box<ApproxQuantile>),
1019 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1020 Randn(Box<Randn>),
1021 Randstr(Box<Randstr>),
1022 RangeN(Box<RangeN>),
1023 RangeBucket(Box<RangeBucket>),
1024 ReadCSV(Box<ReadCSV>),
1025 ReadParquet(Box<ReadParquet>),
1026 Reduce(Box<Reduce>),
1027 RegexpExtractAll(Box<RegexpExtractAll>),
1028 RegexpILike(Box<RegexpILike>),
1029 RegexpFullMatch(Box<RegexpFullMatch>),
1030 RegexpInstr(Box<RegexpInstr>),
1031 RegexpSplit(Box<RegexpSplit>),
1032 RegexpCount(Box<RegexpCount>),
1033 RegrValx(Box<RegrValx>),
1034 RegrValy(Box<RegrValy>),
1035 RegrAvgy(Box<RegrAvgy>),
1036 RegrAvgx(Box<RegrAvgx>),
1037 RegrCount(Box<RegrCount>),
1038 RegrIntercept(Box<RegrIntercept>),
1039 RegrR2(Box<RegrR2>),
1040 RegrSxx(Box<RegrSxx>),
1041 RegrSxy(Box<RegrSxy>),
1042 RegrSyy(Box<RegrSyy>),
1043 RegrSlope(Box<RegrSlope>),
1044 SafeAdd(Box<SafeAdd>),
1045 SafeDivide(Box<SafeDivide>),
1046 SafeMultiply(Box<SafeMultiply>),
1047 SafeSubtract(Box<SafeSubtract>),
1048 SHA2(Box<SHA2>),
1049 SHA2Digest(Box<SHA2Digest>),
1050 SortArray(Box<SortArray>),
1051 SplitPart(Box<SplitPart>),
1052 SubstringIndex(Box<SubstringIndex>),
1053 StandardHash(Box<StandardHash>),
1054 StrPosition(Box<StrPosition>),
1055 Search(Box<Search>),
1056 SearchIp(Box<SearchIp>),
1057 StrToDate(Box<StrToDate>),
1058 DateStrToDate(Box<UnaryFunc>),
1059 DateToDateStr(Box<UnaryFunc>),
1060 StrToTime(Box<StrToTime>),
1061 StrToUnix(Box<StrToUnix>),
1062 StrToMap(Box<StrToMap>),
1063 NumberToStr(Box<NumberToStr>),
1064 FromBase(Box<FromBase>),
1065 Stuff(Box<Stuff>),
1066 TimeToStr(Box<TimeToStr>),
1067 TimeStrToTime(Box<TimeStrToTime>),
1068 TsOrDsAdd(Box<TsOrDsAdd>),
1069 TsOrDsDiff(Box<TsOrDsDiff>),
1070 TsOrDsToDate(Box<TsOrDsToDate>),
1071 TsOrDsToTime(Box<TsOrDsToTime>),
1072 Unhex(Box<Unhex>),
1073 Uniform(Box<Uniform>),
1074 UnixToStr(Box<UnixToStr>),
1075 UnixToTime(Box<UnixToTime>),
1076 Uuid(Box<Uuid>),
1077 TimestampFromParts(Box<TimestampFromParts>),
1078 TimestampTzFromParts(Box<TimestampTzFromParts>),
1079 Corr(Box<Corr>),
1080 WidthBucket(Box<WidthBucket>),
1081 CovarSamp(Box<CovarSamp>),
1082 CovarPop(Box<CovarPop>),
1083 Week(Box<Week>),
1084 XMLElement(Box<XMLElement>),
1085 XMLGet(Box<XMLGet>),
1086 XMLTable(Box<XMLTable>),
1087 XMLKeyValueOption(Box<XMLKeyValueOption>),
1088 Zipf(Box<Zipf>),
1089 Merge(Box<Merge>),
1090 When(Box<When>),
1091 Whens(Box<Whens>),
1092 NextValueFor(Box<NextValueFor>),
1093 ReturnStmt(Box<Expression>),
1095}
1096
1097impl Expression {
1098 pub fn number(n: i64) -> Self {
1100 Expression::Literal(Literal::Number(n.to_string()))
1101 }
1102
1103 pub fn string(s: impl Into<String>) -> Self {
1105 Expression::Literal(Literal::String(s.into()))
1106 }
1107
1108 pub fn float(f: f64) -> Self {
1110 Expression::Literal(Literal::Number(f.to_string()))
1111 }
1112
1113 pub fn column(name: impl Into<String>) -> Self {
1115 Expression::Column(Column {
1116 name: Identifier::new(name),
1117 table: None,
1118 join_mark: false,
1119 trailing_comments: Vec::new(),
1120 })
1121 }
1122
1123 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1125 Expression::Column(Column {
1126 name: Identifier::new(column),
1127 table: Some(Identifier::new(table)),
1128 join_mark: false,
1129 trailing_comments: Vec::new(),
1130 })
1131 }
1132
1133 pub fn identifier(name: impl Into<String>) -> Self {
1135 Expression::Identifier(Identifier::new(name))
1136 }
1137
1138 pub fn null() -> Self {
1140 Expression::Null(Null)
1141 }
1142
1143 pub fn true_() -> Self {
1145 Expression::Boolean(BooleanLiteral { value: true })
1146 }
1147
1148 pub fn false_() -> Self {
1150 Expression::Boolean(BooleanLiteral { value: false })
1151 }
1152
1153 pub fn star() -> Self {
1155 Expression::Star(Star {
1156 table: None,
1157 except: None,
1158 replace: None,
1159 rename: None,
1160 trailing_comments: Vec::new(),
1161 })
1162 }
1163
1164 pub fn alias(self, name: impl Into<String>) -> Self {
1166 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1167 }
1168
1169 pub fn is_select(&self) -> bool {
1171 matches!(self, Expression::Select(_))
1172 }
1173
1174 pub fn as_select(&self) -> Option<&Select> {
1176 match self {
1177 Expression::Select(s) => Some(s),
1178 _ => None,
1179 }
1180 }
1181
1182 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1184 match self {
1185 Expression::Select(s) => Some(s),
1186 _ => None,
1187 }
1188 }
1189
1190 pub fn sql(&self) -> String {
1195 crate::generator::Generator::sql(self).unwrap_or_default()
1196 }
1197
1198 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1204 crate::generate(self, dialect).unwrap_or_default()
1205 }
1206
1207}
1208
1209impl fmt::Display for Expression {
1210 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1211 match self {
1213 Expression::Literal(lit) => write!(f, "{}", lit),
1214 Expression::Identifier(id) => write!(f, "{}", id),
1215 Expression::Column(col) => write!(f, "{}", col),
1216 Expression::Star(_) => write!(f, "*"),
1217 Expression::Null(_) => write!(f, "NULL"),
1218 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
1219 Expression::Select(_) => write!(f, "SELECT ..."),
1220 _ => write!(f, "{:?}", self),
1221 }
1222 }
1223}
1224
1225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1235#[cfg_attr(feature = "bindings", derive(TS))]
1236#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
1237pub enum Literal {
1238 String(String),
1240 Number(String),
1242 HexString(String),
1244 HexNumber(String),
1246 BitString(String),
1247 ByteString(String),
1249 NationalString(String),
1251 Date(String),
1253 Time(String),
1255 Timestamp(String),
1257 Datetime(String),
1259 TripleQuotedString(String, char),
1262 EscapeString(String),
1264 DollarString(String),
1266 RawString(String),
1270}
1271
1272impl fmt::Display for Literal {
1273 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1274 match self {
1275 Literal::String(s) => write!(f, "'{}'", s),
1276 Literal::Number(n) => write!(f, "{}", n),
1277 Literal::HexString(h) => write!(f, "X'{}'", h),
1278 Literal::HexNumber(h) => write!(f, "0x{}", h),
1279 Literal::BitString(b) => write!(f, "B'{}'", b),
1280 Literal::ByteString(b) => write!(f, "b'{}'", b),
1281 Literal::NationalString(s) => write!(f, "N'{}'", s),
1282 Literal::Date(d) => write!(f, "DATE '{}'", d),
1283 Literal::Time(t) => write!(f, "TIME '{}'", t),
1284 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
1285 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
1286 Literal::TripleQuotedString(s, q) => {
1287 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
1288 }
1289 Literal::EscapeString(s) => write!(f, "E'{}'", s),
1290 Literal::DollarString(s) => write!(f, "$${}$$", s),
1291 Literal::RawString(s) => write!(f, "r'{}'", s),
1292 }
1293 }
1294}
1295
1296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1298#[cfg_attr(feature = "bindings", derive(TS))]
1299pub struct BooleanLiteral {
1300 pub value: bool,
1301}
1302
1303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1305#[cfg_attr(feature = "bindings", derive(TS))]
1306pub struct Null;
1307
1308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1315#[cfg_attr(feature = "bindings", derive(TS))]
1316pub struct Identifier {
1317 pub name: String,
1319 pub quoted: bool,
1321 #[serde(default)]
1322 pub trailing_comments: Vec<String>,
1323}
1324
1325impl Identifier {
1326 pub fn new(name: impl Into<String>) -> Self {
1327 Self {
1328 name: name.into(),
1329 quoted: false,
1330 trailing_comments: Vec::new(),
1331 }
1332 }
1333
1334 pub fn quoted(name: impl Into<String>) -> Self {
1335 Self {
1336 name: name.into(),
1337 quoted: true,
1338 trailing_comments: Vec::new(),
1339 }
1340 }
1341
1342 pub fn empty() -> Self {
1343 Self {
1344 name: String::new(),
1345 quoted: false,
1346 trailing_comments: Vec::new(),
1347 }
1348 }
1349
1350 pub fn is_empty(&self) -> bool {
1351 self.name.is_empty()
1352 }
1353}
1354
1355impl fmt::Display for Identifier {
1356 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1357 if self.quoted {
1358 write!(f, "\"{}\"", self.name)
1359 } else {
1360 write!(f, "{}", self.name)
1361 }
1362 }
1363}
1364
1365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1371#[cfg_attr(feature = "bindings", derive(TS))]
1372pub struct Column {
1373 pub name: Identifier,
1375 pub table: Option<Identifier>,
1377 #[serde(default)]
1379 pub join_mark: bool,
1380 #[serde(default)]
1382 pub trailing_comments: Vec<String>,
1383}
1384
1385impl fmt::Display for Column {
1386 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1387 if let Some(table) = &self.table {
1388 write!(f, "{}.{}", table, self.name)
1389 } else {
1390 write!(f, "{}", self.name)
1391 }
1392 }
1393}
1394
1395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1402#[cfg_attr(feature = "bindings", derive(TS))]
1403pub struct TableRef {
1404 pub name: Identifier,
1406 pub schema: Option<Identifier>,
1408 pub catalog: Option<Identifier>,
1410 pub alias: Option<Identifier>,
1412 #[serde(default)]
1414 pub alias_explicit_as: bool,
1415 #[serde(default)]
1417 pub column_aliases: Vec<Identifier>,
1418 #[serde(default)]
1420 pub trailing_comments: Vec<String>,
1421 #[serde(default)]
1423 pub when: Option<Box<HistoricalData>>,
1424 #[serde(default)]
1426 pub only: bool,
1427 #[serde(default)]
1429 pub final_: bool,
1430 #[serde(default, skip_serializing_if = "Option::is_none")]
1432 pub table_sample: Option<Box<Sample>>,
1433 #[serde(default)]
1435 pub hints: Vec<Expression>,
1436 #[serde(default, skip_serializing_if = "Option::is_none")]
1439 pub system_time: Option<String>,
1440 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1442 pub partitions: Vec<Identifier>,
1443 #[serde(default, skip_serializing_if = "Option::is_none")]
1446 pub identifier_func: Option<Box<Expression>>,
1447 #[serde(default, skip_serializing_if = "Option::is_none")]
1449 pub changes: Option<Box<Changes>>,
1450 #[serde(default, skip_serializing_if = "Option::is_none")]
1452 pub version: Option<Box<Version>>,
1453}
1454
1455impl TableRef {
1456 pub fn new(name: impl Into<String>) -> Self {
1457 Self {
1458 name: Identifier::new(name),
1459 schema: None,
1460 catalog: None,
1461 alias: None,
1462 alias_explicit_as: false,
1463 column_aliases: Vec::new(),
1464 trailing_comments: Vec::new(),
1465 when: None,
1466 only: false,
1467 final_: false,
1468 table_sample: None,
1469 hints: Vec::new(),
1470 system_time: None,
1471 partitions: Vec::new(),
1472 identifier_func: None,
1473 changes: None,
1474 version: None,
1475 }
1476 }
1477
1478 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
1480 let mut t = Self::new(name);
1481 t.schema = Some(Identifier::new(schema));
1482 t
1483 }
1484
1485 pub fn new_with_catalog(
1487 name: impl Into<String>,
1488 schema: impl Into<String>,
1489 catalog: impl Into<String>,
1490 ) -> Self {
1491 let mut t = Self::new(name);
1492 t.schema = Some(Identifier::new(schema));
1493 t.catalog = Some(Identifier::new(catalog));
1494 t
1495 }
1496
1497 pub fn from_identifier(name: Identifier) -> Self {
1499 Self {
1500 name,
1501 schema: None,
1502 catalog: None,
1503 alias: None,
1504 alias_explicit_as: false,
1505 column_aliases: Vec::new(),
1506 trailing_comments: Vec::new(),
1507 when: None,
1508 only: false,
1509 final_: false,
1510 table_sample: None,
1511 hints: Vec::new(),
1512 system_time: None,
1513 partitions: Vec::new(),
1514 identifier_func: None,
1515 changes: None,
1516 version: None,
1517 }
1518 }
1519
1520 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
1521 self.alias = Some(Identifier::new(alias));
1522 self
1523 }
1524
1525 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
1526 self.schema = Some(Identifier::new(schema));
1527 self
1528 }
1529}
1530
1531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1536#[cfg_attr(feature = "bindings", derive(TS))]
1537pub struct Star {
1538 pub table: Option<Identifier>,
1540 pub except: Option<Vec<Identifier>>,
1542 pub replace: Option<Vec<Alias>>,
1544 pub rename: Option<Vec<(Identifier, Identifier)>>,
1546 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1548 pub trailing_comments: Vec<String>,
1549}
1550
1551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1575#[cfg_attr(feature = "bindings", derive(TS))]
1576pub struct Select {
1577 pub expressions: Vec<Expression>,
1579 pub from: Option<From>,
1581 pub joins: Vec<Join>,
1583 pub lateral_views: Vec<LateralView>,
1584 #[serde(default, skip_serializing_if = "Option::is_none")]
1586 pub prewhere: Option<Expression>,
1587 pub where_clause: Option<Where>,
1588 pub group_by: Option<GroupBy>,
1589 pub having: Option<Having>,
1590 pub qualify: Option<Qualify>,
1591 pub order_by: Option<OrderBy>,
1592 pub distribute_by: Option<DistributeBy>,
1593 pub cluster_by: Option<ClusterBy>,
1594 pub sort_by: Option<SortBy>,
1595 pub limit: Option<Limit>,
1596 pub offset: Option<Offset>,
1597 #[serde(default, skip_serializing_if = "Option::is_none")]
1599 pub limit_by: Option<Vec<Expression>>,
1600 pub fetch: Option<Fetch>,
1601 pub distinct: bool,
1602 pub distinct_on: Option<Vec<Expression>>,
1603 pub top: Option<Top>,
1604 pub with: Option<With>,
1605 pub sample: Option<Sample>,
1606 #[serde(default, skip_serializing_if = "Option::is_none")]
1608 pub settings: Option<Vec<Expression>>,
1609 #[serde(default, skip_serializing_if = "Option::is_none")]
1611 pub format: Option<Expression>,
1612 pub windows: Option<Vec<NamedWindow>>,
1613 pub hint: Option<Hint>,
1614 pub connect: Option<Connect>,
1616 pub into: Option<SelectInto>,
1618 #[serde(default)]
1620 pub locks: Vec<Lock>,
1621 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1623 pub for_xml: Vec<Expression>,
1624 #[serde(default)]
1626 pub leading_comments: Vec<String>,
1627 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1630 pub post_select_comments: Vec<String>,
1631 #[serde(default, skip_serializing_if = "Option::is_none")]
1633 pub kind: Option<String>,
1634 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1636 pub operation_modifiers: Vec<String>,
1637 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
1639 pub qualify_after_window: bool,
1640 #[serde(default, skip_serializing_if = "Option::is_none")]
1642 pub option: Option<String>,
1643}
1644
1645impl Select {
1646 pub fn new() -> Self {
1647 Self {
1648 expressions: Vec::new(),
1649 from: None,
1650 joins: Vec::new(),
1651 lateral_views: Vec::new(),
1652 prewhere: None,
1653 where_clause: None,
1654 group_by: None,
1655 having: None,
1656 qualify: None,
1657 order_by: None,
1658 distribute_by: None,
1659 cluster_by: None,
1660 sort_by: None,
1661 limit: None,
1662 offset: None,
1663 limit_by: None,
1664 fetch: None,
1665 distinct: false,
1666 distinct_on: None,
1667 top: None,
1668 with: None,
1669 sample: None,
1670 settings: None,
1671 format: None,
1672 windows: None,
1673 hint: None,
1674 connect: None,
1675 into: None,
1676 locks: Vec::new(),
1677 for_xml: Vec::new(),
1678 leading_comments: Vec::new(),
1679 post_select_comments: Vec::new(),
1680 kind: None,
1681 operation_modifiers: Vec::new(),
1682 qualify_after_window: false,
1683 option: None,
1684 }
1685 }
1686
1687 pub fn column(mut self, expr: Expression) -> Self {
1689 self.expressions.push(expr);
1690 self
1691 }
1692
1693 pub fn from(mut self, table: Expression) -> Self {
1695 self.from = Some(From {
1696 expressions: vec![table],
1697 });
1698 self
1699 }
1700
1701 pub fn where_(mut self, condition: Expression) -> Self {
1703 self.where_clause = Some(Where { this: condition });
1704 self
1705 }
1706
1707 pub fn distinct(mut self) -> Self {
1709 self.distinct = true;
1710 self
1711 }
1712
1713 pub fn join(mut self, join: Join) -> Self {
1715 self.joins.push(join);
1716 self
1717 }
1718
1719 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
1721 self.order_by = Some(OrderBy { expressions, siblings: false });
1722 self
1723 }
1724
1725 pub fn limit(mut self, n: Expression) -> Self {
1727 self.limit = Some(Limit { this: n, percent: false });
1728 self
1729 }
1730
1731 pub fn offset(mut self, n: Expression) -> Self {
1733 self.offset = Some(Offset { this: n, rows: None });
1734 self
1735 }
1736}
1737
1738impl Default for Select {
1739 fn default() -> Self {
1740 Self::new()
1741 }
1742}
1743
1744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1750#[cfg_attr(feature = "bindings", derive(TS))]
1751pub struct Union {
1752 pub left: Expression,
1754 pub right: Expression,
1756 pub all: bool,
1758 #[serde(default)]
1760 pub distinct: bool,
1761 pub with: Option<With>,
1763 pub order_by: Option<OrderBy>,
1765 pub limit: Option<Box<Expression>>,
1767 pub offset: Option<Box<Expression>>,
1769 #[serde(default, skip_serializing_if = "Option::is_none")]
1771 pub distribute_by: Option<DistributeBy>,
1772 #[serde(default, skip_serializing_if = "Option::is_none")]
1774 pub sort_by: Option<SortBy>,
1775 #[serde(default, skip_serializing_if = "Option::is_none")]
1777 pub cluster_by: Option<ClusterBy>,
1778 #[serde(default)]
1780 pub by_name: bool,
1781 #[serde(default, skip_serializing_if = "Option::is_none")]
1783 pub side: Option<String>,
1784 #[serde(default, skip_serializing_if = "Option::is_none")]
1786 pub kind: Option<String>,
1787 #[serde(default)]
1789 pub corresponding: bool,
1790 #[serde(default)]
1792 pub strict: bool,
1793 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1795 pub on_columns: Vec<Expression>,
1796}
1797
1798#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1803#[cfg_attr(feature = "bindings", derive(TS))]
1804pub struct Intersect {
1805 pub left: Expression,
1807 pub right: Expression,
1809 pub all: bool,
1811 #[serde(default)]
1813 pub distinct: bool,
1814 pub with: Option<With>,
1816 pub order_by: Option<OrderBy>,
1818 pub limit: Option<Box<Expression>>,
1820 pub offset: Option<Box<Expression>>,
1822 #[serde(default, skip_serializing_if = "Option::is_none")]
1824 pub distribute_by: Option<DistributeBy>,
1825 #[serde(default, skip_serializing_if = "Option::is_none")]
1827 pub sort_by: Option<SortBy>,
1828 #[serde(default, skip_serializing_if = "Option::is_none")]
1830 pub cluster_by: Option<ClusterBy>,
1831 #[serde(default)]
1833 pub by_name: bool,
1834 #[serde(default, skip_serializing_if = "Option::is_none")]
1836 pub side: Option<String>,
1837 #[serde(default, skip_serializing_if = "Option::is_none")]
1839 pub kind: Option<String>,
1840 #[serde(default)]
1842 pub corresponding: bool,
1843 #[serde(default)]
1845 pub strict: bool,
1846 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1848 pub on_columns: Vec<Expression>,
1849}
1850
1851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1856#[cfg_attr(feature = "bindings", derive(TS))]
1857pub struct Except {
1858 pub left: Expression,
1860 pub right: Expression,
1862 pub all: bool,
1864 #[serde(default)]
1866 pub distinct: bool,
1867 pub with: Option<With>,
1869 pub order_by: Option<OrderBy>,
1871 pub limit: Option<Box<Expression>>,
1873 pub offset: Option<Box<Expression>>,
1875 #[serde(default, skip_serializing_if = "Option::is_none")]
1877 pub distribute_by: Option<DistributeBy>,
1878 #[serde(default, skip_serializing_if = "Option::is_none")]
1880 pub sort_by: Option<SortBy>,
1881 #[serde(default, skip_serializing_if = "Option::is_none")]
1883 pub cluster_by: Option<ClusterBy>,
1884 #[serde(default)]
1886 pub by_name: bool,
1887 #[serde(default, skip_serializing_if = "Option::is_none")]
1889 pub side: Option<String>,
1890 #[serde(default, skip_serializing_if = "Option::is_none")]
1892 pub kind: Option<String>,
1893 #[serde(default)]
1895 pub corresponding: bool,
1896 #[serde(default)]
1898 pub strict: bool,
1899 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1901 pub on_columns: Vec<Expression>,
1902}
1903
1904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1906#[cfg_attr(feature = "bindings", derive(TS))]
1907pub struct SelectInto {
1908 pub this: Expression,
1910 #[serde(default)]
1912 pub temporary: bool,
1913 #[serde(default)]
1915 pub unlogged: bool,
1916 #[serde(default)]
1918 pub bulk_collect: bool,
1919 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1921 pub expressions: Vec<Expression>,
1922}
1923
1924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1934#[cfg_attr(feature = "bindings", derive(TS))]
1935pub struct Subquery {
1936 pub this: Expression,
1938 pub alias: Option<Identifier>,
1940 pub column_aliases: Vec<Identifier>,
1942 pub order_by: Option<OrderBy>,
1944 pub limit: Option<Limit>,
1946 pub offset: Option<Offset>,
1948 #[serde(default, skip_serializing_if = "Option::is_none")]
1950 pub distribute_by: Option<DistributeBy>,
1951 #[serde(default, skip_serializing_if = "Option::is_none")]
1953 pub sort_by: Option<SortBy>,
1954 #[serde(default, skip_serializing_if = "Option::is_none")]
1956 pub cluster_by: Option<ClusterBy>,
1957 #[serde(default)]
1959 pub lateral: bool,
1960 #[serde(default)]
1964 pub modifiers_inside: bool,
1965 #[serde(default)]
1967 pub trailing_comments: Vec<String>,
1968}
1969
1970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1972#[cfg_attr(feature = "bindings", derive(TS))]
1973pub struct Values {
1974 pub expressions: Vec<Tuple>,
1976 pub alias: Option<Identifier>,
1978 pub column_aliases: Vec<Identifier>,
1980}
1981
1982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1992#[cfg_attr(feature = "bindings", derive(TS))]
1993pub struct Pivot {
1994 pub this: Expression,
1996 #[serde(default)]
1999 pub expressions: Vec<Expression>,
2000 #[serde(default)]
2002 pub fields: Vec<Expression>,
2003 #[serde(default)]
2005 pub using: Vec<Expression>,
2006 #[serde(default)]
2008 pub group: Option<Box<Expression>>,
2009 #[serde(default)]
2011 pub unpivot: bool,
2012 #[serde(default)]
2014 pub into: Option<Box<Expression>>,
2015 #[serde(default)]
2017 pub alias: Option<Identifier>,
2018 #[serde(default)]
2020 pub include_nulls: Option<bool>,
2021 #[serde(default)]
2023 pub default_on_null: Option<Box<Expression>>,
2024 #[serde(default, skip_serializing_if = "Option::is_none")]
2026 pub with: Option<With>,
2027}
2028
2029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2031#[cfg_attr(feature = "bindings", derive(TS))]
2032pub struct Unpivot {
2033 pub this: Expression,
2034 pub value_column: Identifier,
2035 pub name_column: Identifier,
2036 pub columns: Vec<Expression>,
2037 pub alias: Option<Identifier>,
2038 #[serde(default)]
2040 pub value_column_parenthesized: bool,
2041 #[serde(default)]
2043 pub include_nulls: Option<bool>,
2044 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2046 pub extra_value_columns: Vec<Identifier>,
2047}
2048
2049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2052#[cfg_attr(feature = "bindings", derive(TS))]
2053pub struct PivotAlias {
2054 pub this: Expression,
2055 pub alias: Expression,
2056}
2057
2058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2060#[cfg_attr(feature = "bindings", derive(TS))]
2061pub struct PreWhere {
2062 pub this: Expression,
2063}
2064
2065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2067#[cfg_attr(feature = "bindings", derive(TS))]
2068pub struct Stream {
2069 pub this: Expression,
2070 #[serde(skip_serializing_if = "Option::is_none")]
2071 pub on: Option<Expression>,
2072 #[serde(skip_serializing_if = "Option::is_none")]
2073 pub show_initial_rows: Option<bool>,
2074}
2075
2076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2078#[cfg_attr(feature = "bindings", derive(TS))]
2079pub struct UsingData {
2080 pub this: Expression,
2081}
2082
2083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2085#[cfg_attr(feature = "bindings", derive(TS))]
2086pub struct XmlNamespace {
2087 pub this: Expression,
2088 #[serde(skip_serializing_if = "Option::is_none")]
2089 pub alias: Option<Identifier>,
2090}
2091
2092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2094#[cfg_attr(feature = "bindings", derive(TS))]
2095pub struct RowFormat {
2096 pub delimited: bool,
2097 pub fields_terminated_by: Option<String>,
2098 pub collection_items_terminated_by: Option<String>,
2099 pub map_keys_terminated_by: Option<String>,
2100 pub lines_terminated_by: Option<String>,
2101 pub null_defined_as: Option<String>,
2102}
2103
2104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2106#[cfg_attr(feature = "bindings", derive(TS))]
2107pub struct DirectoryInsert {
2108 pub local: bool,
2109 pub path: String,
2110 pub row_format: Option<RowFormat>,
2111 #[serde(default)]
2113 pub stored_as: Option<String>,
2114}
2115
2116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2118#[cfg_attr(feature = "bindings", derive(TS))]
2119pub struct Insert {
2120 pub table: TableRef,
2121 pub columns: Vec<Identifier>,
2122 pub values: Vec<Vec<Expression>>,
2123 pub query: Option<Expression>,
2124 pub overwrite: bool,
2126 pub partition: Vec<(Identifier, Option<Expression>)>,
2128 #[serde(default)]
2130 pub directory: Option<DirectoryInsert>,
2131 #[serde(default)]
2133 pub returning: Vec<Expression>,
2134 #[serde(default)]
2136 pub output: Option<OutputClause>,
2137 #[serde(default)]
2139 pub on_conflict: Option<Box<Expression>>,
2140 #[serde(default)]
2142 pub leading_comments: Vec<String>,
2143 #[serde(default)]
2145 pub if_exists: bool,
2146 #[serde(default)]
2148 pub with: Option<With>,
2149 #[serde(default)]
2151 pub ignore: bool,
2152 #[serde(default)]
2154 pub source_alias: Option<Identifier>,
2155 #[serde(default)]
2157 pub alias: Option<Identifier>,
2158 #[serde(default)]
2160 pub alias_explicit_as: bool,
2161 #[serde(default)]
2163 pub default_values: bool,
2164 #[serde(default)]
2166 pub by_name: bool,
2167 #[serde(default, skip_serializing_if = "Option::is_none")]
2169 pub conflict_action: Option<String>,
2170 #[serde(default)]
2172 pub is_replace: bool,
2173 #[serde(default, skip_serializing_if = "Option::is_none")]
2175 pub hint: Option<Hint>,
2176 #[serde(default)]
2178 pub replace_where: Option<Box<Expression>>,
2179 #[serde(default)]
2181 pub source: Option<Box<Expression>>,
2182 #[serde(default, skip_serializing_if = "Option::is_none")]
2184 pub function_target: Option<Box<Expression>>,
2185 #[serde(default, skip_serializing_if = "Option::is_none")]
2187 pub partition_by: Option<Box<Expression>>,
2188 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2190 pub settings: Vec<Expression>,
2191}
2192
2193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2195#[cfg_attr(feature = "bindings", derive(TS))]
2196pub struct OutputClause {
2197 pub columns: Vec<Expression>,
2199 #[serde(default)]
2201 pub into_table: Option<Expression>,
2202}
2203
2204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2206#[cfg_attr(feature = "bindings", derive(TS))]
2207pub struct Update {
2208 pub table: TableRef,
2209 #[serde(default)]
2211 pub extra_tables: Vec<TableRef>,
2212 #[serde(default)]
2214 pub table_joins: Vec<Join>,
2215 pub set: Vec<(Identifier, Expression)>,
2216 pub from_clause: Option<From>,
2217 #[serde(default)]
2219 pub from_joins: Vec<Join>,
2220 pub where_clause: Option<Where>,
2221 #[serde(default)]
2223 pub returning: Vec<Expression>,
2224 #[serde(default)]
2226 pub output: Option<OutputClause>,
2227 #[serde(default)]
2229 pub with: Option<With>,
2230 #[serde(default)]
2232 pub leading_comments: Vec<String>,
2233 #[serde(default)]
2235 pub limit: Option<Expression>,
2236 #[serde(default)]
2238 pub order_by: Option<OrderBy>,
2239 #[serde(default)]
2241 pub from_before_set: bool,
2242}
2243
2244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2246#[cfg_attr(feature = "bindings", derive(TS))]
2247pub struct Delete {
2248 pub table: TableRef,
2249 #[serde(default, skip_serializing_if = "Option::is_none")]
2251 pub on_cluster: Option<OnCluster>,
2252 pub alias: Option<Identifier>,
2254 #[serde(default)]
2256 pub alias_explicit_as: bool,
2257 pub using: Vec<TableRef>,
2259 pub where_clause: Option<Where>,
2260 #[serde(default)]
2262 pub output: Option<OutputClause>,
2263 #[serde(default)]
2265 pub leading_comments: Vec<String>,
2266 #[serde(default)]
2268 pub with: Option<With>,
2269 #[serde(default)]
2271 pub limit: Option<Expression>,
2272 #[serde(default)]
2274 pub order_by: Option<OrderBy>,
2275 #[serde(default)]
2277 pub returning: Vec<Expression>,
2278 #[serde(default)]
2281 pub tables: Vec<TableRef>,
2282 #[serde(default)]
2285 pub tables_from_using: bool,
2286 #[serde(default)]
2288 pub joins: Vec<Join>,
2289 #[serde(default)]
2291 pub force_index: Option<String>,
2292 #[serde(default)]
2294 pub no_from: bool,
2295}
2296
2297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2299#[cfg_attr(feature = "bindings", derive(TS))]
2300pub struct CopyStmt {
2301 pub this: Expression,
2303 pub kind: bool,
2305 pub files: Vec<Expression>,
2307 #[serde(default)]
2309 pub params: Vec<CopyParameter>,
2310 #[serde(default)]
2312 pub credentials: Option<Box<Credentials>>,
2313 #[serde(default)]
2315 pub is_into: bool,
2316 #[serde(default)]
2318 pub with_wrapped: bool,
2319}
2320
2321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2323#[cfg_attr(feature = "bindings", derive(TS))]
2324pub struct CopyParameter {
2325 pub name: String,
2326 pub value: Option<Expression>,
2327 pub values: Vec<Expression>,
2328 #[serde(default)]
2330 pub eq: bool,
2331}
2332
2333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2335#[cfg_attr(feature = "bindings", derive(TS))]
2336pub struct Credentials {
2337 pub credentials: Vec<(String, String)>,
2338 pub encryption: Option<String>,
2339 pub storage: Option<String>,
2340}
2341
2342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2344#[cfg_attr(feature = "bindings", derive(TS))]
2345pub struct PutStmt {
2346 pub source: String,
2348 #[serde(default)]
2350 pub source_quoted: bool,
2351 pub target: Expression,
2353 #[serde(default)]
2355 pub params: Vec<CopyParameter>,
2356}
2357
2358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2360#[cfg_attr(feature = "bindings", derive(TS))]
2361pub struct StageReference {
2362 pub name: String,
2364 #[serde(default)]
2366 pub path: Option<String>,
2367 #[serde(default)]
2369 pub file_format: Option<Expression>,
2370 #[serde(default)]
2372 pub pattern: Option<String>,
2373 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2375 pub quoted: bool,
2376}
2377
2378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2380#[cfg_attr(feature = "bindings", derive(TS))]
2381pub struct HistoricalData {
2382 pub this: Box<Expression>,
2384 pub kind: String,
2386 pub expression: Box<Expression>,
2388}
2389
2390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2395#[cfg_attr(feature = "bindings", derive(TS))]
2396pub struct Alias {
2397 pub this: Expression,
2399 pub alias: Identifier,
2401 #[serde(default)]
2403 pub column_aliases: Vec<Identifier>,
2404 #[serde(default)]
2406 pub pre_alias_comments: Vec<String>,
2407 #[serde(default)]
2409 pub trailing_comments: Vec<String>,
2410}
2411
2412impl Alias {
2413 pub fn new(this: Expression, alias: Identifier) -> Self {
2415 Self {
2416 this,
2417 alias,
2418 column_aliases: Vec::new(),
2419 pre_alias_comments: Vec::new(),
2420 trailing_comments: Vec::new(),
2421 }
2422 }
2423
2424 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
2426 Self {
2427 this,
2428 alias: Identifier::empty(),
2429 column_aliases,
2430 pre_alias_comments: Vec::new(),
2431 trailing_comments: Vec::new(),
2432 }
2433 }
2434}
2435
2436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2443#[cfg_attr(feature = "bindings", derive(TS))]
2444pub struct Cast {
2445 pub this: Expression,
2447 pub to: DataType,
2449 #[serde(default)]
2450 pub trailing_comments: Vec<String>,
2451 #[serde(default)]
2453 pub double_colon_syntax: bool,
2454 #[serde(skip_serializing_if = "Option::is_none", default)]
2456 pub format: Option<Box<Expression>>,
2457 #[serde(skip_serializing_if = "Option::is_none", default)]
2459 pub default: Option<Box<Expression>>,
2460}
2461
2462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2464#[cfg_attr(feature = "bindings", derive(TS))]
2465pub struct CollationExpr {
2466 pub this: Expression,
2467 pub collation: String,
2468 #[serde(default)]
2470 pub quoted: bool,
2471 #[serde(default)]
2473 pub double_quoted: bool,
2474}
2475
2476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2482#[cfg_attr(feature = "bindings", derive(TS))]
2483pub struct Case {
2484 pub operand: Option<Expression>,
2486 pub whens: Vec<(Expression, Expression)>,
2488 pub else_: Option<Expression>,
2490}
2491
2492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2500#[cfg_attr(feature = "bindings", derive(TS))]
2501pub struct BinaryOp {
2502 pub left: Expression,
2503 pub right: Expression,
2504 #[serde(default)]
2506 pub left_comments: Vec<String>,
2507 #[serde(default)]
2509 pub operator_comments: Vec<String>,
2510 #[serde(default)]
2512 pub trailing_comments: Vec<String>,
2513}
2514
2515impl BinaryOp {
2516 pub fn new(left: Expression, right: Expression) -> Self {
2517 Self {
2518 left,
2519 right,
2520 left_comments: Vec::new(),
2521 operator_comments: Vec::new(),
2522 trailing_comments: Vec::new(),
2523 }
2524 }
2525}
2526
2527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2529#[cfg_attr(feature = "bindings", derive(TS))]
2530pub struct LikeOp {
2531 pub left: Expression,
2532 pub right: Expression,
2533 #[serde(default)]
2535 pub escape: Option<Expression>,
2536 #[serde(default)]
2538 pub quantifier: Option<String>,
2539}
2540
2541impl LikeOp {
2542 pub fn new(left: Expression, right: Expression) -> Self {
2543 Self {
2544 left,
2545 right,
2546 escape: None,
2547 quantifier: None,
2548 }
2549 }
2550
2551 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
2552 Self {
2553 left,
2554 right,
2555 escape: Some(escape),
2556 quantifier: None,
2557 }
2558 }
2559}
2560
2561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2565#[cfg_attr(feature = "bindings", derive(TS))]
2566pub struct UnaryOp {
2567 pub this: Expression,
2569}
2570
2571impl UnaryOp {
2572 pub fn new(this: Expression) -> Self {
2573 Self { this }
2574 }
2575}
2576
2577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2582#[cfg_attr(feature = "bindings", derive(TS))]
2583pub struct In {
2584 pub this: Expression,
2586 pub expressions: Vec<Expression>,
2588 pub query: Option<Expression>,
2590 pub not: bool,
2592 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2593 pub global: bool,
2594 #[serde(default, skip_serializing_if = "Option::is_none")]
2596 pub unnest: Option<Box<Expression>>,
2597}
2598
2599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2601#[cfg_attr(feature = "bindings", derive(TS))]
2602pub struct Between {
2603 pub this: Expression,
2605 pub low: Expression,
2607 pub high: Expression,
2609 pub not: bool,
2611}
2612
2613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2615#[cfg_attr(feature = "bindings", derive(TS))]
2616pub struct IsNull {
2617 pub this: Expression,
2618 pub not: bool,
2619 #[serde(default)]
2621 pub postfix_form: bool,
2622}
2623
2624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2626#[cfg_attr(feature = "bindings", derive(TS))]
2627pub struct IsTrueFalse {
2628 pub this: Expression,
2629 pub not: bool,
2630}
2631
2632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2635#[cfg_attr(feature = "bindings", derive(TS))]
2636pub struct IsJson {
2637 pub this: Expression,
2638 pub json_type: Option<String>,
2640 pub unique_keys: Option<JsonUniqueKeys>,
2642 pub negated: bool,
2644}
2645
2646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2648#[cfg_attr(feature = "bindings", derive(TS))]
2649pub enum JsonUniqueKeys {
2650 With,
2652 Without,
2654 Shorthand,
2656}
2657
2658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2660#[cfg_attr(feature = "bindings", derive(TS))]
2661pub struct Exists {
2662 pub this: Expression,
2664 pub not: bool,
2666}
2667
2668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2675#[cfg_attr(feature = "bindings", derive(TS))]
2676pub struct Function {
2677 pub name: String,
2679 pub args: Vec<Expression>,
2681 pub distinct: bool,
2683 #[serde(default)]
2684 pub trailing_comments: Vec<String>,
2685 #[serde(default)]
2687 pub use_bracket_syntax: bool,
2688 #[serde(default)]
2690 pub no_parens: bool,
2691 #[serde(default)]
2693 pub quoted: bool,
2694}
2695
2696impl Default for Function {
2697 fn default() -> Self {
2698 Self {
2699 name: String::new(),
2700 args: Vec::new(),
2701 distinct: false,
2702 trailing_comments: Vec::new(),
2703 use_bracket_syntax: false,
2704 no_parens: false,
2705 quoted: false,
2706 }
2707 }
2708}
2709
2710impl Function {
2711 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
2712 Self {
2713 name: name.into(),
2714 args,
2715 distinct: false,
2716 trailing_comments: Vec::new(),
2717 use_bracket_syntax: false,
2718 no_parens: false,
2719 quoted: false,
2720 }
2721 }
2722}
2723
2724#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
2731#[cfg_attr(feature = "bindings", derive(TS))]
2732pub struct AggregateFunction {
2733 pub name: String,
2735 pub args: Vec<Expression>,
2737 pub distinct: bool,
2739 pub filter: Option<Expression>,
2741 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2743 pub order_by: Vec<Ordered>,
2744 #[serde(default, skip_serializing_if = "Option::is_none")]
2746 pub limit: Option<Box<Expression>>,
2747 #[serde(default, skip_serializing_if = "Option::is_none")]
2749 pub ignore_nulls: Option<bool>,
2750}
2751
2752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2759#[cfg_attr(feature = "bindings", derive(TS))]
2760pub struct WindowFunction {
2761 pub this: Expression,
2763 pub over: Over,
2765 #[serde(default, skip_serializing_if = "Option::is_none")]
2767 pub keep: Option<Keep>,
2768}
2769
2770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2773#[cfg_attr(feature = "bindings", derive(TS))]
2774pub struct Keep {
2775 pub first: bool,
2777 pub order_by: Vec<Ordered>,
2779}
2780
2781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2783#[cfg_attr(feature = "bindings", derive(TS))]
2784pub struct WithinGroup {
2785 pub this: Expression,
2787 pub order_by: Vec<Ordered>,
2789}
2790
2791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2796#[cfg_attr(feature = "bindings", derive(TS))]
2797pub struct From {
2798 pub expressions: Vec<Expression>,
2800}
2801
2802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2808#[cfg_attr(feature = "bindings", derive(TS))]
2809pub struct Join {
2810 pub this: Expression,
2812 pub on: Option<Expression>,
2814 pub using: Vec<Identifier>,
2816 pub kind: JoinKind,
2818 pub use_inner_keyword: bool,
2820 pub use_outer_keyword: bool,
2822 pub deferred_condition: bool,
2824 #[serde(default, skip_serializing_if = "Option::is_none")]
2826 pub join_hint: Option<String>,
2827 #[serde(default, skip_serializing_if = "Option::is_none")]
2829 pub match_condition: Option<Expression>,
2830 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2832 pub pivots: Vec<Expression>,
2833}
2834
2835#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2842#[cfg_attr(feature = "bindings", derive(TS))]
2843pub enum JoinKind {
2844 Inner,
2845 Left,
2846 Right,
2847 Full,
2848 Outer, Cross,
2850 Natural,
2851 NaturalLeft,
2852 NaturalRight,
2853 NaturalFull,
2854 Semi,
2855 Anti,
2856 LeftSemi,
2858 LeftAnti,
2859 RightSemi,
2860 RightAnti,
2861 CrossApply,
2863 OuterApply,
2864 AsOf,
2866 AsOfLeft,
2867 AsOfRight,
2868 Lateral,
2870 LeftLateral,
2871 Straight,
2873 Implicit,
2875 Array,
2877 LeftArray,
2878}
2879
2880impl Default for JoinKind {
2881 fn default() -> Self {
2882 JoinKind::Inner
2883 }
2884}
2885
2886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2889#[cfg_attr(feature = "bindings", derive(TS))]
2890pub struct JoinedTable {
2891 pub left: Expression,
2893 pub joins: Vec<Join>,
2895 pub lateral_views: Vec<LateralView>,
2897 pub alias: Option<Identifier>,
2899}
2900
2901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2903#[cfg_attr(feature = "bindings", derive(TS))]
2904pub struct Where {
2905 pub this: Expression,
2907}
2908
2909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2914#[cfg_attr(feature = "bindings", derive(TS))]
2915pub struct GroupBy {
2916 pub expressions: Vec<Expression>,
2918 #[serde(default)]
2920 pub all: Option<bool>,
2921 #[serde(default)]
2923 pub totals: bool,
2924}
2925
2926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2928#[cfg_attr(feature = "bindings", derive(TS))]
2929pub struct Having {
2930 pub this: Expression,
2932}
2933
2934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2936#[cfg_attr(feature = "bindings", derive(TS))]
2937pub struct OrderBy {
2938 pub expressions: Vec<Ordered>,
2940 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2942 pub siblings: bool,
2943}
2944
2945#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2952#[cfg_attr(feature = "bindings", derive(TS))]
2953pub struct Ordered {
2954 pub this: Expression,
2956 pub desc: bool,
2958 pub nulls_first: Option<bool>,
2960 #[serde(default)]
2962 pub explicit_asc: bool,
2963 #[serde(default, skip_serializing_if = "Option::is_none")]
2965 pub with_fill: Option<Box<WithFill>>,
2966}
2967
2968impl Ordered {
2969 pub fn asc(expr: Expression) -> Self {
2970 Self {
2971 this: expr,
2972 desc: false,
2973 nulls_first: None,
2974 explicit_asc: false,
2975 with_fill: None,
2976 }
2977 }
2978
2979 pub fn desc(expr: Expression) -> Self {
2980 Self {
2981 this: expr,
2982 desc: true,
2983 nulls_first: None,
2984 explicit_asc: false,
2985 with_fill: None,
2986 }
2987 }
2988}
2989
2990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2993#[cfg_attr(feature = "bindings", derive(TS))]
2994#[cfg_attr(feature = "bindings", ts(export))]
2995pub struct DistributeBy {
2996 pub expressions: Vec<Expression>,
2997}
2998
2999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3002#[cfg_attr(feature = "bindings", derive(TS))]
3003#[cfg_attr(feature = "bindings", ts(export))]
3004pub struct ClusterBy {
3005 pub expressions: Vec<Ordered>,
3006}
3007
3008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3011#[cfg_attr(feature = "bindings", derive(TS))]
3012#[cfg_attr(feature = "bindings", ts(export))]
3013pub struct SortBy {
3014 pub expressions: Vec<Ordered>,
3015}
3016
3017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3020#[cfg_attr(feature = "bindings", derive(TS))]
3021#[cfg_attr(feature = "bindings", ts(export))]
3022pub struct LateralView {
3023 pub this: Expression,
3025 pub table_alias: Option<Identifier>,
3027 pub column_aliases: Vec<Identifier>,
3029 pub outer: bool,
3031}
3032
3033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3035#[cfg_attr(feature = "bindings", derive(TS))]
3036#[cfg_attr(feature = "bindings", ts(export))]
3037pub struct Hint {
3038 pub expressions: Vec<HintExpression>,
3039}
3040
3041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3043#[cfg_attr(feature = "bindings", derive(TS))]
3044#[cfg_attr(feature = "bindings", ts(export))]
3045pub enum HintExpression {
3046 Function { name: String, args: Vec<Expression> },
3048 Identifier(String),
3050 Raw(String),
3052}
3053
3054#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3056#[cfg_attr(feature = "bindings", derive(TS))]
3057#[cfg_attr(feature = "bindings", ts(export))]
3058pub enum PseudocolumnType {
3059 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
3066
3067impl PseudocolumnType {
3068 pub fn as_str(&self) -> &'static str {
3069 match self {
3070 PseudocolumnType::Rownum => "ROWNUM",
3071 PseudocolumnType::Rowid => "ROWID",
3072 PseudocolumnType::Level => "LEVEL",
3073 PseudocolumnType::Sysdate => "SYSDATE",
3074 PseudocolumnType::ObjectId => "OBJECT_ID",
3075 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
3076 }
3077 }
3078
3079 pub fn from_str(s: &str) -> Option<Self> {
3080 match s.to_uppercase().as_str() {
3081 "ROWNUM" => Some(PseudocolumnType::Rownum),
3082 "ROWID" => Some(PseudocolumnType::Rowid),
3083 "LEVEL" => Some(PseudocolumnType::Level),
3084 "SYSDATE" => Some(PseudocolumnType::Sysdate),
3085 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
3086 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
3087 _ => None,
3088 }
3089 }
3090}
3091
3092#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3095#[cfg_attr(feature = "bindings", derive(TS))]
3096#[cfg_attr(feature = "bindings", ts(export))]
3097pub struct Pseudocolumn {
3098 pub kind: PseudocolumnType,
3099}
3100
3101impl Pseudocolumn {
3102 pub fn rownum() -> Self {
3103 Self { kind: PseudocolumnType::Rownum }
3104 }
3105
3106 pub fn rowid() -> Self {
3107 Self { kind: PseudocolumnType::Rowid }
3108 }
3109
3110 pub fn level() -> Self {
3111 Self { kind: PseudocolumnType::Level }
3112 }
3113}
3114
3115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3117#[cfg_attr(feature = "bindings", derive(TS))]
3118#[cfg_attr(feature = "bindings", ts(export))]
3119pub struct Connect {
3120 pub start: Option<Expression>,
3122 pub connect: Expression,
3124 pub nocycle: bool,
3126}
3127
3128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3130#[cfg_attr(feature = "bindings", derive(TS))]
3131#[cfg_attr(feature = "bindings", ts(export))]
3132pub struct Prior {
3133 pub this: Expression,
3134}
3135
3136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3138#[cfg_attr(feature = "bindings", derive(TS))]
3139#[cfg_attr(feature = "bindings", ts(export))]
3140pub struct ConnectByRoot {
3141 pub this: Expression,
3142}
3143
3144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3146#[cfg_attr(feature = "bindings", derive(TS))]
3147#[cfg_attr(feature = "bindings", ts(export))]
3148pub struct MatchRecognize {
3149 pub this: Option<Box<Expression>>,
3151 pub partition_by: Option<Vec<Expression>>,
3153 pub order_by: Option<Vec<Ordered>>,
3155 pub measures: Option<Vec<MatchRecognizeMeasure>>,
3157 pub rows: Option<MatchRecognizeRows>,
3159 pub after: Option<MatchRecognizeAfter>,
3161 pub pattern: Option<String>,
3163 pub define: Option<Vec<(Identifier, Expression)>>,
3165 pub alias: Option<Identifier>,
3167 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3169 pub alias_explicit_as: bool,
3170}
3171
3172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3174#[cfg_attr(feature = "bindings", derive(TS))]
3175#[cfg_attr(feature = "bindings", ts(export))]
3176pub struct MatchRecognizeMeasure {
3177 pub this: Expression,
3179 pub window_frame: Option<MatchRecognizeSemantics>,
3181}
3182
3183#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3185#[cfg_attr(feature = "bindings", derive(TS))]
3186#[cfg_attr(feature = "bindings", ts(export))]
3187pub enum MatchRecognizeSemantics {
3188 Running,
3189 Final,
3190}
3191
3192#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3194#[cfg_attr(feature = "bindings", derive(TS))]
3195#[cfg_attr(feature = "bindings", ts(export))]
3196pub enum MatchRecognizeRows {
3197 OneRowPerMatch,
3198 AllRowsPerMatch,
3199 AllRowsPerMatchShowEmptyMatches,
3200 AllRowsPerMatchOmitEmptyMatches,
3201 AllRowsPerMatchWithUnmatchedRows,
3202}
3203
3204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3206#[cfg_attr(feature = "bindings", derive(TS))]
3207#[cfg_attr(feature = "bindings", ts(export))]
3208pub enum MatchRecognizeAfter {
3209 PastLastRow,
3210 ToNextRow,
3211 ToFirst(Identifier),
3212 ToLast(Identifier),
3213}
3214
3215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3217#[cfg_attr(feature = "bindings", derive(TS))]
3218pub struct Limit {
3219 pub this: Expression,
3221 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3223 pub percent: bool,
3224}
3225
3226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3228#[cfg_attr(feature = "bindings", derive(TS))]
3229pub struct Offset {
3230 pub this: Expression,
3231 #[serde(skip_serializing_if = "Option::is_none", default)]
3233 pub rows: Option<bool>,
3234}
3235
3236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3238#[cfg_attr(feature = "bindings", derive(TS))]
3239pub struct Top {
3240 pub this: Expression,
3241 pub percent: bool,
3242 pub with_ties: bool,
3243 #[serde(default)]
3245 pub parenthesized: bool,
3246}
3247
3248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3250#[cfg_attr(feature = "bindings", derive(TS))]
3251pub struct Fetch {
3252 pub direction: String,
3254 pub count: Option<Expression>,
3256 pub percent: bool,
3258 pub rows: bool,
3260 pub with_ties: bool,
3262}
3263
3264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3270#[cfg_attr(feature = "bindings", derive(TS))]
3271pub struct Qualify {
3272 pub this: Expression,
3274}
3275
3276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3278#[cfg_attr(feature = "bindings", derive(TS))]
3279pub struct Sample {
3280 pub method: SampleMethod,
3281 pub size: Expression,
3282 pub seed: Option<Expression>,
3283 #[serde(default)]
3285 pub offset: Option<Expression>,
3286 pub unit_after_size: bool,
3288 #[serde(default)]
3290 pub use_sample_keyword: bool,
3291 #[serde(default)]
3293 pub explicit_method: bool,
3294 #[serde(default)]
3296 pub method_before_size: bool,
3297 #[serde(default)]
3299 pub use_seed_keyword: bool,
3300 pub bucket_numerator: Option<Box<Expression>>,
3302 pub bucket_denominator: Option<Box<Expression>>,
3304 pub bucket_field: Option<Box<Expression>>,
3306 #[serde(default)]
3308 pub is_using_sample: bool,
3309 #[serde(default)]
3311 pub is_percent: bool,
3312 #[serde(default)]
3314 pub suppress_method_output: bool,
3315}
3316
3317#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3319#[cfg_attr(feature = "bindings", derive(TS))]
3320pub enum SampleMethod {
3321 Bernoulli,
3322 System,
3323 Block,
3324 Row,
3325 Percent,
3326 Bucket,
3328 Reservoir,
3330}
3331
3332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3334#[cfg_attr(feature = "bindings", derive(TS))]
3335pub struct NamedWindow {
3336 pub name: Identifier,
3337 pub spec: Over,
3338}
3339
3340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3346#[cfg_attr(feature = "bindings", derive(TS))]
3347pub struct With {
3348 pub ctes: Vec<Cte>,
3350 pub recursive: bool,
3352 #[serde(default)]
3354 pub leading_comments: Vec<String>,
3355 #[serde(default, skip_serializing_if = "Option::is_none")]
3357 pub search: Option<Box<Expression>>,
3358}
3359
3360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3367#[cfg_attr(feature = "bindings", derive(TS))]
3368pub struct Cte {
3369 pub alias: Identifier,
3371 pub this: Expression,
3373 pub columns: Vec<Identifier>,
3375 pub materialized: Option<bool>,
3377 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3379 pub key_expressions: Vec<Identifier>,
3380 #[serde(default)]
3382 pub alias_first: bool,
3383}
3384
3385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3387#[cfg_attr(feature = "bindings", derive(TS))]
3388pub struct WindowSpec {
3389 pub partition_by: Vec<Expression>,
3390 pub order_by: Vec<Ordered>,
3391 pub frame: Option<WindowFrame>,
3392}
3393
3394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3396#[cfg_attr(feature = "bindings", derive(TS))]
3397pub struct Over {
3398 pub window_name: Option<Identifier>,
3400 pub partition_by: Vec<Expression>,
3401 pub order_by: Vec<Ordered>,
3402 pub frame: Option<WindowFrame>,
3403 pub alias: Option<Identifier>,
3404}
3405
3406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3408#[cfg_attr(feature = "bindings", derive(TS))]
3409pub struct WindowFrame {
3410 pub kind: WindowFrameKind,
3411 pub start: WindowFrameBound,
3412 pub end: Option<WindowFrameBound>,
3413 pub exclude: Option<WindowFrameExclude>,
3414 #[serde(default, skip_serializing_if = "Option::is_none")]
3416 pub kind_text: Option<String>,
3417 #[serde(default, skip_serializing_if = "Option::is_none")]
3419 pub start_side_text: Option<String>,
3420 #[serde(default, skip_serializing_if = "Option::is_none")]
3422 pub end_side_text: Option<String>,
3423}
3424
3425#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3426#[cfg_attr(feature = "bindings", derive(TS))]
3427pub enum WindowFrameKind {
3428 Rows,
3429 Range,
3430 Groups,
3431}
3432
3433#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3435#[cfg_attr(feature = "bindings", derive(TS))]
3436pub enum WindowFrameExclude {
3437 CurrentRow,
3438 Group,
3439 Ties,
3440 NoOthers,
3441}
3442
3443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3444#[cfg_attr(feature = "bindings", derive(TS))]
3445pub enum WindowFrameBound {
3446 CurrentRow,
3447 UnboundedPreceding,
3448 UnboundedFollowing,
3449 Preceding(Box<Expression>),
3450 Following(Box<Expression>),
3451 BarePreceding,
3453 BareFollowing,
3455 Value(Box<Expression>),
3457}
3458
3459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3461#[cfg_attr(feature = "bindings", derive(TS))]
3462pub struct StructField {
3463 pub name: String,
3464 pub data_type: DataType,
3465 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3466 pub options: Vec<Expression>,
3467 #[serde(default, skip_serializing_if = "Option::is_none")]
3468 pub comment: Option<String>,
3469}
3470
3471impl StructField {
3472 pub fn new(name: String, data_type: DataType) -> Self {
3474 Self { name, data_type, options: Vec::new(), comment: None }
3475 }
3476
3477 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
3479 Self { name, data_type, options, comment: None }
3480 }
3481
3482 pub fn with_options_and_comment(name: String, data_type: DataType, options: Vec<Expression>, comment: Option<String>) -> Self {
3484 Self { name, data_type, options, comment }
3485 }
3486}
3487
3488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3500#[cfg_attr(feature = "bindings", derive(TS))]
3501#[serde(tag = "data_type", rename_all = "snake_case")]
3502pub enum DataType {
3503 Boolean,
3505 TinyInt { length: Option<u32> },
3506 SmallInt { length: Option<u32> },
3507 Int { length: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] integer_spelling: bool },
3511 BigInt { length: Option<u32> },
3512 Float { precision: Option<u32>, scale: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] real_spelling: bool },
3516 Double { precision: Option<u32>, scale: Option<u32> },
3517 Decimal { precision: Option<u32>, scale: Option<u32> },
3518
3519 Char { length: Option<u32> },
3521 VarChar { length: Option<u32>, #[serde(default, skip_serializing_if = "std::ops::Not::not")] parenthesized_length: bool },
3524 String { length: Option<u32> },
3526 Text,
3527
3528 Binary { length: Option<u32> },
3530 VarBinary { length: Option<u32> },
3531 Blob,
3532
3533 Bit { length: Option<u32> },
3535 VarBit { length: Option<u32> },
3536
3537 Date,
3539 Time { precision: Option<u32>, #[serde(default)] timezone: bool },
3540 Timestamp { precision: Option<u32>, timezone: bool },
3541 Interval {
3542 unit: Option<String>,
3543 #[serde(default, skip_serializing_if = "Option::is_none")]
3545 to: Option<String>,
3546 },
3547
3548 Json,
3550 JsonB,
3551
3552 Uuid,
3554
3555 Array {
3557 element_type: Box<DataType>,
3558 #[serde(default, skip_serializing_if = "Option::is_none")]
3560 dimension: Option<u32>,
3561 },
3562
3563 List {
3566 element_type: Box<DataType>,
3567 },
3568
3569 Struct { fields: Vec<StructField>, nested: bool },
3573 Map { key_type: Box<DataType>, value_type: Box<DataType> },
3574
3575 Enum { values: Vec<String>, #[serde(default, skip_serializing_if = "Vec::is_empty")] assignments: Vec<Option<String>> },
3577
3578 Set { values: Vec<String> },
3580
3581 Union { fields: Vec<(String, DataType)> },
3583
3584 Vector { #[serde(default)] element_type: Option<Box<DataType>>, dimension: Option<u32> },
3586
3587 Object { fields: Vec<(String, DataType, bool)>, modifier: Option<String> },
3590
3591 Custom { name: String },
3593
3594 Geometry {
3596 subtype: Option<String>,
3597 srid: Option<u32>,
3598 },
3599 Geography {
3600 subtype: Option<String>,
3601 srid: Option<u32>,
3602 },
3603
3604 CharacterSet { name: String },
3607
3608 Unknown,
3610}
3611
3612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3614#[cfg_attr(feature = "bindings", derive(TS))]
3615#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
3616pub struct Array {
3617 pub expressions: Vec<Expression>,
3618}
3619
3620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3622#[cfg_attr(feature = "bindings", derive(TS))]
3623pub struct Struct {
3624 pub fields: Vec<(Option<String>, Expression)>,
3625}
3626
3627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3629#[cfg_attr(feature = "bindings", derive(TS))]
3630pub struct Tuple {
3631 pub expressions: Vec<Expression>,
3632}
3633
3634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3636#[cfg_attr(feature = "bindings", derive(TS))]
3637pub struct Interval {
3638 pub this: Option<Expression>,
3640 pub unit: Option<IntervalUnitSpec>,
3642}
3643
3644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3646#[cfg_attr(feature = "bindings", derive(TS))]
3647#[serde(tag = "type", rename_all = "snake_case")]
3648pub enum IntervalUnitSpec {
3649 Simple {
3651 unit: IntervalUnit,
3652 use_plural: bool,
3654 },
3655 Span(IntervalSpan),
3657 ExprSpan(IntervalSpanExpr),
3660 Expr(Box<Expression>),
3662}
3663
3664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3666#[cfg_attr(feature = "bindings", derive(TS))]
3667pub struct IntervalSpan {
3668 pub this: IntervalUnit,
3670 pub expression: IntervalUnit,
3672}
3673
3674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3677#[cfg_attr(feature = "bindings", derive(TS))]
3678pub struct IntervalSpanExpr {
3679 pub this: Box<Expression>,
3681 pub expression: Box<Expression>,
3683}
3684
3685#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3686#[cfg_attr(feature = "bindings", derive(TS))]
3687pub enum IntervalUnit {
3688 Year,
3689 Quarter,
3690 Month,
3691 Week,
3692 Day,
3693 Hour,
3694 Minute,
3695 Second,
3696 Millisecond,
3697 Microsecond,
3698}
3699
3700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3702#[cfg_attr(feature = "bindings", derive(TS))]
3703pub struct Command {
3704 pub this: String,
3706}
3707
3708#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3711#[cfg_attr(feature = "bindings", derive(TS))]
3712pub struct ExecuteStatement {
3713 pub this: Expression,
3715 #[serde(default)]
3717 pub parameters: Vec<ExecuteParameter>,
3718}
3719
3720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3722#[cfg_attr(feature = "bindings", derive(TS))]
3723pub struct ExecuteParameter {
3724 pub name: String,
3726 pub value: Expression,
3728}
3729
3730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3733#[cfg_attr(feature = "bindings", derive(TS))]
3734pub struct Kill {
3735 pub this: Expression,
3737 pub kind: Option<String>,
3739}
3740
3741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3743#[cfg_attr(feature = "bindings", derive(TS))]
3744pub struct Raw {
3745 pub sql: String,
3746}
3747
3748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3754#[cfg_attr(feature = "bindings", derive(TS))]
3755pub struct UnaryFunc {
3756 pub this: Expression,
3757 #[serde(skip_serializing_if = "Option::is_none", default)]
3759 pub original_name: Option<String>,
3760}
3761
3762impl UnaryFunc {
3763 pub fn new(this: Expression) -> Self {
3765 Self { this, original_name: None }
3766 }
3767
3768 pub fn with_name(this: Expression, name: String) -> Self {
3770 Self { this, original_name: Some(name) }
3771 }
3772}
3773
3774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3778#[cfg_attr(feature = "bindings", derive(TS))]
3779pub struct CharFunc {
3780 pub args: Vec<Expression>,
3781 #[serde(skip_serializing_if = "Option::is_none", default)]
3782 pub charset: Option<String>,
3783 #[serde(skip_serializing_if = "Option::is_none", default)]
3785 pub name: Option<String>,
3786}
3787
3788#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3790#[cfg_attr(feature = "bindings", derive(TS))]
3791pub struct BinaryFunc {
3792 pub this: Expression,
3793 pub expression: Expression,
3794 #[serde(skip_serializing_if = "Option::is_none", default)]
3796 pub original_name: Option<String>,
3797}
3798
3799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3801#[cfg_attr(feature = "bindings", derive(TS))]
3802pub struct VarArgFunc {
3803 pub expressions: Vec<Expression>,
3804 #[serde(skip_serializing_if = "Option::is_none", default)]
3806 pub original_name: Option<String>,
3807}
3808
3809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3811#[cfg_attr(feature = "bindings", derive(TS))]
3812pub struct ConcatWs {
3813 pub separator: Expression,
3814 pub expressions: Vec<Expression>,
3815}
3816
3817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3819#[cfg_attr(feature = "bindings", derive(TS))]
3820pub struct SubstringFunc {
3821 pub this: Expression,
3822 pub start: Expression,
3823 pub length: Option<Expression>,
3824 #[serde(default)]
3826 pub from_for_syntax: bool,
3827}
3828
3829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3831#[cfg_attr(feature = "bindings", derive(TS))]
3832pub struct OverlayFunc {
3833 pub this: Expression,
3834 pub replacement: Expression,
3835 pub from: Expression,
3836 pub length: Option<Expression>,
3837}
3838
3839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3841#[cfg_attr(feature = "bindings", derive(TS))]
3842pub struct TrimFunc {
3843 pub this: Expression,
3844 pub characters: Option<Expression>,
3845 pub position: TrimPosition,
3846 #[serde(default)]
3848 pub sql_standard_syntax: bool,
3849 #[serde(default)]
3851 pub position_explicit: bool,
3852}
3853
3854#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3855#[cfg_attr(feature = "bindings", derive(TS))]
3856pub enum TrimPosition {
3857 Both,
3858 Leading,
3859 Trailing,
3860}
3861
3862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3864#[cfg_attr(feature = "bindings", derive(TS))]
3865pub struct ReplaceFunc {
3866 pub this: Expression,
3867 pub old: Expression,
3868 pub new: Expression,
3869}
3870
3871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3873#[cfg_attr(feature = "bindings", derive(TS))]
3874pub struct LeftRightFunc {
3875 pub this: Expression,
3876 pub length: Expression,
3877}
3878
3879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3881#[cfg_attr(feature = "bindings", derive(TS))]
3882pub struct RepeatFunc {
3883 pub this: Expression,
3884 pub times: Expression,
3885}
3886
3887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3889#[cfg_attr(feature = "bindings", derive(TS))]
3890pub struct PadFunc {
3891 pub this: Expression,
3892 pub length: Expression,
3893 pub fill: Option<Expression>,
3894}
3895
3896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3898#[cfg_attr(feature = "bindings", derive(TS))]
3899pub struct SplitFunc {
3900 pub this: Expression,
3901 pub delimiter: Expression,
3902}
3903
3904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3906#[cfg_attr(feature = "bindings", derive(TS))]
3907pub struct RegexpFunc {
3908 pub this: Expression,
3909 pub pattern: Expression,
3910 pub flags: Option<Expression>,
3911}
3912
3913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3915#[cfg_attr(feature = "bindings", derive(TS))]
3916pub struct RegexpReplaceFunc {
3917 pub this: Expression,
3918 pub pattern: Expression,
3919 pub replacement: Expression,
3920 pub flags: Option<Expression>,
3921}
3922
3923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3925#[cfg_attr(feature = "bindings", derive(TS))]
3926pub struct RegexpExtractFunc {
3927 pub this: Expression,
3928 pub pattern: Expression,
3929 pub group: Option<Expression>,
3930}
3931
3932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3934#[cfg_attr(feature = "bindings", derive(TS))]
3935pub struct RoundFunc {
3936 pub this: Expression,
3937 pub decimals: Option<Expression>,
3938}
3939
3940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3942#[cfg_attr(feature = "bindings", derive(TS))]
3943pub struct FloorFunc {
3944 pub this: Expression,
3945 pub scale: Option<Expression>,
3946 #[serde(skip_serializing_if = "Option::is_none", default)]
3948 pub to: Option<Expression>,
3949}
3950
3951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3953#[cfg_attr(feature = "bindings", derive(TS))]
3954pub struct CeilFunc {
3955 pub this: Expression,
3956 #[serde(skip_serializing_if = "Option::is_none", default)]
3957 pub decimals: Option<Expression>,
3958 #[serde(skip_serializing_if = "Option::is_none", default)]
3960 pub to: Option<Expression>,
3961}
3962
3963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3965#[cfg_attr(feature = "bindings", derive(TS))]
3966pub struct LogFunc {
3967 pub this: Expression,
3968 pub base: Option<Expression>,
3969}
3970
3971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3973#[cfg_attr(feature = "bindings", derive(TS))]
3974pub struct CurrentDate;
3975
3976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3978#[cfg_attr(feature = "bindings", derive(TS))]
3979pub struct CurrentTime {
3980 pub precision: Option<u32>,
3981}
3982
3983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3985#[cfg_attr(feature = "bindings", derive(TS))]
3986pub struct CurrentTimestamp {
3987 pub precision: Option<u32>,
3988 #[serde(default)]
3990 pub sysdate: bool,
3991}
3992
3993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3995#[cfg_attr(feature = "bindings", derive(TS))]
3996pub struct CurrentTimestampLTZ {
3997 pub precision: Option<u32>,
3998}
3999
4000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4002#[cfg_attr(feature = "bindings", derive(TS))]
4003pub struct AtTimeZone {
4004 pub this: Expression,
4006 pub zone: Expression,
4008}
4009
4010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4012#[cfg_attr(feature = "bindings", derive(TS))]
4013pub struct DateAddFunc {
4014 pub this: Expression,
4015 pub interval: Expression,
4016 pub unit: IntervalUnit,
4017}
4018
4019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4021#[cfg_attr(feature = "bindings", derive(TS))]
4022pub struct DateDiffFunc {
4023 pub this: Expression,
4024 pub expression: Expression,
4025 pub unit: Option<IntervalUnit>,
4026}
4027
4028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4030#[cfg_attr(feature = "bindings", derive(TS))]
4031pub struct DateTruncFunc {
4032 pub this: Expression,
4033 pub unit: DateTimeField,
4034}
4035
4036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4038#[cfg_attr(feature = "bindings", derive(TS))]
4039pub struct ExtractFunc {
4040 pub this: Expression,
4041 pub field: DateTimeField,
4042}
4043
4044#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4045#[cfg_attr(feature = "bindings", derive(TS))]
4046pub enum DateTimeField {
4047 Year,
4048 Month,
4049 Day,
4050 Hour,
4051 Minute,
4052 Second,
4053 Millisecond,
4054 Microsecond,
4055 DayOfWeek,
4056 DayOfYear,
4057 Week,
4058 WeekWithModifier(String),
4060 Quarter,
4061 Epoch,
4062 Timezone,
4063 TimezoneHour,
4064 TimezoneMinute,
4065 Date,
4066 Time,
4067 Custom(String),
4069}
4070
4071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4073#[cfg_attr(feature = "bindings", derive(TS))]
4074pub struct ToDateFunc {
4075 pub this: Expression,
4076 pub format: Option<Expression>,
4077}
4078
4079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4081#[cfg_attr(feature = "bindings", derive(TS))]
4082pub struct ToTimestampFunc {
4083 pub this: Expression,
4084 pub format: Option<Expression>,
4085}
4086
4087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4089#[cfg_attr(feature = "bindings", derive(TS))]
4090pub struct IfFunc {
4091 pub condition: Expression,
4092 pub true_value: Expression,
4093 pub false_value: Option<Expression>,
4094 #[serde(skip_serializing_if = "Option::is_none", default)]
4096 pub original_name: Option<String>,
4097}
4098
4099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4101#[cfg_attr(feature = "bindings", derive(TS))]
4102pub struct Nvl2Func {
4103 pub this: Expression,
4104 pub true_value: Expression,
4105 pub false_value: Expression,
4106}
4107
4108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4114#[cfg_attr(feature = "bindings", derive(TS))]
4115pub struct AggFunc {
4116 pub this: Expression,
4117 pub distinct: bool,
4118 pub filter: Option<Expression>,
4119 pub order_by: Vec<Ordered>,
4120 #[serde(skip_serializing_if = "Option::is_none", default)]
4122 pub name: Option<String>,
4123 #[serde(skip_serializing_if = "Option::is_none", default)]
4125 pub ignore_nulls: Option<bool>,
4126 #[serde(skip_serializing_if = "Option::is_none", default)]
4129 pub having_max: Option<(Box<Expression>, bool)>,
4130 #[serde(skip_serializing_if = "Option::is_none", default)]
4132 pub limit: Option<Box<Expression>>,
4133}
4134
4135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4137#[cfg_attr(feature = "bindings", derive(TS))]
4138pub struct CountFunc {
4139 pub this: Option<Expression>,
4140 pub star: bool,
4141 pub distinct: bool,
4142 pub filter: Option<Expression>,
4143 #[serde(default, skip_serializing_if = "Option::is_none")]
4145 pub ignore_nulls: Option<bool>,
4146 #[serde(default, skip_serializing_if = "Option::is_none")]
4148 pub original_name: Option<String>,
4149}
4150
4151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4153#[cfg_attr(feature = "bindings", derive(TS))]
4154pub struct GroupConcatFunc {
4155 pub this: Expression,
4156 pub separator: Option<Expression>,
4157 pub order_by: Option<Vec<Ordered>>,
4158 pub distinct: bool,
4159 pub filter: Option<Expression>,
4160}
4161
4162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4164#[cfg_attr(feature = "bindings", derive(TS))]
4165pub struct StringAggFunc {
4166 pub this: Expression,
4167 #[serde(default)]
4168 pub separator: Option<Expression>,
4169 #[serde(default)]
4170 pub order_by: Option<Vec<Ordered>>,
4171 #[serde(default)]
4172 pub distinct: bool,
4173 #[serde(default)]
4174 pub filter: Option<Expression>,
4175 #[serde(default, skip_serializing_if = "Option::is_none")]
4177 pub limit: Option<Box<Expression>>,
4178}
4179
4180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4182#[cfg_attr(feature = "bindings", derive(TS))]
4183pub struct ListAggFunc {
4184 pub this: Expression,
4185 pub separator: Option<Expression>,
4186 pub on_overflow: Option<ListAggOverflow>,
4187 pub order_by: Option<Vec<Ordered>>,
4188 pub distinct: bool,
4189 pub filter: Option<Expression>,
4190}
4191
4192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4194#[cfg_attr(feature = "bindings", derive(TS))]
4195pub enum ListAggOverflow {
4196 Error,
4197 Truncate {
4198 filler: Option<Expression>,
4199 with_count: bool,
4200 },
4201}
4202
4203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4205#[cfg_attr(feature = "bindings", derive(TS))]
4206pub struct SumIfFunc {
4207 pub this: Expression,
4208 pub condition: Expression,
4209 pub filter: Option<Expression>,
4210}
4211
4212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4214#[cfg_attr(feature = "bindings", derive(TS))]
4215pub struct ApproxPercentileFunc {
4216 pub this: Expression,
4217 pub percentile: Expression,
4218 pub accuracy: Option<Expression>,
4219 pub filter: Option<Expression>,
4220}
4221
4222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4224#[cfg_attr(feature = "bindings", derive(TS))]
4225pub struct PercentileFunc {
4226 pub this: Expression,
4227 pub percentile: Expression,
4228 pub order_by: Option<Vec<Ordered>>,
4229 pub filter: Option<Expression>,
4230}
4231
4232#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4238#[cfg_attr(feature = "bindings", derive(TS))]
4239pub struct RowNumber;
4240
4241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4243#[cfg_attr(feature = "bindings", derive(TS))]
4244pub struct Rank {
4245 #[serde(default, skip_serializing_if = "Option::is_none")]
4247 pub order_by: Option<Vec<Ordered>>,
4248 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4250 pub args: Vec<Expression>,
4251}
4252
4253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4255#[cfg_attr(feature = "bindings", derive(TS))]
4256pub struct DenseRank {
4257 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4259 pub args: Vec<Expression>,
4260}
4261
4262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4264#[cfg_attr(feature = "bindings", derive(TS))]
4265pub struct NTileFunc {
4266 #[serde(default, skip_serializing_if = "Option::is_none")]
4268 pub num_buckets: Option<Expression>,
4269 #[serde(default, skip_serializing_if = "Option::is_none")]
4271 pub order_by: Option<Vec<Ordered>>,
4272}
4273
4274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4276#[cfg_attr(feature = "bindings", derive(TS))]
4277pub struct LeadLagFunc {
4278 pub this: Expression,
4279 pub offset: Option<Expression>,
4280 pub default: Option<Expression>,
4281 pub ignore_nulls: bool,
4282}
4283
4284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4286#[cfg_attr(feature = "bindings", derive(TS))]
4287pub struct ValueFunc {
4288 pub this: Expression,
4289 #[serde(default, skip_serializing_if = "Option::is_none")]
4291 pub ignore_nulls: Option<bool>,
4292}
4293
4294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4296#[cfg_attr(feature = "bindings", derive(TS))]
4297pub struct NthValueFunc {
4298 pub this: Expression,
4299 pub offset: Expression,
4300 #[serde(default, skip_serializing_if = "Option::is_none")]
4302 pub ignore_nulls: Option<bool>,
4303}
4304
4305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4307#[cfg_attr(feature = "bindings", derive(TS))]
4308pub struct PercentRank {
4309 #[serde(default, skip_serializing_if = "Option::is_none")]
4311 pub order_by: Option<Vec<Ordered>>,
4312 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4314 pub args: Vec<Expression>,
4315}
4316
4317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4319#[cfg_attr(feature = "bindings", derive(TS))]
4320pub struct CumeDist {
4321 #[serde(default, skip_serializing_if = "Option::is_none")]
4323 pub order_by: Option<Vec<Ordered>>,
4324 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4326 pub args: Vec<Expression>,
4327}
4328
4329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4335#[cfg_attr(feature = "bindings", derive(TS))]
4336pub struct PositionFunc {
4337 pub substring: Expression,
4338 pub string: Expression,
4339 pub start: Option<Expression>,
4340}
4341
4342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4348#[cfg_attr(feature = "bindings", derive(TS))]
4349pub struct Random;
4350
4351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4353#[cfg_attr(feature = "bindings", derive(TS))]
4354pub struct Rand {
4355 pub seed: Option<Box<Expression>>,
4356 #[serde(default)]
4358 pub lower: Option<Box<Expression>>,
4359 #[serde(default)]
4361 pub upper: Option<Box<Expression>>,
4362}
4363
4364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4366#[cfg_attr(feature = "bindings", derive(TS))]
4367pub struct TruncateFunc {
4368 pub this: Expression,
4369 pub decimals: Option<Expression>,
4370}
4371
4372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4374#[cfg_attr(feature = "bindings", derive(TS))]
4375pub struct Pi;
4376
4377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4383#[cfg_attr(feature = "bindings", derive(TS))]
4384pub struct DecodeFunc {
4385 pub this: Expression,
4386 pub search_results: Vec<(Expression, Expression)>,
4387 pub default: Option<Expression>,
4388}
4389
4390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4396#[cfg_attr(feature = "bindings", derive(TS))]
4397pub struct DateFormatFunc {
4398 pub this: Expression,
4399 pub format: Expression,
4400}
4401
4402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4404#[cfg_attr(feature = "bindings", derive(TS))]
4405pub struct FromUnixtimeFunc {
4406 pub this: Expression,
4407 pub format: Option<Expression>,
4408}
4409
4410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4412#[cfg_attr(feature = "bindings", derive(TS))]
4413pub struct UnixTimestampFunc {
4414 pub this: Option<Expression>,
4415 pub format: Option<Expression>,
4416}
4417
4418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4420#[cfg_attr(feature = "bindings", derive(TS))]
4421pub struct MakeDateFunc {
4422 pub year: Expression,
4423 pub month: Expression,
4424 pub day: Expression,
4425}
4426
4427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4429#[cfg_attr(feature = "bindings", derive(TS))]
4430pub struct MakeTimestampFunc {
4431 pub year: Expression,
4432 pub month: Expression,
4433 pub day: Expression,
4434 pub hour: Expression,
4435 pub minute: Expression,
4436 pub second: Expression,
4437 pub timezone: Option<Expression>,
4438}
4439
4440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4442#[cfg_attr(feature = "bindings", derive(TS))]
4443pub struct LastDayFunc {
4444 pub this: Expression,
4445 #[serde(skip_serializing_if = "Option::is_none", default)]
4447 pub unit: Option<DateTimeField>,
4448}
4449
4450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4456#[cfg_attr(feature = "bindings", derive(TS))]
4457pub struct ArrayConstructor {
4458 pub expressions: Vec<Expression>,
4459 pub bracket_notation: bool,
4460 pub use_list_keyword: bool,
4462}
4463
4464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4466#[cfg_attr(feature = "bindings", derive(TS))]
4467pub struct ArraySortFunc {
4468 pub this: Expression,
4469 pub comparator: Option<Expression>,
4470 pub desc: bool,
4471 pub nulls_first: Option<bool>,
4472}
4473
4474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4476#[cfg_attr(feature = "bindings", derive(TS))]
4477pub struct ArrayJoinFunc {
4478 pub this: Expression,
4479 pub separator: Expression,
4480 pub null_replacement: Option<Expression>,
4481}
4482
4483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4485#[cfg_attr(feature = "bindings", derive(TS))]
4486pub struct UnnestFunc {
4487 pub this: Expression,
4488 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4490 pub expressions: Vec<Expression>,
4491 pub with_ordinality: bool,
4492 pub alias: Option<Identifier>,
4493 #[serde(default, skip_serializing_if = "Option::is_none")]
4495 pub offset_alias: Option<Identifier>,
4496}
4497
4498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4500#[cfg_attr(feature = "bindings", derive(TS))]
4501pub struct ArrayFilterFunc {
4502 pub this: Expression,
4503 pub filter: Expression,
4504}
4505
4506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4508#[cfg_attr(feature = "bindings", derive(TS))]
4509pub struct ArrayTransformFunc {
4510 pub this: Expression,
4511 pub transform: Expression,
4512}
4513
4514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4516#[cfg_attr(feature = "bindings", derive(TS))]
4517pub struct SequenceFunc {
4518 pub start: Expression,
4519 pub stop: Expression,
4520 pub step: Option<Expression>,
4521}
4522
4523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4529#[cfg_attr(feature = "bindings", derive(TS))]
4530pub struct StructConstructor {
4531 pub fields: Vec<(Option<Identifier>, Expression)>,
4532}
4533
4534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4536#[cfg_attr(feature = "bindings", derive(TS))]
4537pub struct StructExtractFunc {
4538 pub this: Expression,
4539 pub field: Identifier,
4540}
4541
4542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4544#[cfg_attr(feature = "bindings", derive(TS))]
4545pub struct NamedStructFunc {
4546 pub pairs: Vec<(Expression, Expression)>,
4547}
4548
4549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4555#[cfg_attr(feature = "bindings", derive(TS))]
4556pub struct MapConstructor {
4557 pub keys: Vec<Expression>,
4558 pub values: Vec<Expression>,
4559 #[serde(default)]
4561 pub curly_brace_syntax: bool,
4562 #[serde(default)]
4564 pub with_map_keyword: bool,
4565}
4566
4567#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4569#[cfg_attr(feature = "bindings", derive(TS))]
4570pub struct TransformFunc {
4571 pub this: Expression,
4572 pub transform: Expression,
4573}
4574
4575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4581#[cfg_attr(feature = "bindings", derive(TS))]
4582pub struct JsonExtractFunc {
4583 pub this: Expression,
4584 pub path: Expression,
4585 pub returning: Option<DataType>,
4586 #[serde(default)]
4588 pub arrow_syntax: bool,
4589 #[serde(default)]
4591 pub hash_arrow_syntax: bool,
4592 #[serde(default)]
4594 pub wrapper_option: Option<String>,
4595 #[serde(default)]
4597 pub quotes_option: Option<String>,
4598 #[serde(default)]
4600 pub on_scalar_string: bool,
4601 #[serde(default)]
4603 pub on_error: Option<String>,
4604}
4605
4606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4608#[cfg_attr(feature = "bindings", derive(TS))]
4609pub struct JsonPathFunc {
4610 pub this: Expression,
4611 pub paths: Vec<Expression>,
4612}
4613
4614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4616#[cfg_attr(feature = "bindings", derive(TS))]
4617pub struct JsonObjectFunc {
4618 pub pairs: Vec<(Expression, Expression)>,
4619 pub null_handling: Option<JsonNullHandling>,
4620 #[serde(default)]
4621 pub with_unique_keys: bool,
4622 #[serde(default)]
4623 pub returning_type: Option<DataType>,
4624 #[serde(default)]
4625 pub format_json: bool,
4626 #[serde(default)]
4627 pub encoding: Option<String>,
4628 #[serde(default)]
4630 pub star: bool,
4631}
4632
4633#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4635#[cfg_attr(feature = "bindings", derive(TS))]
4636pub enum JsonNullHandling {
4637 NullOnNull,
4638 AbsentOnNull,
4639}
4640
4641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4643#[cfg_attr(feature = "bindings", derive(TS))]
4644pub struct JsonModifyFunc {
4645 pub this: Expression,
4646 pub path_values: Vec<(Expression, Expression)>,
4647}
4648
4649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4651#[cfg_attr(feature = "bindings", derive(TS))]
4652pub struct JsonArrayAggFunc {
4653 pub this: Expression,
4654 pub order_by: Option<Vec<Ordered>>,
4655 pub null_handling: Option<JsonNullHandling>,
4656 pub filter: Option<Expression>,
4657}
4658
4659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4661#[cfg_attr(feature = "bindings", derive(TS))]
4662pub struct JsonObjectAggFunc {
4663 pub key: Expression,
4664 pub value: Expression,
4665 pub null_handling: Option<JsonNullHandling>,
4666 pub filter: Option<Expression>,
4667}
4668
4669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4675#[cfg_attr(feature = "bindings", derive(TS))]
4676pub struct ConvertFunc {
4677 pub this: Expression,
4678 pub to: DataType,
4679 pub style: Option<Expression>,
4680}
4681
4682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4688#[cfg_attr(feature = "bindings", derive(TS))]
4689pub struct LambdaExpr {
4690 pub parameters: Vec<Identifier>,
4691 pub body: Expression,
4692 #[serde(default)]
4694 pub colon: bool,
4695 #[serde(default)]
4698 pub parameter_types: Vec<Option<DataType>>,
4699}
4700
4701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4703#[cfg_attr(feature = "bindings", derive(TS))]
4704pub struct Parameter {
4705 pub name: Option<String>,
4706 pub index: Option<u32>,
4707 pub style: ParameterStyle,
4708 #[serde(default)]
4710 pub quoted: bool,
4711 #[serde(default)]
4713 pub expression: Option<String>,
4714}
4715
4716#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4718#[cfg_attr(feature = "bindings", derive(TS))]
4719pub enum ParameterStyle {
4720 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
4730
4731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4733#[cfg_attr(feature = "bindings", derive(TS))]
4734pub struct Placeholder {
4735 pub index: Option<u32>,
4736}
4737
4738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4740#[cfg_attr(feature = "bindings", derive(TS))]
4741pub struct NamedArgument {
4742 pub name: Identifier,
4743 pub value: Expression,
4744 pub separator: NamedArgSeparator,
4746}
4747
4748#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4750#[cfg_attr(feature = "bindings", derive(TS))]
4751pub enum NamedArgSeparator {
4752 DArrow,
4754 ColonEq,
4756 Eq,
4758}
4759
4760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4763#[cfg_attr(feature = "bindings", derive(TS))]
4764pub struct TableArgument {
4765 pub prefix: String,
4767 pub this: Expression,
4769}
4770
4771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4773#[cfg_attr(feature = "bindings", derive(TS))]
4774pub struct SqlComment {
4775 pub text: String,
4776 pub is_block: bool,
4777}
4778
4779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4785#[cfg_attr(feature = "bindings", derive(TS))]
4786pub struct SimilarToExpr {
4787 pub this: Expression,
4788 pub pattern: Expression,
4789 pub escape: Option<Expression>,
4790 pub not: bool,
4791}
4792
4793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4795#[cfg_attr(feature = "bindings", derive(TS))]
4796pub struct QuantifiedExpr {
4797 pub this: Expression,
4798 pub subquery: Expression,
4799 pub op: Option<QuantifiedOp>,
4800}
4801
4802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4804#[cfg_attr(feature = "bindings", derive(TS))]
4805pub enum QuantifiedOp {
4806 Eq,
4807 Neq,
4808 Lt,
4809 Lte,
4810 Gt,
4811 Gte,
4812}
4813
4814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4819#[cfg_attr(feature = "bindings", derive(TS))]
4820pub struct OverlapsExpr {
4821 #[serde(skip_serializing_if = "Option::is_none")]
4823 pub this: Option<Expression>,
4824 #[serde(skip_serializing_if = "Option::is_none")]
4826 pub expression: Option<Expression>,
4827 #[serde(skip_serializing_if = "Option::is_none")]
4829 pub left_start: Option<Expression>,
4830 #[serde(skip_serializing_if = "Option::is_none")]
4832 pub left_end: Option<Expression>,
4833 #[serde(skip_serializing_if = "Option::is_none")]
4835 pub right_start: Option<Expression>,
4836 #[serde(skip_serializing_if = "Option::is_none")]
4838 pub right_end: Option<Expression>,
4839}
4840
4841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4847#[cfg_attr(feature = "bindings", derive(TS))]
4848pub struct Subscript {
4849 pub this: Expression,
4850 pub index: Expression,
4851}
4852
4853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4855#[cfg_attr(feature = "bindings", derive(TS))]
4856pub struct DotAccess {
4857 pub this: Expression,
4858 pub field: Identifier,
4859}
4860
4861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4863#[cfg_attr(feature = "bindings", derive(TS))]
4864pub struct MethodCall {
4865 pub this: Expression,
4866 pub method: Identifier,
4867 pub args: Vec<Expression>,
4868}
4869
4870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4872#[cfg_attr(feature = "bindings", derive(TS))]
4873pub struct ArraySlice {
4874 pub this: Expression,
4875 pub start: Option<Expression>,
4876 pub end: Option<Expression>,
4877}
4878
4879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4885#[cfg_attr(feature = "bindings", derive(TS))]
4886pub enum OnCommit {
4887 PreserveRows,
4889 DeleteRows,
4891}
4892
4893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4895#[cfg_attr(feature = "bindings", derive(TS))]
4896pub struct CreateTable {
4897 pub name: TableRef,
4898 #[serde(default, skip_serializing_if = "Option::is_none")]
4900 pub on_cluster: Option<OnCluster>,
4901 pub columns: Vec<ColumnDef>,
4902 pub constraints: Vec<TableConstraint>,
4903 pub if_not_exists: bool,
4904 pub temporary: bool,
4905 pub or_replace: bool,
4906 #[serde(default, skip_serializing_if = "Option::is_none")]
4908 pub table_modifier: Option<String>,
4909 pub as_select: Option<Expression>,
4910 #[serde(default)]
4912 pub as_select_parenthesized: bool,
4913 #[serde(default)]
4915 pub on_commit: Option<OnCommit>,
4916 #[serde(default)]
4918 pub clone_source: Option<TableRef>,
4919 #[serde(default, skip_serializing_if = "Option::is_none")]
4921 pub clone_at_clause: Option<Expression>,
4922 #[serde(default)]
4924 pub is_copy: bool,
4925 #[serde(default)]
4927 pub shallow_clone: bool,
4928 #[serde(default)]
4930 pub leading_comments: Vec<String>,
4931 #[serde(default)]
4933 pub with_properties: Vec<(String, String)>,
4934 #[serde(default)]
4936 pub teradata_post_name_options: Vec<String>,
4937 #[serde(default)]
4939 pub with_data: Option<bool>,
4940 #[serde(default)]
4942 pub with_statistics: Option<bool>,
4943 #[serde(default)]
4945 pub teradata_indexes: Vec<TeradataIndex>,
4946 #[serde(default)]
4948 pub with_cte: Option<With>,
4949 #[serde(default)]
4951 pub properties: Vec<Expression>,
4952 #[serde(default, skip_serializing_if = "Option::is_none")]
4954 pub partition_of: Option<Expression>,
4955 #[serde(default)]
4957 pub post_table_properties: Vec<Expression>,
4958 #[serde(default)]
4960 pub mysql_table_options: Vec<(String, String)>,
4961 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4963 pub inherits: Vec<TableRef>,
4964 #[serde(default, skip_serializing_if = "Option::is_none")]
4966 pub on_property: Option<OnProperty>,
4967 #[serde(default)]
4969 pub copy_grants: bool,
4970 #[serde(default, skip_serializing_if = "Option::is_none")]
4972 pub using_template: Option<Box<Expression>>,
4973 #[serde(default, skip_serializing_if = "Option::is_none")]
4975 pub rollup: Option<RollupProperty>,
4976}
4977
4978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4980#[cfg_attr(feature = "bindings", derive(TS))]
4981pub struct TeradataIndex {
4982 pub kind: TeradataIndexKind,
4984 pub name: Option<String>,
4986 pub columns: Vec<String>,
4988}
4989
4990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4992#[cfg_attr(feature = "bindings", derive(TS))]
4993pub enum TeradataIndexKind {
4994 NoPrimary,
4996 Primary,
4998 PrimaryAmp,
5000 Unique,
5002 UniquePrimary,
5004 Secondary,
5006}
5007
5008impl CreateTable {
5009 pub fn new(name: impl Into<String>) -> Self {
5010 Self {
5011 name: TableRef::new(name),
5012 on_cluster: None,
5013 columns: Vec::new(),
5014 constraints: Vec::new(),
5015 if_not_exists: false,
5016 temporary: false,
5017 or_replace: false,
5018 table_modifier: None,
5019 as_select: None,
5020 as_select_parenthesized: false,
5021 on_commit: None,
5022 clone_source: None,
5023 clone_at_clause: None,
5024 shallow_clone: false, is_copy: false,
5025 leading_comments: Vec::new(),
5026 with_properties: Vec::new(),
5027 teradata_post_name_options: Vec::new(),
5028 with_data: None,
5029 with_statistics: None,
5030 teradata_indexes: Vec::new(),
5031 with_cte: None,
5032 properties: Vec::new(),
5033 partition_of: None,
5034 post_table_properties: Vec::new(),
5035 mysql_table_options: Vec::new(),
5036 inherits: Vec::new(),
5037 on_property: None,
5038 copy_grants: false,
5039 using_template: None,
5040 rollup: None,
5041 }
5042 }
5043}
5044
5045#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
5047#[cfg_attr(feature = "bindings", derive(TS))]
5048pub enum SortOrder {
5049 Asc,
5050 Desc,
5051}
5052
5053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5055#[cfg_attr(feature = "bindings", derive(TS))]
5056pub enum ConstraintType {
5057 NotNull,
5058 Null,
5059 PrimaryKey,
5060 Unique,
5061 Default,
5062 AutoIncrement,
5063 Collate,
5064 Comment,
5065 References,
5066 Check,
5067 GeneratedAsIdentity,
5068 Tags,
5070 ComputedColumn,
5072 GeneratedAsRow,
5074 OnUpdate,
5076 Path,
5078 Encode,
5080}
5081
5082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5084#[cfg_attr(feature = "bindings", derive(TS))]
5085pub struct ColumnDef {
5086 pub name: Identifier,
5087 pub data_type: DataType,
5088 pub nullable: Option<bool>,
5089 pub default: Option<Expression>,
5090 pub primary_key: bool,
5091 #[serde(default)]
5093 pub primary_key_order: Option<SortOrder>,
5094 pub unique: bool,
5095 #[serde(default)]
5097 pub unique_nulls_not_distinct: bool,
5098 pub auto_increment: bool,
5099 pub comment: Option<String>,
5100 pub constraints: Vec<ColumnConstraint>,
5101 #[serde(default)]
5103 pub constraint_order: Vec<ConstraintType>,
5104 #[serde(default)]
5106 pub format: Option<String>,
5107 #[serde(default)]
5109 pub title: Option<String>,
5110 #[serde(default)]
5112 pub inline_length: Option<u64>,
5113 #[serde(default)]
5115 pub compress: Option<Vec<Expression>>,
5116 #[serde(default)]
5118 pub character_set: Option<String>,
5119 #[serde(default)]
5121 pub uppercase: bool,
5122 #[serde(default)]
5124 pub casespecific: Option<bool>,
5125 #[serde(default)]
5127 pub auto_increment_start: Option<Box<Expression>>,
5128 #[serde(default)]
5130 pub auto_increment_increment: Option<Box<Expression>>,
5131 #[serde(default)]
5133 pub auto_increment_order: Option<bool>,
5134 #[serde(default)]
5136 pub unsigned: bool,
5137 #[serde(default)]
5139 pub zerofill: bool,
5140 #[serde(default, skip_serializing_if = "Option::is_none")]
5142 pub on_update: Option<Expression>,
5143 #[serde(default, skip_serializing_if = "Option::is_none")]
5145 pub unique_constraint_name: Option<String>,
5146 #[serde(default, skip_serializing_if = "Option::is_none")]
5148 pub not_null_constraint_name: Option<String>,
5149 #[serde(default, skip_serializing_if = "Option::is_none")]
5151 pub primary_key_constraint_name: Option<String>,
5152 #[serde(default, skip_serializing_if = "Option::is_none")]
5154 pub check_constraint_name: Option<String>,
5155 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5157 pub options: Vec<Expression>,
5158 #[serde(default)]
5160 pub no_type: bool,
5161 #[serde(default, skip_serializing_if = "Option::is_none")]
5163 pub encoding: Option<String>,
5164 #[serde(default, skip_serializing_if = "Option::is_none")]
5166 pub codec: Option<String>,
5167 #[serde(default, skip_serializing_if = "Option::is_none")]
5169 pub ephemeral: Option<Option<Box<Expression>>>,
5170 #[serde(default, skip_serializing_if = "Option::is_none")]
5172 pub materialized_expr: Option<Box<Expression>>,
5173 #[serde(default, skip_serializing_if = "Option::is_none")]
5175 pub alias_expr: Option<Box<Expression>>,
5176 #[serde(default, skip_serializing_if = "Option::is_none")]
5178 pub ttl_expr: Option<Box<Expression>>,
5179 #[serde(default)]
5181 pub not_for_replication: bool,
5182}
5183
5184impl ColumnDef {
5185 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
5186 Self {
5187 name: Identifier::new(name),
5188 data_type,
5189 nullable: None,
5190 default: None,
5191 primary_key: false,
5192 primary_key_order: None,
5193 unique: false,
5194 unique_nulls_not_distinct: false,
5195 auto_increment: false,
5196 comment: None,
5197 constraints: Vec::new(),
5198 constraint_order: Vec::new(),
5199 format: None,
5200 title: None,
5201 inline_length: None,
5202 compress: None,
5203 character_set: None,
5204 uppercase: false,
5205 casespecific: None,
5206 auto_increment_start: None,
5207 auto_increment_increment: None,
5208 auto_increment_order: None,
5209 unsigned: false,
5210 zerofill: false,
5211 on_update: None,
5212 unique_constraint_name: None,
5213 not_null_constraint_name: None,
5214 primary_key_constraint_name: None,
5215 check_constraint_name: None,
5216 options: Vec::new(),
5217 no_type: false,
5218 encoding: None,
5219 codec: None,
5220 ephemeral: None,
5221 materialized_expr: None,
5222 alias_expr: None,
5223 ttl_expr: None,
5224 not_for_replication: false,
5225 }
5226 }
5227}
5228
5229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5231#[cfg_attr(feature = "bindings", derive(TS))]
5232pub enum ColumnConstraint {
5233 NotNull,
5234 Null,
5235 Unique,
5236 PrimaryKey,
5237 Default(Expression),
5238 Check(Expression),
5239 References(ForeignKeyRef),
5240 GeneratedAsIdentity(GeneratedAsIdentity),
5241 Collate(Identifier),
5242 Comment(String),
5243 Tags(Tags),
5245 ComputedColumn(ComputedColumn),
5248 GeneratedAsRow(GeneratedAsRow),
5250 Path(Expression),
5252}
5253
5254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5256#[cfg_attr(feature = "bindings", derive(TS))]
5257pub struct ComputedColumn {
5258 pub expression: Box<Expression>,
5260 #[serde(default)]
5262 pub persisted: bool,
5263 #[serde(default)]
5265 pub not_null: bool,
5266 #[serde(default)]
5269 pub persistence_kind: Option<String>,
5270 #[serde(default, skip_serializing_if = "Option::is_none")]
5272 pub data_type: Option<DataType>,
5273}
5274
5275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5277#[cfg_attr(feature = "bindings", derive(TS))]
5278pub struct GeneratedAsRow {
5279 pub start: bool,
5281 #[serde(default)]
5283 pub hidden: bool,
5284}
5285
5286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5288#[cfg_attr(feature = "bindings", derive(TS))]
5289pub struct GeneratedAsIdentity {
5290 pub always: bool,
5292 pub on_null: bool,
5294 pub start: Option<Box<Expression>>,
5296 pub increment: Option<Box<Expression>>,
5298 pub minvalue: Option<Box<Expression>>,
5300 pub maxvalue: Option<Box<Expression>>,
5302 pub cycle: Option<bool>,
5304}
5305
5306#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5308#[cfg_attr(feature = "bindings", derive(TS))]
5309pub struct ConstraintModifiers {
5310 pub enforced: Option<bool>,
5312 pub deferrable: Option<bool>,
5314 pub initially_deferred: Option<bool>,
5316 pub norely: bool,
5318 pub rely: bool,
5320 #[serde(default)]
5322 pub using: Option<String>,
5323 #[serde(default)]
5325 pub using_before_columns: bool,
5326 #[serde(default, skip_serializing_if = "Option::is_none")]
5328 pub comment: Option<String>,
5329 #[serde(default, skip_serializing_if = "Option::is_none")]
5331 pub visible: Option<bool>,
5332 #[serde(default, skip_serializing_if = "Option::is_none")]
5334 pub engine_attribute: Option<String>,
5335 #[serde(default, skip_serializing_if = "Option::is_none")]
5337 pub with_parser: Option<String>,
5338 #[serde(default)]
5340 pub not_valid: bool,
5341 #[serde(default, skip_serializing_if = "Option::is_none")]
5343 pub clustered: Option<String>,
5344 #[serde(default, skip_serializing_if = "Option::is_none")]
5346 pub on_conflict: Option<String>,
5347 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5349 pub with_options: Vec<(String, String)>,
5350 #[serde(default, skip_serializing_if = "Option::is_none")]
5352 pub on_filegroup: Option<Identifier>,
5353}
5354
5355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5357#[cfg_attr(feature = "bindings", derive(TS))]
5358pub enum TableConstraint {
5359 PrimaryKey {
5360 name: Option<Identifier>,
5361 columns: Vec<Identifier>,
5362 #[serde(default)]
5364 include_columns: Vec<Identifier>,
5365 #[serde(default)]
5366 modifiers: ConstraintModifiers,
5367 #[serde(default)]
5369 has_constraint_keyword: bool,
5370 },
5371 Unique {
5372 name: Option<Identifier>,
5373 columns: Vec<Identifier>,
5374 #[serde(default)]
5376 columns_parenthesized: bool,
5377 #[serde(default)]
5378 modifiers: ConstraintModifiers,
5379 #[serde(default)]
5381 has_constraint_keyword: bool,
5382 #[serde(default)]
5384 nulls_not_distinct: bool,
5385 },
5386 ForeignKey {
5387 name: Option<Identifier>,
5388 columns: Vec<Identifier>,
5389 #[serde(default)]
5390 references: Option<ForeignKeyRef>,
5391 #[serde(default)]
5393 on_delete: Option<ReferentialAction>,
5394 #[serde(default)]
5396 on_update: Option<ReferentialAction>,
5397 #[serde(default)]
5398 modifiers: ConstraintModifiers,
5399 },
5400 Check {
5401 name: Option<Identifier>,
5402 expression: Expression,
5403 #[serde(default)]
5404 modifiers: ConstraintModifiers,
5405 },
5406 Index {
5408 name: Option<Identifier>,
5409 columns: Vec<Identifier>,
5410 #[serde(default)]
5412 kind: Option<String>,
5413 #[serde(default)]
5414 modifiers: ConstraintModifiers,
5415 #[serde(default)]
5417 use_key_keyword: bool,
5418 #[serde(default, skip_serializing_if = "Option::is_none")]
5420 expression: Option<Box<Expression>>,
5421 #[serde(default, skip_serializing_if = "Option::is_none")]
5423 index_type: Option<Box<Expression>>,
5424 #[serde(default, skip_serializing_if = "Option::is_none")]
5426 granularity: Option<Box<Expression>>,
5427 },
5428 Projection {
5430 name: Identifier,
5431 expression: Expression,
5432 },
5433 Like {
5435 source: TableRef,
5436 options: Vec<(LikeOptionAction, String)>,
5438 },
5439 PeriodForSystemTime {
5441 start_col: Identifier,
5442 end_col: Identifier,
5443 },
5444 Exclude {
5447 name: Option<Identifier>,
5448 #[serde(default)]
5450 using: Option<String>,
5451 elements: Vec<ExcludeElement>,
5453 #[serde(default)]
5455 include_columns: Vec<Identifier>,
5456 #[serde(default)]
5458 where_clause: Option<Box<Expression>>,
5459 #[serde(default)]
5461 with_params: Vec<(String, String)>,
5462 #[serde(default)]
5464 using_index_tablespace: Option<String>,
5465 #[serde(default)]
5466 modifiers: ConstraintModifiers,
5467 },
5468 Tags(Tags),
5470 InitiallyDeferred {
5474 deferred: bool,
5476 },
5477}
5478
5479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5481#[cfg_attr(feature = "bindings", derive(TS))]
5482pub struct ExcludeElement {
5483 pub expression: String,
5485 pub operator: String,
5487}
5488
5489#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5491#[cfg_attr(feature = "bindings", derive(TS))]
5492pub enum LikeOptionAction {
5493 Including,
5494 Excluding,
5495}
5496
5497#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5499#[cfg_attr(feature = "bindings", derive(TS))]
5500pub enum MatchType {
5501 Full,
5502 Partial,
5503 Simple,
5504}
5505
5506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5508#[cfg_attr(feature = "bindings", derive(TS))]
5509pub struct ForeignKeyRef {
5510 pub table: TableRef,
5511 pub columns: Vec<Identifier>,
5512 pub on_delete: Option<ReferentialAction>,
5513 pub on_update: Option<ReferentialAction>,
5514 #[serde(default)]
5516 pub on_update_first: bool,
5517 #[serde(default)]
5519 pub match_type: Option<MatchType>,
5520 #[serde(default)]
5522 pub match_after_actions: bool,
5523 #[serde(default)]
5525 pub constraint_name: Option<String>,
5526 #[serde(default)]
5528 pub deferrable: Option<bool>,
5529 #[serde(default)]
5531 pub has_foreign_key_keywords: bool,
5532}
5533
5534#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5536#[cfg_attr(feature = "bindings", derive(TS))]
5537pub enum ReferentialAction {
5538 Cascade,
5539 SetNull,
5540 SetDefault,
5541 Restrict,
5542 NoAction,
5543}
5544
5545#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5547#[cfg_attr(feature = "bindings", derive(TS))]
5548pub struct DropTable {
5549 pub names: Vec<TableRef>,
5550 pub if_exists: bool,
5551 pub cascade: bool,
5552 #[serde(default)]
5554 pub cascade_constraints: bool,
5555 #[serde(default)]
5557 pub purge: bool,
5558}
5559
5560impl DropTable {
5561 pub fn new(name: impl Into<String>) -> Self {
5562 Self {
5563 names: vec![TableRef::new(name)],
5564 if_exists: false,
5565 cascade: false,
5566 cascade_constraints: false,
5567 purge: false,
5568 }
5569 }
5570}
5571
5572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5574#[cfg_attr(feature = "bindings", derive(TS))]
5575pub struct AlterTable {
5576 pub name: TableRef,
5577 pub actions: Vec<AlterTableAction>,
5578 #[serde(default)]
5580 pub if_exists: bool,
5581 #[serde(default, skip_serializing_if = "Option::is_none")]
5583 pub algorithm: Option<String>,
5584 #[serde(default, skip_serializing_if = "Option::is_none")]
5586 pub lock: Option<String>,
5587 #[serde(default, skip_serializing_if = "Option::is_none")]
5589 pub with_check: Option<String>,
5590 #[serde(default, skip_serializing_if = "Option::is_none")]
5592 pub partition: Option<Vec<(Identifier, Expression)>>,
5593 #[serde(default, skip_serializing_if = "Option::is_none")]
5595 pub on_cluster: Option<OnCluster>,
5596}
5597
5598impl AlterTable {
5599 pub fn new(name: impl Into<String>) -> Self {
5600 Self {
5601 name: TableRef::new(name),
5602 actions: Vec::new(),
5603 if_exists: false,
5604 algorithm: None,
5605 lock: None,
5606 with_check: None,
5607 partition: None,
5608 on_cluster: None,
5609 }
5610 }
5611}
5612
5613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5615#[cfg_attr(feature = "bindings", derive(TS))]
5616pub enum ColumnPosition {
5617 First,
5618 After(Identifier),
5619}
5620
5621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5623#[cfg_attr(feature = "bindings", derive(TS))]
5624pub enum AlterTableAction {
5625 AddColumn {
5626 column: ColumnDef,
5627 if_not_exists: bool,
5628 position: Option<ColumnPosition>,
5629 },
5630 DropColumn {
5631 name: Identifier,
5632 if_exists: bool,
5633 cascade: bool,
5634 },
5635 RenameColumn {
5636 old_name: Identifier,
5637 new_name: Identifier,
5638 if_exists: bool,
5639 },
5640 AlterColumn {
5641 name: Identifier,
5642 action: AlterColumnAction,
5643 #[serde(default)]
5645 use_modify_keyword: bool,
5646 },
5647 RenameTable(TableRef),
5648 AddConstraint(TableConstraint),
5649 DropConstraint {
5650 name: Identifier,
5651 if_exists: bool,
5652 },
5653 DropForeignKey {
5655 name: Identifier,
5656 },
5657 DropPartition {
5659 partitions: Vec<Vec<(Identifier, Expression)>>,
5661 if_exists: bool,
5662 },
5663 AddPartition {
5665 partition: Expression,
5667 if_not_exists: bool,
5668 location: Option<Expression>,
5669 },
5670 Delete {
5672 where_clause: Expression,
5673 },
5674 SwapWith(TableRef),
5676 SetProperty {
5678 properties: Vec<(String, Expression)>,
5679 },
5680 UnsetProperty {
5682 properties: Vec<String>,
5683 },
5684 ClusterBy {
5686 expressions: Vec<Expression>,
5687 },
5688 SetTag {
5690 expressions: Vec<(String, Expression)>,
5691 },
5692 UnsetTag {
5694 names: Vec<String>,
5695 },
5696 SetOptions {
5698 expressions: Vec<Expression>,
5699 },
5700 AlterIndex {
5702 name: Identifier,
5703 visible: bool,
5704 },
5705 SetAttribute {
5707 attribute: String,
5708 },
5709 SetStageFileFormat {
5711 options: Option<Expression>,
5712 },
5713 SetStageCopyOptions {
5715 options: Option<Expression>,
5716 },
5717 AddColumns {
5719 columns: Vec<ColumnDef>,
5720 cascade: bool,
5721 },
5722 DropColumns {
5724 names: Vec<Identifier>,
5725 },
5726 ChangeColumn {
5729 old_name: Identifier,
5730 new_name: Identifier,
5731 #[serde(default, skip_serializing_if = "Option::is_none")]
5732 data_type: Option<DataType>,
5733 comment: Option<String>,
5734 #[serde(default)]
5735 cascade: bool,
5736 },
5737 AlterSortKey {
5740 this: Option<String>,
5742 expressions: Vec<Expression>,
5744 compound: bool,
5746 },
5747 AlterDistStyle {
5751 style: String,
5753 distkey: Option<Identifier>,
5755 },
5756 SetTableProperties {
5758 properties: Vec<(Expression, Expression)>,
5759 },
5760 SetLocation {
5762 location: String,
5763 },
5764 SetFileFormat {
5766 format: String,
5767 },
5768 ReplacePartition {
5770 partition: Expression,
5771 source: Option<Box<Expression>>,
5772 },
5773}
5774
5775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5777#[cfg_attr(feature = "bindings", derive(TS))]
5778pub enum AlterColumnAction {
5779 SetDataType {
5780 data_type: DataType,
5781 using: Option<Expression>,
5783 #[serde(default, skip_serializing_if = "Option::is_none")]
5785 collate: Option<String>,
5786 },
5787 SetDefault(Expression),
5788 DropDefault,
5789 SetNotNull,
5790 DropNotNull,
5791 Comment(String),
5793 SetVisible,
5795 SetInvisible,
5797}
5798
5799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5801#[cfg_attr(feature = "bindings", derive(TS))]
5802pub struct CreateIndex {
5803 pub name: Identifier,
5804 pub table: TableRef,
5805 pub columns: Vec<IndexColumn>,
5806 pub unique: bool,
5807 pub if_not_exists: bool,
5808 pub using: Option<String>,
5809 #[serde(default)]
5811 pub clustered: Option<String>,
5812 #[serde(default)]
5814 pub concurrently: bool,
5815 #[serde(default)]
5817 pub where_clause: Option<Box<Expression>>,
5818 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5820 pub include_columns: Vec<Identifier>,
5821 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5823 pub with_options: Vec<(String, String)>,
5824 #[serde(default)]
5826 pub on_filegroup: Option<String>,
5827}
5828
5829impl CreateIndex {
5830 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
5831 Self {
5832 name: Identifier::new(name),
5833 table: TableRef::new(table),
5834 columns: Vec::new(),
5835 unique: false,
5836 if_not_exists: false,
5837 using: None,
5838 clustered: None,
5839 concurrently: false,
5840 where_clause: None,
5841 include_columns: Vec::new(),
5842 with_options: Vec::new(),
5843 on_filegroup: None,
5844 }
5845 }
5846}
5847
5848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5850#[cfg_attr(feature = "bindings", derive(TS))]
5851pub struct IndexColumn {
5852 pub column: Identifier,
5853 pub desc: bool,
5854 #[serde(default)]
5856 pub asc: bool,
5857 pub nulls_first: Option<bool>,
5858 #[serde(default, skip_serializing_if = "Option::is_none")]
5860 pub opclass: Option<String>,
5861}
5862
5863#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5865#[cfg_attr(feature = "bindings", derive(TS))]
5866pub struct DropIndex {
5867 pub name: Identifier,
5868 pub table: Option<TableRef>,
5869 pub if_exists: bool,
5870 #[serde(default)]
5872 pub concurrently: bool,
5873}
5874
5875impl DropIndex {
5876 pub fn new(name: impl Into<String>) -> Self {
5877 Self {
5878 name: Identifier::new(name),
5879 table: None,
5880 if_exists: false,
5881 concurrently: false,
5882 }
5883 }
5884}
5885
5886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5888#[cfg_attr(feature = "bindings", derive(TS))]
5889pub struct ViewColumn {
5890 pub name: Identifier,
5891 pub comment: Option<String>,
5892 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5894 pub options: Vec<Expression>,
5895}
5896
5897impl ViewColumn {
5898 pub fn new(name: impl Into<String>) -> Self {
5899 Self {
5900 name: Identifier::new(name),
5901 comment: None,
5902 options: Vec::new(),
5903 }
5904 }
5905
5906 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
5907 Self {
5908 name: Identifier::new(name),
5909 comment: Some(comment.into()),
5910 options: Vec::new(),
5911 }
5912 }
5913}
5914
5915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5917#[cfg_attr(feature = "bindings", derive(TS))]
5918pub struct CreateView {
5919 pub name: TableRef,
5920 pub columns: Vec<ViewColumn>,
5921 pub query: Expression,
5922 pub or_replace: bool,
5923 pub if_not_exists: bool,
5924 pub materialized: bool,
5925 pub temporary: bool,
5926 #[serde(default)]
5928 pub secure: bool,
5929 #[serde(skip_serializing_if = "Option::is_none")]
5931 pub algorithm: Option<String>,
5932 #[serde(skip_serializing_if = "Option::is_none")]
5934 pub definer: Option<String>,
5935 #[serde(skip_serializing_if = "Option::is_none")]
5937 pub security: Option<FunctionSecurity>,
5938 #[serde(default = "default_true")]
5940 pub security_sql_style: bool,
5941 #[serde(default)]
5943 pub query_parenthesized: bool,
5944 #[serde(skip_serializing_if = "Option::is_none")]
5946 pub locking_mode: Option<String>,
5947 #[serde(skip_serializing_if = "Option::is_none")]
5949 pub locking_access: Option<String>,
5950 #[serde(default)]
5952 pub copy_grants: bool,
5953 #[serde(skip_serializing_if = "Option::is_none", default)]
5955 pub comment: Option<String>,
5956 #[serde(default)]
5958 pub tags: Vec<(String, String)>,
5959 #[serde(default)]
5961 pub options: Vec<Expression>,
5962 #[serde(skip_serializing_if = "Option::is_none", default)]
5964 pub build: Option<String>,
5965 #[serde(skip_serializing_if = "Option::is_none", default)]
5967 pub refresh: Option<Box<RefreshTriggerProperty>>,
5968 #[serde(skip_serializing_if = "Option::is_none", default)]
5971 pub schema: Option<Box<Schema>>,
5972 #[serde(skip_serializing_if = "Option::is_none", default)]
5974 pub unique_key: Option<Box<UniqueKeyProperty>>,
5975 #[serde(default)]
5977 pub no_schema_binding: bool,
5978 #[serde(skip_serializing_if = "Option::is_none", default)]
5980 pub auto_refresh: Option<bool>,
5981 #[serde(default, skip_serializing_if = "Option::is_none")]
5983 pub on_cluster: Option<OnCluster>,
5984 #[serde(default, skip_serializing_if = "Option::is_none")]
5986 pub to_table: Option<TableRef>,
5987 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5989 pub table_properties: Vec<Expression>,
5990}
5991
5992impl CreateView {
5993 pub fn new(name: impl Into<String>, query: Expression) -> Self {
5994 Self {
5995 name: TableRef::new(name),
5996 columns: Vec::new(),
5997 query,
5998 or_replace: false,
5999 if_not_exists: false,
6000 materialized: false,
6001 temporary: false,
6002 secure: false,
6003 algorithm: None,
6004 definer: None,
6005 security: None,
6006 security_sql_style: true,
6007 query_parenthesized: false,
6008 locking_mode: None,
6009 locking_access: None,
6010 copy_grants: false,
6011 comment: None,
6012 tags: Vec::new(),
6013 options: Vec::new(),
6014 build: None,
6015 refresh: None,
6016 schema: None,
6017 unique_key: None,
6018 no_schema_binding: false,
6019 auto_refresh: None,
6020 on_cluster: None,
6021 to_table: None,
6022 table_properties: Vec::new(),
6023 }
6024 }
6025}
6026
6027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6029#[cfg_attr(feature = "bindings", derive(TS))]
6030pub struct DropView {
6031 pub name: TableRef,
6032 pub if_exists: bool,
6033 pub materialized: bool,
6034}
6035
6036impl DropView {
6037 pub fn new(name: impl Into<String>) -> Self {
6038 Self {
6039 name: TableRef::new(name),
6040 if_exists: false,
6041 materialized: false,
6042 }
6043 }
6044}
6045
6046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6048#[cfg_attr(feature = "bindings", derive(TS))]
6049pub struct Truncate {
6050 #[serde(default)]
6052 pub target: TruncateTarget,
6053 pub table: TableRef,
6054 #[serde(default, skip_serializing_if = "Option::is_none")]
6056 pub on_cluster: Option<OnCluster>,
6057 pub cascade: bool,
6058 #[serde(default)]
6060 pub extra_tables: Vec<TruncateTableEntry>,
6061 #[serde(default)]
6063 pub identity: Option<TruncateIdentity>,
6064 #[serde(default)]
6066 pub restrict: bool,
6067 #[serde(default, skip_serializing_if = "Option::is_none")]
6069 pub partition: Option<Box<Expression>>,
6070}
6071
6072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6074#[cfg_attr(feature = "bindings", derive(TS))]
6075pub struct TruncateTableEntry {
6076 pub table: TableRef,
6077 #[serde(default)]
6079 pub star: bool,
6080}
6081
6082#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6084#[cfg_attr(feature = "bindings", derive(TS))]
6085pub enum TruncateTarget {
6086 Table,
6087 Database,
6088}
6089
6090impl Default for TruncateTarget {
6091 fn default() -> Self {
6092 TruncateTarget::Table
6093 }
6094}
6095
6096#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6098#[cfg_attr(feature = "bindings", derive(TS))]
6099pub enum TruncateIdentity {
6100 Restart,
6101 Continue,
6102}
6103
6104impl Truncate {
6105 pub fn new(table: impl Into<String>) -> Self {
6106 Self {
6107 target: TruncateTarget::Table,
6108 table: TableRef::new(table),
6109 on_cluster: None,
6110 cascade: false,
6111 extra_tables: Vec::new(),
6112 identity: None,
6113 restrict: false,
6114 partition: None,
6115 }
6116 }
6117}
6118
6119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6121#[cfg_attr(feature = "bindings", derive(TS))]
6122pub struct Use {
6123 pub kind: Option<UseKind>,
6125 pub this: Identifier,
6127}
6128
6129#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6131#[cfg_attr(feature = "bindings", derive(TS))]
6132pub enum UseKind {
6133 Database,
6134 Schema,
6135 Role,
6136 Warehouse,
6137 Catalog,
6138 SecondaryRoles,
6140}
6141
6142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6144#[cfg_attr(feature = "bindings", derive(TS))]
6145pub struct SetStatement {
6146 pub items: Vec<SetItem>,
6148}
6149
6150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6152#[cfg_attr(feature = "bindings", derive(TS))]
6153pub struct SetItem {
6154 pub name: Expression,
6156 pub value: Expression,
6158 pub kind: Option<String>,
6160 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6162 pub no_equals: bool,
6163}
6164
6165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6167#[cfg_attr(feature = "bindings", derive(TS))]
6168pub struct Cache {
6169 pub table: Identifier,
6171 pub lazy: bool,
6173 pub options: Vec<(Expression, Expression)>,
6175 pub query: Option<Expression>,
6177}
6178
6179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6181#[cfg_attr(feature = "bindings", derive(TS))]
6182pub struct Uncache {
6183 pub table: Identifier,
6185 pub if_exists: bool,
6187}
6188
6189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6191#[cfg_attr(feature = "bindings", derive(TS))]
6192pub struct LoadData {
6193 pub local: bool,
6195 pub inpath: String,
6197 pub overwrite: bool,
6199 pub table: Expression,
6201 pub partition: Vec<(Identifier, Expression)>,
6203 pub input_format: Option<String>,
6205 pub serde: Option<String>,
6207}
6208
6209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6211#[cfg_attr(feature = "bindings", derive(TS))]
6212pub struct Pragma {
6213 pub schema: Option<Identifier>,
6215 pub name: Identifier,
6217 pub value: Option<Expression>,
6219 pub args: Vec<Expression>,
6221}
6222
6223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6226#[cfg_attr(feature = "bindings", derive(TS))]
6227pub struct Privilege {
6228 pub name: String,
6230 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6232 pub columns: Vec<String>,
6233}
6234
6235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6237#[cfg_attr(feature = "bindings", derive(TS))]
6238pub struct GrantPrincipal {
6239 pub name: Identifier,
6241 pub is_role: bool,
6243 #[serde(default)]
6245 pub is_group: bool,
6246}
6247
6248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6250#[cfg_attr(feature = "bindings", derive(TS))]
6251pub struct Grant {
6252 pub privileges: Vec<Privilege>,
6254 pub kind: Option<String>,
6256 pub securable: Identifier,
6258 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6260 pub function_params: Vec<String>,
6261 pub principals: Vec<GrantPrincipal>,
6263 pub grant_option: bool,
6265 #[serde(default, skip_serializing_if = "Option::is_none")]
6267 pub as_principal: Option<Identifier>,
6268}
6269
6270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6272#[cfg_attr(feature = "bindings", derive(TS))]
6273pub struct Revoke {
6274 pub privileges: Vec<Privilege>,
6276 pub kind: Option<String>,
6278 pub securable: Identifier,
6280 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6282 pub function_params: Vec<String>,
6283 pub principals: Vec<GrantPrincipal>,
6285 pub grant_option: bool,
6287 pub cascade: bool,
6289 #[serde(default)]
6291 pub restrict: bool,
6292}
6293
6294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6296#[cfg_attr(feature = "bindings", derive(TS))]
6297pub struct Comment {
6298 pub this: Expression,
6300 pub kind: String,
6302 pub expression: Expression,
6304 pub exists: bool,
6306 pub materialized: bool,
6308}
6309
6310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6316#[cfg_attr(feature = "bindings", derive(TS))]
6317pub struct AlterView {
6318 pub name: TableRef,
6319 pub actions: Vec<AlterViewAction>,
6320 #[serde(default, skip_serializing_if = "Option::is_none")]
6322 pub algorithm: Option<String>,
6323 #[serde(default, skip_serializing_if = "Option::is_none")]
6325 pub definer: Option<String>,
6326 #[serde(default, skip_serializing_if = "Option::is_none")]
6328 pub sql_security: Option<String>,
6329 #[serde(default, skip_serializing_if = "Option::is_none")]
6331 pub with_option: Option<String>,
6332 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6334 pub columns: Vec<ViewColumn>,
6335}
6336
6337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6339#[cfg_attr(feature = "bindings", derive(TS))]
6340pub enum AlterViewAction {
6341 Rename(TableRef),
6343 OwnerTo(Identifier),
6345 SetSchema(Identifier),
6347 SetAuthorization(String),
6349 AlterColumn {
6351 name: Identifier,
6352 action: AlterColumnAction,
6353 },
6354 AsSelect(Box<Expression>),
6356 SetTblproperties(Vec<(String, String)>),
6358 UnsetTblproperties(Vec<String>),
6360}
6361
6362impl AlterView {
6363 pub fn new(name: impl Into<String>) -> Self {
6364 Self {
6365 name: TableRef::new(name),
6366 actions: Vec::new(),
6367 algorithm: None,
6368 definer: None,
6369 sql_security: None,
6370 with_option: None,
6371 columns: Vec::new(),
6372 }
6373 }
6374}
6375
6376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6378#[cfg_attr(feature = "bindings", derive(TS))]
6379pub struct AlterIndex {
6380 pub name: Identifier,
6381 pub table: Option<TableRef>,
6382 pub actions: Vec<AlterIndexAction>,
6383}
6384
6385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6387#[cfg_attr(feature = "bindings", derive(TS))]
6388pub enum AlterIndexAction {
6389 Rename(Identifier),
6391 SetTablespace(Identifier),
6393 Visible(bool),
6395}
6396
6397impl AlterIndex {
6398 pub fn new(name: impl Into<String>) -> Self {
6399 Self {
6400 name: Identifier::new(name),
6401 table: None,
6402 actions: Vec::new(),
6403 }
6404 }
6405}
6406
6407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6409#[cfg_attr(feature = "bindings", derive(TS))]
6410pub struct CreateSchema {
6411 pub name: Identifier,
6412 pub if_not_exists: bool,
6413 pub authorization: Option<Identifier>,
6414 #[serde(default)]
6415 pub clone_from: Option<Identifier>,
6416 #[serde(default)]
6418 pub at_clause: Option<Expression>,
6419 #[serde(default)]
6421 pub properties: Vec<Expression>,
6422 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6424 pub leading_comments: Vec<String>,
6425}
6426
6427impl CreateSchema {
6428 pub fn new(name: impl Into<String>) -> Self {
6429 Self {
6430 name: Identifier::new(name),
6431 if_not_exists: false,
6432 authorization: None,
6433 clone_from: None,
6434 at_clause: None,
6435 properties: Vec::new(),
6436 leading_comments: Vec::new(),
6437 }
6438 }
6439}
6440
6441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6443#[cfg_attr(feature = "bindings", derive(TS))]
6444pub struct DropSchema {
6445 pub name: Identifier,
6446 pub if_exists: bool,
6447 pub cascade: bool,
6448}
6449
6450impl DropSchema {
6451 pub fn new(name: impl Into<String>) -> Self {
6452 Self {
6453 name: Identifier::new(name),
6454 if_exists: false,
6455 cascade: false,
6456 }
6457 }
6458}
6459
6460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6462#[cfg_attr(feature = "bindings", derive(TS))]
6463pub struct DropNamespace {
6464 pub name: Identifier,
6465 pub if_exists: bool,
6466 pub cascade: bool,
6467}
6468
6469impl DropNamespace {
6470 pub fn new(name: impl Into<String>) -> Self {
6471 Self {
6472 name: Identifier::new(name),
6473 if_exists: false,
6474 cascade: false,
6475 }
6476 }
6477}
6478
6479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6481#[cfg_attr(feature = "bindings", derive(TS))]
6482pub struct CreateDatabase {
6483 pub name: Identifier,
6484 pub if_not_exists: bool,
6485 pub options: Vec<DatabaseOption>,
6486 #[serde(default)]
6488 pub clone_from: Option<Identifier>,
6489 #[serde(default)]
6491 pub at_clause: Option<Expression>,
6492}
6493
6494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6496#[cfg_attr(feature = "bindings", derive(TS))]
6497pub enum DatabaseOption {
6498 CharacterSet(String),
6499 Collate(String),
6500 Owner(Identifier),
6501 Template(Identifier),
6502 Encoding(String),
6503 Location(String),
6504}
6505
6506impl CreateDatabase {
6507 pub fn new(name: impl Into<String>) -> Self {
6508 Self {
6509 name: Identifier::new(name),
6510 if_not_exists: false,
6511 options: Vec::new(),
6512 clone_from: None,
6513 at_clause: None,
6514 }
6515 }
6516}
6517
6518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6520#[cfg_attr(feature = "bindings", derive(TS))]
6521pub struct DropDatabase {
6522 pub name: Identifier,
6523 pub if_exists: bool,
6524}
6525
6526impl DropDatabase {
6527 pub fn new(name: impl Into<String>) -> Self {
6528 Self {
6529 name: Identifier::new(name),
6530 if_exists: false,
6531 }
6532 }
6533}
6534
6535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6537#[cfg_attr(feature = "bindings", derive(TS))]
6538pub struct CreateFunction {
6539 pub name: TableRef,
6540 pub parameters: Vec<FunctionParameter>,
6541 pub return_type: Option<DataType>,
6542 pub body: Option<FunctionBody>,
6543 pub or_replace: bool,
6544 pub if_not_exists: bool,
6545 pub temporary: bool,
6546 pub language: Option<String>,
6547 pub deterministic: Option<bool>,
6548 pub returns_null_on_null_input: Option<bool>,
6549 pub security: Option<FunctionSecurity>,
6550 #[serde(default = "default_true")]
6552 pub has_parens: bool,
6553 #[serde(default)]
6555 pub sql_data_access: Option<SqlDataAccess>,
6556 #[serde(default, skip_serializing_if = "Option::is_none")]
6558 pub returns_table_body: Option<String>,
6559 #[serde(default)]
6561 pub language_first: bool,
6562 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6564 pub set_options: Vec<FunctionSetOption>,
6565 #[serde(default)]
6567 pub strict: bool,
6568 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6570 pub options: Vec<Expression>,
6571 #[serde(default)]
6573 pub is_table_function: bool,
6574 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6576 pub property_order: Vec<FunctionPropertyKind>,
6577 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6579 pub environment: Vec<Expression>,
6580}
6581
6582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6584#[cfg_attr(feature = "bindings", derive(TS))]
6585pub struct FunctionSetOption {
6586 pub name: String,
6587 pub value: FunctionSetValue,
6588}
6589
6590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6592#[cfg_attr(feature = "bindings", derive(TS))]
6593pub enum FunctionSetValue {
6594 Value { value: String, use_to: bool },
6596 FromCurrent,
6598}
6599
6600#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6602#[cfg_attr(feature = "bindings", derive(TS))]
6603pub enum SqlDataAccess {
6604 NoSql,
6606 ContainsSql,
6608 ReadsSqlData,
6610 ModifiesSqlData,
6612}
6613
6614#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6616#[cfg_attr(feature = "bindings", derive(TS))]
6617pub enum FunctionPropertyKind {
6618 Set,
6620 As,
6622 Language,
6624 Determinism,
6626 NullInput,
6628 Security,
6630 SqlDataAccess,
6632 Options,
6634 Environment,
6636}
6637
6638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6640#[cfg_attr(feature = "bindings", derive(TS))]
6641pub struct FunctionParameter {
6642 pub name: Option<Identifier>,
6643 pub data_type: DataType,
6644 pub mode: Option<ParameterMode>,
6645 pub default: Option<Expression>,
6646}
6647
6648#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6650#[cfg_attr(feature = "bindings", derive(TS))]
6651pub enum ParameterMode {
6652 In,
6653 Out,
6654 InOut,
6655}
6656
6657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6659#[cfg_attr(feature = "bindings", derive(TS))]
6660pub enum FunctionBody {
6661 Block(String),
6663 StringLiteral(String),
6665 Expression(Expression),
6667 External(String),
6669 Return(Expression),
6671 Statements(Vec<Expression>),
6673 DollarQuoted {
6676 content: String,
6677 tag: Option<String>,
6678 },
6679}
6680
6681#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6683#[cfg_attr(feature = "bindings", derive(TS))]
6684pub enum FunctionSecurity {
6685 Definer,
6686 Invoker,
6687 None,
6689}
6690
6691impl CreateFunction {
6692 pub fn new(name: impl Into<String>) -> Self {
6693 Self {
6694 name: TableRef::new(name),
6695 parameters: Vec::new(),
6696 return_type: None,
6697 body: None,
6698 or_replace: false,
6699 if_not_exists: false,
6700 temporary: false,
6701 language: None,
6702 deterministic: None,
6703 returns_null_on_null_input: None,
6704 security: None,
6705 has_parens: true,
6706 sql_data_access: None,
6707 returns_table_body: None,
6708 language_first: false,
6709 set_options: Vec::new(),
6710 strict: false,
6711 options: Vec::new(),
6712 is_table_function: false,
6713 property_order: Vec::new(),
6714 environment: Vec::new(),
6715 }
6716 }
6717}
6718
6719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6721#[cfg_attr(feature = "bindings", derive(TS))]
6722pub struct DropFunction {
6723 pub name: TableRef,
6724 pub parameters: Option<Vec<DataType>>,
6725 pub if_exists: bool,
6726 pub cascade: bool,
6727}
6728
6729impl DropFunction {
6730 pub fn new(name: impl Into<String>) -> Self {
6731 Self {
6732 name: TableRef::new(name),
6733 parameters: None,
6734 if_exists: false,
6735 cascade: false,
6736 }
6737 }
6738}
6739
6740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6742#[cfg_attr(feature = "bindings", derive(TS))]
6743pub struct CreateProcedure {
6744 pub name: TableRef,
6745 pub parameters: Vec<FunctionParameter>,
6746 pub body: Option<FunctionBody>,
6747 pub or_replace: bool,
6748 pub if_not_exists: bool,
6749 pub language: Option<String>,
6750 pub security: Option<FunctionSecurity>,
6751 #[serde(default)]
6753 pub return_type: Option<DataType>,
6754 #[serde(default)]
6756 pub execute_as: Option<String>,
6757 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6759 pub with_options: Vec<String>,
6760 #[serde(default = "default_true", skip_serializing_if = "is_true")]
6762 pub has_parens: bool,
6763 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6765 pub use_proc_keyword: bool,
6766}
6767
6768impl CreateProcedure {
6769 pub fn new(name: impl Into<String>) -> Self {
6770 Self {
6771 name: TableRef::new(name),
6772 parameters: Vec::new(),
6773 body: None,
6774 or_replace: false,
6775 if_not_exists: false,
6776 language: None,
6777 security: None,
6778 return_type: None,
6779 execute_as: None,
6780 with_options: Vec::new(),
6781 has_parens: true,
6782 use_proc_keyword: false,
6783 }
6784 }
6785}
6786
6787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6789#[cfg_attr(feature = "bindings", derive(TS))]
6790pub struct DropProcedure {
6791 pub name: TableRef,
6792 pub parameters: Option<Vec<DataType>>,
6793 pub if_exists: bool,
6794 pub cascade: bool,
6795}
6796
6797impl DropProcedure {
6798 pub fn new(name: impl Into<String>) -> Self {
6799 Self {
6800 name: TableRef::new(name),
6801 parameters: None,
6802 if_exists: false,
6803 cascade: false,
6804 }
6805 }
6806}
6807
6808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6810#[cfg_attr(feature = "bindings", derive(TS))]
6811pub enum SeqPropKind {
6812 Start,
6813 Increment,
6814 Minvalue,
6815 Maxvalue,
6816 Cache,
6817 Cycle,
6818 NoCycle,
6819 OwnedBy,
6820 Order,
6821 NoOrder,
6822 Comment,
6823}
6824
6825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6827#[cfg_attr(feature = "bindings", derive(TS))]
6828pub struct CreateSequence {
6829 pub name: TableRef,
6830 pub if_not_exists: bool,
6831 pub temporary: bool,
6832 pub increment: Option<i64>,
6833 pub minvalue: Option<SequenceBound>,
6834 pub maxvalue: Option<SequenceBound>,
6835 pub start: Option<i64>,
6836 pub cache: Option<i64>,
6837 pub cycle: bool,
6838 pub owned_by: Option<TableRef>,
6839 #[serde(default)]
6841 pub order: Option<bool>,
6842 #[serde(default)]
6844 pub comment: Option<String>,
6845 #[serde(default)]
6847 pub property_order: Vec<SeqPropKind>,
6848}
6849
6850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6852#[cfg_attr(feature = "bindings", derive(TS))]
6853pub enum SequenceBound {
6854 Value(i64),
6855 None,
6856}
6857
6858impl CreateSequence {
6859 pub fn new(name: impl Into<String>) -> Self {
6860 Self {
6861 name: TableRef::new(name),
6862 if_not_exists: false,
6863 temporary: false,
6864 increment: None,
6865 minvalue: None,
6866 maxvalue: None,
6867 start: None,
6868 cache: None,
6869 cycle: false,
6870 owned_by: None,
6871 order: None,
6872 comment: None,
6873 property_order: Vec::new(),
6874 }
6875 }
6876}
6877
6878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6880#[cfg_attr(feature = "bindings", derive(TS))]
6881pub struct DropSequence {
6882 pub name: TableRef,
6883 pub if_exists: bool,
6884 pub cascade: bool,
6885}
6886
6887impl DropSequence {
6888 pub fn new(name: impl Into<String>) -> Self {
6889 Self {
6890 name: TableRef::new(name),
6891 if_exists: false,
6892 cascade: false,
6893 }
6894 }
6895}
6896
6897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6899#[cfg_attr(feature = "bindings", derive(TS))]
6900pub struct AlterSequence {
6901 pub name: TableRef,
6902 pub if_exists: bool,
6903 pub increment: Option<i64>,
6904 pub minvalue: Option<SequenceBound>,
6905 pub maxvalue: Option<SequenceBound>,
6906 pub start: Option<i64>,
6907 pub restart: Option<Option<i64>>,
6908 pub cache: Option<i64>,
6909 pub cycle: Option<bool>,
6910 pub owned_by: Option<Option<TableRef>>,
6911}
6912
6913impl AlterSequence {
6914 pub fn new(name: impl Into<String>) -> Self {
6915 Self {
6916 name: TableRef::new(name),
6917 if_exists: false,
6918 increment: None,
6919 minvalue: None,
6920 maxvalue: None,
6921 start: None,
6922 restart: None,
6923 cache: None,
6924 cycle: None,
6925 owned_by: None,
6926 }
6927 }
6928}
6929
6930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6932#[cfg_attr(feature = "bindings", derive(TS))]
6933pub struct CreateTrigger {
6934 pub name: Identifier,
6935 pub table: TableRef,
6936 pub timing: TriggerTiming,
6937 pub events: Vec<TriggerEvent>,
6938 pub for_each: TriggerForEach,
6939 pub when: Option<Expression>,
6940 pub body: TriggerBody,
6941 pub or_replace: bool,
6942 pub constraint: bool,
6943 pub deferrable: Option<bool>,
6944 pub initially_deferred: Option<bool>,
6945 pub referencing: Option<TriggerReferencing>,
6946}
6947
6948#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6950#[cfg_attr(feature = "bindings", derive(TS))]
6951pub enum TriggerTiming {
6952 Before,
6953 After,
6954 InsteadOf,
6955}
6956
6957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6959#[cfg_attr(feature = "bindings", derive(TS))]
6960pub enum TriggerEvent {
6961 Insert,
6962 Update(Option<Vec<Identifier>>),
6963 Delete,
6964 Truncate,
6965}
6966
6967#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6969#[cfg_attr(feature = "bindings", derive(TS))]
6970pub enum TriggerForEach {
6971 Row,
6972 Statement,
6973}
6974
6975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6977#[cfg_attr(feature = "bindings", derive(TS))]
6978pub enum TriggerBody {
6979 Execute {
6981 function: TableRef,
6982 args: Vec<Expression>,
6983 },
6984 Block(String),
6986}
6987
6988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6990#[cfg_attr(feature = "bindings", derive(TS))]
6991pub struct TriggerReferencing {
6992 pub old_table: Option<Identifier>,
6993 pub new_table: Option<Identifier>,
6994 pub old_row: Option<Identifier>,
6995 pub new_row: Option<Identifier>,
6996}
6997
6998impl CreateTrigger {
6999 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
7000 Self {
7001 name: Identifier::new(name),
7002 table: TableRef::new(table),
7003 timing: TriggerTiming::Before,
7004 events: Vec::new(),
7005 for_each: TriggerForEach::Row,
7006 when: None,
7007 body: TriggerBody::Execute {
7008 function: TableRef::new(""),
7009 args: Vec::new(),
7010 },
7011 or_replace: false,
7012 constraint: false,
7013 deferrable: None,
7014 initially_deferred: None,
7015 referencing: None,
7016 }
7017 }
7018}
7019
7020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7022#[cfg_attr(feature = "bindings", derive(TS))]
7023pub struct DropTrigger {
7024 pub name: Identifier,
7025 pub table: Option<TableRef>,
7026 pub if_exists: bool,
7027 pub cascade: bool,
7028}
7029
7030impl DropTrigger {
7031 pub fn new(name: impl Into<String>) -> Self {
7032 Self {
7033 name: Identifier::new(name),
7034 table: None,
7035 if_exists: false,
7036 cascade: false,
7037 }
7038 }
7039}
7040
7041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7043#[cfg_attr(feature = "bindings", derive(TS))]
7044pub struct CreateType {
7045 pub name: TableRef,
7046 pub definition: TypeDefinition,
7047 pub if_not_exists: bool,
7048}
7049
7050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7052#[cfg_attr(feature = "bindings", derive(TS))]
7053pub enum TypeDefinition {
7054 Enum(Vec<String>),
7056 Composite(Vec<TypeAttribute>),
7058 Range {
7060 subtype: DataType,
7061 subtype_diff: Option<String>,
7062 canonical: Option<String>,
7063 },
7064 Base {
7066 input: String,
7067 output: String,
7068 internallength: Option<i32>,
7069 },
7070 Domain {
7072 base_type: DataType,
7073 default: Option<Expression>,
7074 constraints: Vec<DomainConstraint>,
7075 },
7076}
7077
7078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7080#[cfg_attr(feature = "bindings", derive(TS))]
7081pub struct TypeAttribute {
7082 pub name: Identifier,
7083 pub data_type: DataType,
7084 pub collate: Option<Identifier>,
7085}
7086
7087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7089#[cfg_attr(feature = "bindings", derive(TS))]
7090pub struct DomainConstraint {
7091 pub name: Option<Identifier>,
7092 pub check: Expression,
7093}
7094
7095impl CreateType {
7096 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
7097 Self {
7098 name: TableRef::new(name),
7099 definition: TypeDefinition::Enum(values),
7100 if_not_exists: false,
7101 }
7102 }
7103
7104 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
7105 Self {
7106 name: TableRef::new(name),
7107 definition: TypeDefinition::Composite(attributes),
7108 if_not_exists: false,
7109 }
7110 }
7111}
7112
7113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7115#[cfg_attr(feature = "bindings", derive(TS))]
7116pub struct DropType {
7117 pub name: TableRef,
7118 pub if_exists: bool,
7119 pub cascade: bool,
7120}
7121
7122impl DropType {
7123 pub fn new(name: impl Into<String>) -> Self {
7124 Self {
7125 name: TableRef::new(name),
7126 if_exists: false,
7127 cascade: false,
7128 }
7129 }
7130}
7131
7132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7134#[cfg_attr(feature = "bindings", derive(TS))]
7135pub struct Describe {
7136 pub target: Expression,
7138 pub extended: bool,
7140 pub formatted: bool,
7142 #[serde(default)]
7144 pub kind: Option<String>,
7145 #[serde(default)]
7147 pub properties: Vec<(String, String)>,
7148 #[serde(default, skip_serializing_if = "Option::is_none")]
7150 pub style: Option<String>,
7151 #[serde(default)]
7153 pub partition: Option<Box<Expression>>,
7154 #[serde(default)]
7156 pub leading_comments: Vec<String>,
7157}
7158
7159impl Describe {
7160 pub fn new(target: Expression) -> Self {
7161 Self {
7162 target,
7163 extended: false,
7164 formatted: false,
7165 kind: None,
7166 properties: Vec::new(),
7167 style: None,
7168 partition: None,
7169 leading_comments: Vec::new(),
7170 }
7171 }
7172}
7173
7174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7176#[cfg_attr(feature = "bindings", derive(TS))]
7177pub struct Show {
7178 pub this: String,
7180 #[serde(default)]
7182 pub terse: bool,
7183 #[serde(default)]
7185 pub history: bool,
7186 pub like: Option<Expression>,
7188 pub scope_kind: Option<String>,
7190 pub scope: Option<Expression>,
7192 pub starts_with: Option<Expression>,
7194 pub limit: Option<Box<Limit>>,
7196 pub from: Option<Expression>,
7198 #[serde(default, skip_serializing_if = "Option::is_none")]
7200 pub where_clause: Option<Expression>,
7201 #[serde(default, skip_serializing_if = "Option::is_none")]
7203 pub for_target: Option<Expression>,
7204 #[serde(default, skip_serializing_if = "Option::is_none")]
7206 pub db: Option<Expression>,
7207 #[serde(default, skip_serializing_if = "Option::is_none")]
7209 pub target: Option<Expression>,
7210 #[serde(default, skip_serializing_if = "Option::is_none")]
7212 pub mutex: Option<bool>,
7213 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7215 pub privileges: Vec<String>,
7216}
7217
7218impl Show {
7219 pub fn new(this: impl Into<String>) -> Self {
7220 Self {
7221 this: this.into(),
7222 terse: false,
7223 history: false,
7224 like: None,
7225 scope_kind: None,
7226 scope: None,
7227 starts_with: None,
7228 limit: None,
7229 from: None,
7230 where_clause: None,
7231 for_target: None,
7232 db: None,
7233 target: None,
7234 mutex: None,
7235 privileges: Vec::new(),
7236 }
7237 }
7238}
7239
7240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7245#[cfg_attr(feature = "bindings", derive(TS))]
7246pub struct Paren {
7247 pub this: Expression,
7249 #[serde(default)]
7250 pub trailing_comments: Vec<String>,
7251}
7252
7253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7255#[cfg_attr(feature = "bindings", derive(TS))]
7256pub struct Annotated {
7257 pub this: Expression,
7258 pub trailing_comments: Vec<String>,
7259}
7260
7261
7262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7267#[cfg_attr(feature = "bindings", derive(TS))]
7268pub struct Refresh {
7269 pub this: Box<Expression>,
7270 pub kind: String,
7271}
7272
7273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7275#[cfg_attr(feature = "bindings", derive(TS))]
7276pub struct LockingStatement {
7277 pub this: Box<Expression>,
7278 pub expression: Box<Expression>,
7279}
7280
7281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7283#[cfg_attr(feature = "bindings", derive(TS))]
7284pub struct SequenceProperties {
7285 #[serde(default)]
7286 pub increment: Option<Box<Expression>>,
7287 #[serde(default)]
7288 pub minvalue: Option<Box<Expression>>,
7289 #[serde(default)]
7290 pub maxvalue: Option<Box<Expression>>,
7291 #[serde(default)]
7292 pub cache: Option<Box<Expression>>,
7293 #[serde(default)]
7294 pub start: Option<Box<Expression>>,
7295 #[serde(default)]
7296 pub owned: Option<Box<Expression>>,
7297 #[serde(default)]
7298 pub options: Vec<Expression>,
7299}
7300
7301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7303#[cfg_attr(feature = "bindings", derive(TS))]
7304pub struct TruncateTable {
7305 #[serde(default)]
7306 pub expressions: Vec<Expression>,
7307 #[serde(default)]
7308 pub is_database: Option<Box<Expression>>,
7309 #[serde(default)]
7310 pub exists: bool,
7311 #[serde(default)]
7312 pub only: Option<Box<Expression>>,
7313 #[serde(default)]
7314 pub cluster: Option<Box<Expression>>,
7315 #[serde(default)]
7316 pub identity: Option<Box<Expression>>,
7317 #[serde(default)]
7318 pub option: Option<Box<Expression>>,
7319 #[serde(default)]
7320 pub partition: Option<Box<Expression>>,
7321}
7322
7323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7325#[cfg_attr(feature = "bindings", derive(TS))]
7326pub struct Clone {
7327 pub this: Box<Expression>,
7328 #[serde(default)]
7329 pub shallow: Option<Box<Expression>>,
7330 #[serde(default)]
7331 pub copy: Option<Box<Expression>>,
7332}
7333
7334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7336#[cfg_attr(feature = "bindings", derive(TS))]
7337pub struct Attach {
7338 pub this: Box<Expression>,
7339 #[serde(default)]
7340 pub exists: bool,
7341 #[serde(default)]
7342 pub expressions: Vec<Expression>,
7343}
7344
7345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7347#[cfg_attr(feature = "bindings", derive(TS))]
7348pub struct Detach {
7349 pub this: Box<Expression>,
7350 #[serde(default)]
7351 pub exists: bool,
7352}
7353
7354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7356#[cfg_attr(feature = "bindings", derive(TS))]
7357pub struct Install {
7358 pub this: Box<Expression>,
7359 #[serde(default)]
7360 pub from_: Option<Box<Expression>>,
7361 #[serde(default)]
7362 pub force: Option<Box<Expression>>,
7363}
7364
7365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7367#[cfg_attr(feature = "bindings", derive(TS))]
7368pub struct Summarize {
7369 pub this: Box<Expression>,
7370 #[serde(default)]
7371 pub table: Option<Box<Expression>>,
7372}
7373
7374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7376#[cfg_attr(feature = "bindings", derive(TS))]
7377pub struct Declare {
7378 #[serde(default)]
7379 pub expressions: Vec<Expression>,
7380}
7381
7382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7384#[cfg_attr(feature = "bindings", derive(TS))]
7385pub struct DeclareItem {
7386 pub this: Box<Expression>,
7387 #[serde(default)]
7388 pub kind: Option<String>,
7389 #[serde(default)]
7390 pub default: Option<Box<Expression>>,
7391 #[serde(default)]
7392 pub has_as: bool,
7393 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7395 pub additional_names: Vec<Expression>,
7396}
7397
7398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7400#[cfg_attr(feature = "bindings", derive(TS))]
7401pub struct Set {
7402 #[serde(default)]
7403 pub expressions: Vec<Expression>,
7404 #[serde(default)]
7405 pub unset: Option<Box<Expression>>,
7406 #[serde(default)]
7407 pub tag: Option<Box<Expression>>,
7408}
7409
7410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7412#[cfg_attr(feature = "bindings", derive(TS))]
7413pub struct Heredoc {
7414 pub this: Box<Expression>,
7415 #[serde(default)]
7416 pub tag: Option<Box<Expression>>,
7417}
7418
7419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7421#[cfg_attr(feature = "bindings", derive(TS))]
7422pub struct QueryBand {
7423 pub this: Box<Expression>,
7424 #[serde(default)]
7425 pub scope: Option<Box<Expression>>,
7426 #[serde(default)]
7427 pub update: Option<Box<Expression>>,
7428}
7429
7430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7432#[cfg_attr(feature = "bindings", derive(TS))]
7433pub struct UserDefinedFunction {
7434 pub this: Box<Expression>,
7435 #[serde(default)]
7436 pub expressions: Vec<Expression>,
7437 #[serde(default)]
7438 pub wrapped: Option<Box<Expression>>,
7439}
7440
7441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7443#[cfg_attr(feature = "bindings", derive(TS))]
7444pub struct RecursiveWithSearch {
7445 pub kind: String,
7446 pub this: Box<Expression>,
7447 pub expression: Box<Expression>,
7448 #[serde(default)]
7449 pub using: Option<Box<Expression>>,
7450}
7451
7452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7454#[cfg_attr(feature = "bindings", derive(TS))]
7455pub struct ProjectionDef {
7456 pub this: Box<Expression>,
7457 pub expression: Box<Expression>,
7458}
7459
7460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7462#[cfg_attr(feature = "bindings", derive(TS))]
7463pub struct TableAlias {
7464 #[serde(default)]
7465 pub this: Option<Box<Expression>>,
7466 #[serde(default)]
7467 pub columns: Vec<Expression>,
7468}
7469
7470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7472#[cfg_attr(feature = "bindings", derive(TS))]
7473pub struct ByteString {
7474 pub this: Box<Expression>,
7475 #[serde(default)]
7476 pub is_bytes: Option<Box<Expression>>,
7477}
7478
7479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7482#[cfg_attr(feature = "bindings", derive(TS))]
7483pub struct HexStringExpr {
7484 pub this: Box<Expression>,
7485 #[serde(default)]
7486 pub is_integer: Option<bool>,
7487}
7488
7489#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7491#[cfg_attr(feature = "bindings", derive(TS))]
7492pub struct UnicodeString {
7493 pub this: Box<Expression>,
7494 #[serde(default)]
7495 pub escape: Option<Box<Expression>>,
7496}
7497
7498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7500#[cfg_attr(feature = "bindings", derive(TS))]
7501pub struct AlterColumn {
7502 pub this: Box<Expression>,
7503 #[serde(default)]
7504 pub dtype: Option<Box<Expression>>,
7505 #[serde(default)]
7506 pub collate: Option<Box<Expression>>,
7507 #[serde(default)]
7508 pub using: Option<Box<Expression>>,
7509 #[serde(default)]
7510 pub default: Option<Box<Expression>>,
7511 #[serde(default)]
7512 pub drop: Option<Box<Expression>>,
7513 #[serde(default)]
7514 pub comment: Option<Box<Expression>>,
7515 #[serde(default)]
7516 pub allow_null: Option<Box<Expression>>,
7517 #[serde(default)]
7518 pub visible: Option<Box<Expression>>,
7519 #[serde(default)]
7520 pub rename_to: Option<Box<Expression>>,
7521}
7522
7523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7525#[cfg_attr(feature = "bindings", derive(TS))]
7526pub struct AlterSortKey {
7527 #[serde(default)]
7528 pub this: Option<Box<Expression>>,
7529 #[serde(default)]
7530 pub expressions: Vec<Expression>,
7531 #[serde(default)]
7532 pub compound: Option<Box<Expression>>,
7533}
7534
7535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7537#[cfg_attr(feature = "bindings", derive(TS))]
7538pub struct AlterSet {
7539 #[serde(default)]
7540 pub expressions: Vec<Expression>,
7541 #[serde(default)]
7542 pub option: Option<Box<Expression>>,
7543 #[serde(default)]
7544 pub tablespace: Option<Box<Expression>>,
7545 #[serde(default)]
7546 pub access_method: Option<Box<Expression>>,
7547 #[serde(default)]
7548 pub file_format: Option<Box<Expression>>,
7549 #[serde(default)]
7550 pub copy_options: Option<Box<Expression>>,
7551 #[serde(default)]
7552 pub tag: Option<Box<Expression>>,
7553 #[serde(default)]
7554 pub location: Option<Box<Expression>>,
7555 #[serde(default)]
7556 pub serde: Option<Box<Expression>>,
7557}
7558
7559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7561#[cfg_attr(feature = "bindings", derive(TS))]
7562pub struct RenameColumn {
7563 pub this: Box<Expression>,
7564 #[serde(default)]
7565 pub to: Option<Box<Expression>>,
7566 #[serde(default)]
7567 pub exists: bool,
7568}
7569
7570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7572#[cfg_attr(feature = "bindings", derive(TS))]
7573pub struct Comprehension {
7574 pub this: Box<Expression>,
7575 pub expression: Box<Expression>,
7576 #[serde(default)]
7577 pub position: Option<Box<Expression>>,
7578 #[serde(default)]
7579 pub iterator: Option<Box<Expression>>,
7580 #[serde(default)]
7581 pub condition: Option<Box<Expression>>,
7582}
7583
7584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7586#[cfg_attr(feature = "bindings", derive(TS))]
7587pub struct MergeTreeTTLAction {
7588 pub this: Box<Expression>,
7589 #[serde(default)]
7590 pub delete: Option<Box<Expression>>,
7591 #[serde(default)]
7592 pub recompress: Option<Box<Expression>>,
7593 #[serde(default)]
7594 pub to_disk: Option<Box<Expression>>,
7595 #[serde(default)]
7596 pub to_volume: Option<Box<Expression>>,
7597}
7598
7599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7601#[cfg_attr(feature = "bindings", derive(TS))]
7602pub struct MergeTreeTTL {
7603 #[serde(default)]
7604 pub expressions: Vec<Expression>,
7605 #[serde(default)]
7606 pub where_: Option<Box<Expression>>,
7607 #[serde(default)]
7608 pub group: Option<Box<Expression>>,
7609 #[serde(default)]
7610 pub aggregates: Option<Box<Expression>>,
7611}
7612
7613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7615#[cfg_attr(feature = "bindings", derive(TS))]
7616pub struct IndexConstraintOption {
7617 #[serde(default)]
7618 pub key_block_size: Option<Box<Expression>>,
7619 #[serde(default)]
7620 pub using: Option<Box<Expression>>,
7621 #[serde(default)]
7622 pub parser: Option<Box<Expression>>,
7623 #[serde(default)]
7624 pub comment: Option<Box<Expression>>,
7625 #[serde(default)]
7626 pub visible: Option<Box<Expression>>,
7627 #[serde(default)]
7628 pub engine_attr: Option<Box<Expression>>,
7629 #[serde(default)]
7630 pub secondary_engine_attr: Option<Box<Expression>>,
7631}
7632
7633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7635#[cfg_attr(feature = "bindings", derive(TS))]
7636pub struct PeriodForSystemTimeConstraint {
7637 pub this: Box<Expression>,
7638 pub expression: Box<Expression>,
7639}
7640
7641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7643#[cfg_attr(feature = "bindings", derive(TS))]
7644pub struct CaseSpecificColumnConstraint {
7645 #[serde(default)]
7646 pub not_: Option<Box<Expression>>,
7647}
7648
7649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7651#[cfg_attr(feature = "bindings", derive(TS))]
7652pub struct CharacterSetColumnConstraint {
7653 pub this: Box<Expression>,
7654}
7655
7656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7658#[cfg_attr(feature = "bindings", derive(TS))]
7659pub struct CheckColumnConstraint {
7660 pub this: Box<Expression>,
7661 #[serde(default)]
7662 pub enforced: Option<Box<Expression>>,
7663}
7664
7665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7667#[cfg_attr(feature = "bindings", derive(TS))]
7668pub struct CompressColumnConstraint {
7669 #[serde(default)]
7670 pub this: Option<Box<Expression>>,
7671}
7672
7673#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7675#[cfg_attr(feature = "bindings", derive(TS))]
7676pub struct DateFormatColumnConstraint {
7677 pub this: Box<Expression>,
7678}
7679
7680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7682#[cfg_attr(feature = "bindings", derive(TS))]
7683pub struct EphemeralColumnConstraint {
7684 #[serde(default)]
7685 pub this: Option<Box<Expression>>,
7686}
7687
7688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7690#[cfg_attr(feature = "bindings", derive(TS))]
7691pub struct WithOperator {
7692 pub this: Box<Expression>,
7693 pub op: String,
7694}
7695
7696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7698#[cfg_attr(feature = "bindings", derive(TS))]
7699pub struct GeneratedAsIdentityColumnConstraint {
7700 #[serde(default)]
7701 pub this: Option<Box<Expression>>,
7702 #[serde(default)]
7703 pub expression: Option<Box<Expression>>,
7704 #[serde(default)]
7705 pub on_null: Option<Box<Expression>>,
7706 #[serde(default)]
7707 pub start: Option<Box<Expression>>,
7708 #[serde(default)]
7709 pub increment: Option<Box<Expression>>,
7710 #[serde(default)]
7711 pub minvalue: Option<Box<Expression>>,
7712 #[serde(default)]
7713 pub maxvalue: Option<Box<Expression>>,
7714 #[serde(default)]
7715 pub cycle: Option<Box<Expression>>,
7716 #[serde(default)]
7717 pub order: Option<Box<Expression>>,
7718}
7719
7720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7723#[cfg_attr(feature = "bindings", derive(TS))]
7724pub struct AutoIncrementColumnConstraint;
7725
7726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7728#[cfg_attr(feature = "bindings", derive(TS))]
7729pub struct CommentColumnConstraint;
7730
7731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7733#[cfg_attr(feature = "bindings", derive(TS))]
7734pub struct GeneratedAsRowColumnConstraint {
7735 #[serde(default)]
7736 pub start: Option<Box<Expression>>,
7737 #[serde(default)]
7738 pub hidden: Option<Box<Expression>>,
7739}
7740
7741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7743#[cfg_attr(feature = "bindings", derive(TS))]
7744pub struct IndexColumnConstraint {
7745 #[serde(default)]
7746 pub this: Option<Box<Expression>>,
7747 #[serde(default)]
7748 pub expressions: Vec<Expression>,
7749 #[serde(default)]
7750 pub kind: Option<String>,
7751 #[serde(default)]
7752 pub index_type: Option<Box<Expression>>,
7753 #[serde(default)]
7754 pub options: Vec<Expression>,
7755 #[serde(default)]
7756 pub expression: Option<Box<Expression>>,
7757 #[serde(default)]
7758 pub granularity: Option<Box<Expression>>,
7759}
7760
7761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7763#[cfg_attr(feature = "bindings", derive(TS))]
7764pub struct MaskingPolicyColumnConstraint {
7765 pub this: Box<Expression>,
7766 #[serde(default)]
7767 pub expressions: Vec<Expression>,
7768}
7769
7770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7772#[cfg_attr(feature = "bindings", derive(TS))]
7773pub struct NotNullColumnConstraint {
7774 #[serde(default)]
7775 pub allow_null: Option<Box<Expression>>,
7776}
7777
7778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7780#[cfg_attr(feature = "bindings", derive(TS))]
7781pub struct DefaultColumnConstraint {
7782 pub this: Box<Expression>,
7783}
7784
7785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7787#[cfg_attr(feature = "bindings", derive(TS))]
7788pub struct PrimaryKeyColumnConstraint {
7789 #[serde(default)]
7790 pub desc: Option<Box<Expression>>,
7791 #[serde(default)]
7792 pub options: Vec<Expression>,
7793}
7794
7795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7797#[cfg_attr(feature = "bindings", derive(TS))]
7798pub struct UniqueColumnConstraint {
7799 #[serde(default)]
7800 pub this: Option<Box<Expression>>,
7801 #[serde(default)]
7802 pub index_type: Option<Box<Expression>>,
7803 #[serde(default)]
7804 pub on_conflict: Option<Box<Expression>>,
7805 #[serde(default)]
7806 pub nulls: Option<Box<Expression>>,
7807 #[serde(default)]
7808 pub options: Vec<Expression>,
7809}
7810
7811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7813#[cfg_attr(feature = "bindings", derive(TS))]
7814pub struct WatermarkColumnConstraint {
7815 pub this: Box<Expression>,
7816 pub expression: Box<Expression>,
7817}
7818
7819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7821#[cfg_attr(feature = "bindings", derive(TS))]
7822pub struct ComputedColumnConstraint {
7823 pub this: Box<Expression>,
7824 #[serde(default)]
7825 pub persisted: Option<Box<Expression>>,
7826 #[serde(default)]
7827 pub not_null: Option<Box<Expression>>,
7828 #[serde(default)]
7829 pub data_type: Option<Box<Expression>>,
7830}
7831
7832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7834#[cfg_attr(feature = "bindings", derive(TS))]
7835pub struct InOutColumnConstraint {
7836 #[serde(default)]
7837 pub input_: Option<Box<Expression>>,
7838 #[serde(default)]
7839 pub output: Option<Box<Expression>>,
7840}
7841
7842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7844#[cfg_attr(feature = "bindings", derive(TS))]
7845pub struct PathColumnConstraint {
7846 pub this: Box<Expression>,
7847}
7848
7849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7851#[cfg_attr(feature = "bindings", derive(TS))]
7852pub struct Constraint {
7853 pub this: Box<Expression>,
7854 #[serde(default)]
7855 pub expressions: Vec<Expression>,
7856}
7857
7858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7860#[cfg_attr(feature = "bindings", derive(TS))]
7861pub struct Export {
7862 pub this: Box<Expression>,
7863 #[serde(default)]
7864 pub connection: Option<Box<Expression>>,
7865 #[serde(default)]
7866 pub options: Vec<Expression>,
7867}
7868
7869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7871#[cfg_attr(feature = "bindings", derive(TS))]
7872pub struct Filter {
7873 pub this: Box<Expression>,
7874 pub expression: Box<Expression>,
7875}
7876
7877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7879#[cfg_attr(feature = "bindings", derive(TS))]
7880pub struct Changes {
7881 #[serde(default)]
7882 pub information: Option<Box<Expression>>,
7883 #[serde(default)]
7884 pub at_before: Option<Box<Expression>>,
7885 #[serde(default)]
7886 pub end: Option<Box<Expression>>,
7887}
7888
7889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7891#[cfg_attr(feature = "bindings", derive(TS))]
7892pub struct Directory {
7893 pub this: Box<Expression>,
7894 #[serde(default)]
7895 pub local: Option<Box<Expression>>,
7896 #[serde(default)]
7897 pub row_format: Option<Box<Expression>>,
7898}
7899
7900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7902#[cfg_attr(feature = "bindings", derive(TS))]
7903pub struct ForeignKey {
7904 #[serde(default)]
7905 pub expressions: Vec<Expression>,
7906 #[serde(default)]
7907 pub reference: Option<Box<Expression>>,
7908 #[serde(default)]
7909 pub delete: Option<Box<Expression>>,
7910 #[serde(default)]
7911 pub update: Option<Box<Expression>>,
7912 #[serde(default)]
7913 pub options: Vec<Expression>,
7914}
7915
7916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7918#[cfg_attr(feature = "bindings", derive(TS))]
7919pub struct ColumnPrefix {
7920 pub this: Box<Expression>,
7921 pub expression: Box<Expression>,
7922}
7923
7924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7926#[cfg_attr(feature = "bindings", derive(TS))]
7927pub struct PrimaryKey {
7928 #[serde(default)]
7929 pub this: Option<Box<Expression>>,
7930 #[serde(default)]
7931 pub expressions: Vec<Expression>,
7932 #[serde(default)]
7933 pub options: Vec<Expression>,
7934 #[serde(default)]
7935 pub include: Option<Box<Expression>>,
7936}
7937
7938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7940#[cfg_attr(feature = "bindings", derive(TS))]
7941pub struct IntoClause {
7942 #[serde(default)]
7943 pub this: Option<Box<Expression>>,
7944 #[serde(default)]
7945 pub temporary: bool,
7946 #[serde(default)]
7947 pub unlogged: Option<Box<Expression>>,
7948 #[serde(default)]
7949 pub bulk_collect: Option<Box<Expression>>,
7950 #[serde(default)]
7951 pub expressions: Vec<Expression>,
7952}
7953
7954#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7956#[cfg_attr(feature = "bindings", derive(TS))]
7957pub struct JoinHint {
7958 pub this: Box<Expression>,
7959 #[serde(default)]
7960 pub expressions: Vec<Expression>,
7961}
7962
7963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7965#[cfg_attr(feature = "bindings", derive(TS))]
7966pub struct Opclass {
7967 pub this: Box<Expression>,
7968 pub expression: Box<Expression>,
7969}
7970
7971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7973#[cfg_attr(feature = "bindings", derive(TS))]
7974pub struct Index {
7975 #[serde(default)]
7976 pub this: Option<Box<Expression>>,
7977 #[serde(default)]
7978 pub table: Option<Box<Expression>>,
7979 #[serde(default)]
7980 pub unique: bool,
7981 #[serde(default)]
7982 pub primary: Option<Box<Expression>>,
7983 #[serde(default)]
7984 pub amp: Option<Box<Expression>>,
7985 #[serde(default)]
7986 pub params: Vec<Expression>,
7987}
7988
7989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7991#[cfg_attr(feature = "bindings", derive(TS))]
7992pub struct IndexParameters {
7993 #[serde(default)]
7994 pub using: Option<Box<Expression>>,
7995 #[serde(default)]
7996 pub include: Option<Box<Expression>>,
7997 #[serde(default)]
7998 pub columns: Vec<Expression>,
7999 #[serde(default)]
8000 pub with_storage: Option<Box<Expression>>,
8001 #[serde(default)]
8002 pub partition_by: Option<Box<Expression>>,
8003 #[serde(default)]
8004 pub tablespace: Option<Box<Expression>>,
8005 #[serde(default)]
8006 pub where_: Option<Box<Expression>>,
8007 #[serde(default)]
8008 pub on: Option<Box<Expression>>,
8009}
8010
8011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8013#[cfg_attr(feature = "bindings", derive(TS))]
8014pub struct ConditionalInsert {
8015 pub this: Box<Expression>,
8016 #[serde(default)]
8017 pub expression: Option<Box<Expression>>,
8018 #[serde(default)]
8019 pub else_: Option<Box<Expression>>,
8020}
8021
8022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8024#[cfg_attr(feature = "bindings", derive(TS))]
8025pub struct MultitableInserts {
8026 #[serde(default)]
8027 pub expressions: Vec<Expression>,
8028 pub kind: String,
8029 #[serde(default)]
8030 pub source: Option<Box<Expression>>,
8031 #[serde(default)]
8033 pub leading_comments: Vec<String>,
8034}
8035
8036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8038#[cfg_attr(feature = "bindings", derive(TS))]
8039pub struct OnConflict {
8040 #[serde(default)]
8041 pub duplicate: Option<Box<Expression>>,
8042 #[serde(default)]
8043 pub expressions: Vec<Expression>,
8044 #[serde(default)]
8045 pub action: Option<Box<Expression>>,
8046 #[serde(default)]
8047 pub conflict_keys: Option<Box<Expression>>,
8048 #[serde(default)]
8049 pub index_predicate: Option<Box<Expression>>,
8050 #[serde(default)]
8051 pub constraint: Option<Box<Expression>>,
8052 #[serde(default)]
8053 pub where_: Option<Box<Expression>>,
8054}
8055
8056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8058#[cfg_attr(feature = "bindings", derive(TS))]
8059pub struct OnCondition {
8060 #[serde(default)]
8061 pub error: Option<Box<Expression>>,
8062 #[serde(default)]
8063 pub empty: Option<Box<Expression>>,
8064 #[serde(default)]
8065 pub null: Option<Box<Expression>>,
8066}
8067
8068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8070#[cfg_attr(feature = "bindings", derive(TS))]
8071pub struct Returning {
8072 #[serde(default)]
8073 pub expressions: Vec<Expression>,
8074 #[serde(default)]
8075 pub into: Option<Box<Expression>>,
8076}
8077
8078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8080#[cfg_attr(feature = "bindings", derive(TS))]
8081pub struct Introducer {
8082 pub this: Box<Expression>,
8083 pub expression: Box<Expression>,
8084}
8085
8086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8088#[cfg_attr(feature = "bindings", derive(TS))]
8089pub struct PartitionRange {
8090 pub this: Box<Expression>,
8091 #[serde(default)]
8092 pub expression: Option<Box<Expression>>,
8093 #[serde(default)]
8094 pub expressions: Vec<Expression>,
8095}
8096
8097#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8099#[cfg_attr(feature = "bindings", derive(TS))]
8100pub struct Group {
8101 #[serde(default)]
8102 pub expressions: Vec<Expression>,
8103 #[serde(default)]
8104 pub grouping_sets: Option<Box<Expression>>,
8105 #[serde(default)]
8106 pub cube: Option<Box<Expression>>,
8107 #[serde(default)]
8108 pub rollup: Option<Box<Expression>>,
8109 #[serde(default)]
8110 pub totals: Option<Box<Expression>>,
8111 #[serde(default)]
8113 pub all: Option<bool>,
8114}
8115
8116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8118#[cfg_attr(feature = "bindings", derive(TS))]
8119pub struct Cube {
8120 #[serde(default)]
8121 pub expressions: Vec<Expression>,
8122}
8123
8124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8126#[cfg_attr(feature = "bindings", derive(TS))]
8127pub struct Rollup {
8128 #[serde(default)]
8129 pub expressions: Vec<Expression>,
8130}
8131
8132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8134#[cfg_attr(feature = "bindings", derive(TS))]
8135pub struct GroupingSets {
8136 #[serde(default)]
8137 pub expressions: Vec<Expression>,
8138}
8139
8140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8142#[cfg_attr(feature = "bindings", derive(TS))]
8143pub struct LimitOptions {
8144 #[serde(default)]
8145 pub percent: Option<Box<Expression>>,
8146 #[serde(default)]
8147 pub rows: Option<Box<Expression>>,
8148 #[serde(default)]
8149 pub with_ties: Option<Box<Expression>>,
8150}
8151
8152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8154#[cfg_attr(feature = "bindings", derive(TS))]
8155pub struct Lateral {
8156 pub this: Box<Expression>,
8157 #[serde(default)]
8158 pub view: Option<Box<Expression>>,
8159 #[serde(default)]
8160 pub outer: Option<Box<Expression>>,
8161 #[serde(default)]
8162 pub alias: Option<String>,
8163 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8165 pub alias_quoted: bool,
8166 #[serde(default)]
8167 pub cross_apply: Option<Box<Expression>>,
8168 #[serde(default)]
8169 pub ordinality: Option<Box<Expression>>,
8170 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8172 pub column_aliases: Vec<String>,
8173}
8174
8175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8177#[cfg_attr(feature = "bindings", derive(TS))]
8178pub struct TableFromRows {
8179 pub this: Box<Expression>,
8180 #[serde(default)]
8181 pub alias: Option<String>,
8182 #[serde(default)]
8183 pub joins: Vec<Expression>,
8184 #[serde(default)]
8185 pub pivots: Option<Box<Expression>>,
8186 #[serde(default)]
8187 pub sample: Option<Box<Expression>>,
8188}
8189
8190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8193#[cfg_attr(feature = "bindings", derive(TS))]
8194pub struct RowsFrom {
8195 pub expressions: Vec<Expression>,
8197 #[serde(default)]
8199 pub ordinality: bool,
8200 #[serde(default)]
8202 pub alias: Option<Box<Expression>>,
8203}
8204
8205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8207#[cfg_attr(feature = "bindings", derive(TS))]
8208pub struct WithFill {
8209 #[serde(default)]
8210 pub from_: Option<Box<Expression>>,
8211 #[serde(default)]
8212 pub to: Option<Box<Expression>>,
8213 #[serde(default)]
8214 pub step: Option<Box<Expression>>,
8215 #[serde(default)]
8216 pub interpolate: Option<Box<Expression>>,
8217}
8218
8219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8221#[cfg_attr(feature = "bindings", derive(TS))]
8222pub struct Property {
8223 pub this: Box<Expression>,
8224 #[serde(default)]
8225 pub value: Option<Box<Expression>>,
8226}
8227
8228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8230#[cfg_attr(feature = "bindings", derive(TS))]
8231pub struct GrantPrivilege {
8232 pub this: Box<Expression>,
8233 #[serde(default)]
8234 pub expressions: Vec<Expression>,
8235}
8236
8237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8239#[cfg_attr(feature = "bindings", derive(TS))]
8240pub struct AllowedValuesProperty {
8241 #[serde(default)]
8242 pub expressions: Vec<Expression>,
8243}
8244
8245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8247#[cfg_attr(feature = "bindings", derive(TS))]
8248pub struct AlgorithmProperty {
8249 pub this: Box<Expression>,
8250}
8251
8252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8254#[cfg_attr(feature = "bindings", derive(TS))]
8255pub struct AutoIncrementProperty {
8256 pub this: Box<Expression>,
8257}
8258
8259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8261#[cfg_attr(feature = "bindings", derive(TS))]
8262pub struct AutoRefreshProperty {
8263 pub this: Box<Expression>,
8264}
8265
8266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8268#[cfg_attr(feature = "bindings", derive(TS))]
8269pub struct BackupProperty {
8270 pub this: Box<Expression>,
8271}
8272
8273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8275#[cfg_attr(feature = "bindings", derive(TS))]
8276pub struct BuildProperty {
8277 pub this: Box<Expression>,
8278}
8279
8280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8282#[cfg_attr(feature = "bindings", derive(TS))]
8283pub struct BlockCompressionProperty {
8284 #[serde(default)]
8285 pub autotemp: Option<Box<Expression>>,
8286 #[serde(default)]
8287 pub always: Option<Box<Expression>>,
8288 #[serde(default)]
8289 pub default: Option<Box<Expression>>,
8290 #[serde(default)]
8291 pub manual: Option<Box<Expression>>,
8292 #[serde(default)]
8293 pub never: Option<Box<Expression>>,
8294}
8295
8296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8298#[cfg_attr(feature = "bindings", derive(TS))]
8299pub struct CharacterSetProperty {
8300 pub this: Box<Expression>,
8301 #[serde(default)]
8302 pub default: Option<Box<Expression>>,
8303}
8304
8305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8307#[cfg_attr(feature = "bindings", derive(TS))]
8308pub struct ChecksumProperty {
8309 #[serde(default)]
8310 pub on: Option<Box<Expression>>,
8311 #[serde(default)]
8312 pub default: Option<Box<Expression>>,
8313}
8314
8315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8317#[cfg_attr(feature = "bindings", derive(TS))]
8318pub struct CollateProperty {
8319 pub this: Box<Expression>,
8320 #[serde(default)]
8321 pub default: Option<Box<Expression>>,
8322}
8323
8324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8326#[cfg_attr(feature = "bindings", derive(TS))]
8327pub struct DataBlocksizeProperty {
8328 #[serde(default)]
8329 pub size: Option<i64>,
8330 #[serde(default)]
8331 pub units: Option<Box<Expression>>,
8332 #[serde(default)]
8333 pub minimum: Option<Box<Expression>>,
8334 #[serde(default)]
8335 pub maximum: Option<Box<Expression>>,
8336 #[serde(default)]
8337 pub default: Option<Box<Expression>>,
8338}
8339
8340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8342#[cfg_attr(feature = "bindings", derive(TS))]
8343pub struct DataDeletionProperty {
8344 pub on: Box<Expression>,
8345 #[serde(default)]
8346 pub filter_column: Option<Box<Expression>>,
8347 #[serde(default)]
8348 pub retention_period: Option<Box<Expression>>,
8349}
8350
8351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8353#[cfg_attr(feature = "bindings", derive(TS))]
8354pub struct DefinerProperty {
8355 pub this: Box<Expression>,
8356}
8357
8358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8360#[cfg_attr(feature = "bindings", derive(TS))]
8361pub struct DistKeyProperty {
8362 pub this: Box<Expression>,
8363}
8364
8365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8367#[cfg_attr(feature = "bindings", derive(TS))]
8368pub struct DistributedByProperty {
8369 #[serde(default)]
8370 pub expressions: Vec<Expression>,
8371 pub kind: String,
8372 #[serde(default)]
8373 pub buckets: Option<Box<Expression>>,
8374 #[serde(default)]
8375 pub order: Option<Box<Expression>>,
8376}
8377
8378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8380#[cfg_attr(feature = "bindings", derive(TS))]
8381pub struct DistStyleProperty {
8382 pub this: Box<Expression>,
8383}
8384
8385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8387#[cfg_attr(feature = "bindings", derive(TS))]
8388pub struct DuplicateKeyProperty {
8389 #[serde(default)]
8390 pub expressions: Vec<Expression>,
8391}
8392
8393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8395#[cfg_attr(feature = "bindings", derive(TS))]
8396pub struct EngineProperty {
8397 pub this: Box<Expression>,
8398}
8399
8400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8402#[cfg_attr(feature = "bindings", derive(TS))]
8403pub struct ToTableProperty {
8404 pub this: Box<Expression>,
8405}
8406
8407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8409#[cfg_attr(feature = "bindings", derive(TS))]
8410pub struct ExecuteAsProperty {
8411 pub this: Box<Expression>,
8412}
8413
8414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8416#[cfg_attr(feature = "bindings", derive(TS))]
8417pub struct ExternalProperty {
8418 #[serde(default)]
8419 pub this: Option<Box<Expression>>,
8420}
8421
8422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8424#[cfg_attr(feature = "bindings", derive(TS))]
8425pub struct FallbackProperty {
8426 #[serde(default)]
8427 pub no: Option<Box<Expression>>,
8428 #[serde(default)]
8429 pub protection: Option<Box<Expression>>,
8430}
8431
8432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8434#[cfg_attr(feature = "bindings", derive(TS))]
8435pub struct FileFormatProperty {
8436 #[serde(default)]
8437 pub this: Option<Box<Expression>>,
8438 #[serde(default)]
8439 pub expressions: Vec<Expression>,
8440 #[serde(default)]
8441 pub hive_format: Option<Box<Expression>>,
8442}
8443
8444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8446#[cfg_attr(feature = "bindings", derive(TS))]
8447pub struct CredentialsProperty {
8448 #[serde(default)]
8449 pub expressions: Vec<Expression>,
8450}
8451
8452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8454#[cfg_attr(feature = "bindings", derive(TS))]
8455pub struct FreespaceProperty {
8456 pub this: Box<Expression>,
8457 #[serde(default)]
8458 pub percent: Option<Box<Expression>>,
8459}
8460
8461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8463#[cfg_attr(feature = "bindings", derive(TS))]
8464pub struct InheritsProperty {
8465 #[serde(default)]
8466 pub expressions: Vec<Expression>,
8467}
8468
8469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8471#[cfg_attr(feature = "bindings", derive(TS))]
8472pub struct InputModelProperty {
8473 pub this: Box<Expression>,
8474}
8475
8476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8478#[cfg_attr(feature = "bindings", derive(TS))]
8479pub struct OutputModelProperty {
8480 pub this: Box<Expression>,
8481}
8482
8483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8485#[cfg_attr(feature = "bindings", derive(TS))]
8486pub struct IsolatedLoadingProperty {
8487 #[serde(default)]
8488 pub no: Option<Box<Expression>>,
8489 #[serde(default)]
8490 pub concurrent: Option<Box<Expression>>,
8491 #[serde(default)]
8492 pub target: Option<Box<Expression>>,
8493}
8494
8495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8497#[cfg_attr(feature = "bindings", derive(TS))]
8498pub struct JournalProperty {
8499 #[serde(default)]
8500 pub no: Option<Box<Expression>>,
8501 #[serde(default)]
8502 pub dual: Option<Box<Expression>>,
8503 #[serde(default)]
8504 pub before: Option<Box<Expression>>,
8505 #[serde(default)]
8506 pub local: Option<Box<Expression>>,
8507 #[serde(default)]
8508 pub after: Option<Box<Expression>>,
8509}
8510
8511#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8513#[cfg_attr(feature = "bindings", derive(TS))]
8514pub struct LanguageProperty {
8515 pub this: Box<Expression>,
8516}
8517
8518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8520#[cfg_attr(feature = "bindings", derive(TS))]
8521pub struct EnviromentProperty {
8522 #[serde(default)]
8523 pub expressions: Vec<Expression>,
8524}
8525
8526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8528#[cfg_attr(feature = "bindings", derive(TS))]
8529pub struct ClusteredByProperty {
8530 #[serde(default)]
8531 pub expressions: Vec<Expression>,
8532 #[serde(default)]
8533 pub sorted_by: Option<Box<Expression>>,
8534 #[serde(default)]
8535 pub buckets: Option<Box<Expression>>,
8536}
8537
8538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8540#[cfg_attr(feature = "bindings", derive(TS))]
8541pub struct DictProperty {
8542 pub this: Box<Expression>,
8543 pub kind: String,
8544 #[serde(default)]
8545 pub settings: Option<Box<Expression>>,
8546}
8547
8548#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8550#[cfg_attr(feature = "bindings", derive(TS))]
8551pub struct DictRange {
8552 pub this: Box<Expression>,
8553 #[serde(default)]
8554 pub min: Option<Box<Expression>>,
8555 #[serde(default)]
8556 pub max: Option<Box<Expression>>,
8557}
8558
8559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8561#[cfg_attr(feature = "bindings", derive(TS))]
8562pub struct OnCluster {
8563 pub this: Box<Expression>,
8564}
8565
8566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8568#[cfg_attr(feature = "bindings", derive(TS))]
8569pub struct LikeProperty {
8570 pub this: Box<Expression>,
8571 #[serde(default)]
8572 pub expressions: Vec<Expression>,
8573}
8574
8575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8577#[cfg_attr(feature = "bindings", derive(TS))]
8578pub struct LocationProperty {
8579 pub this: Box<Expression>,
8580}
8581
8582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8584#[cfg_attr(feature = "bindings", derive(TS))]
8585pub struct LockProperty {
8586 pub this: Box<Expression>,
8587}
8588
8589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8591#[cfg_attr(feature = "bindings", derive(TS))]
8592pub struct LockingProperty {
8593 #[serde(default)]
8594 pub this: Option<Box<Expression>>,
8595 pub kind: String,
8596 #[serde(default)]
8597 pub for_or_in: Option<Box<Expression>>,
8598 #[serde(default)]
8599 pub lock_type: Option<Box<Expression>>,
8600 #[serde(default)]
8601 pub override_: Option<Box<Expression>>,
8602}
8603
8604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8606#[cfg_attr(feature = "bindings", derive(TS))]
8607pub struct LogProperty {
8608 #[serde(default)]
8609 pub no: Option<Box<Expression>>,
8610}
8611
8612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8614#[cfg_attr(feature = "bindings", derive(TS))]
8615pub struct MaterializedProperty {
8616 #[serde(default)]
8617 pub this: Option<Box<Expression>>,
8618}
8619
8620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8622#[cfg_attr(feature = "bindings", derive(TS))]
8623pub struct MergeBlockRatioProperty {
8624 #[serde(default)]
8625 pub this: Option<Box<Expression>>,
8626 #[serde(default)]
8627 pub no: Option<Box<Expression>>,
8628 #[serde(default)]
8629 pub default: Option<Box<Expression>>,
8630 #[serde(default)]
8631 pub percent: Option<Box<Expression>>,
8632}
8633
8634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8636#[cfg_attr(feature = "bindings", derive(TS))]
8637pub struct OnProperty {
8638 pub this: Box<Expression>,
8639}
8640
8641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8643#[cfg_attr(feature = "bindings", derive(TS))]
8644pub struct OnCommitProperty {
8645 #[serde(default)]
8646 pub delete: Option<Box<Expression>>,
8647}
8648
8649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8651#[cfg_attr(feature = "bindings", derive(TS))]
8652pub struct PartitionedByProperty {
8653 pub this: Box<Expression>,
8654}
8655
8656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8658#[cfg_attr(feature = "bindings", derive(TS))]
8659pub struct PartitionedByBucket {
8660 pub this: Box<Expression>,
8661 pub expression: Box<Expression>,
8662}
8663
8664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8666#[cfg_attr(feature = "bindings", derive(TS))]
8667pub struct PartitionByTruncate {
8668 pub this: Box<Expression>,
8669 pub expression: Box<Expression>,
8670}
8671
8672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8674#[cfg_attr(feature = "bindings", derive(TS))]
8675pub struct PartitionByRangeProperty {
8676 #[serde(default)]
8677 pub partition_expressions: Option<Box<Expression>>,
8678 #[serde(default)]
8679 pub create_expressions: Option<Box<Expression>>,
8680}
8681
8682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8684#[cfg_attr(feature = "bindings", derive(TS))]
8685pub struct PartitionByRangePropertyDynamic {
8686 #[serde(default)]
8687 pub this: Option<Box<Expression>>,
8688 #[serde(default)]
8689 pub start: Option<Box<Expression>>,
8690 #[serde(default)]
8691 pub end: Option<Box<Expression>>,
8692 #[serde(default)]
8693 pub every: Option<Box<Expression>>,
8694}
8695
8696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8698#[cfg_attr(feature = "bindings", derive(TS))]
8699pub struct PartitionByListProperty {
8700 #[serde(default)]
8701 pub partition_expressions: Option<Box<Expression>>,
8702 #[serde(default)]
8703 pub create_expressions: Option<Box<Expression>>,
8704}
8705
8706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8708#[cfg_attr(feature = "bindings", derive(TS))]
8709pub struct PartitionList {
8710 pub this: Box<Expression>,
8711 #[serde(default)]
8712 pub expressions: Vec<Expression>,
8713}
8714
8715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8717#[cfg_attr(feature = "bindings", derive(TS))]
8718pub struct Partition {
8719 pub expressions: Vec<Expression>,
8720 #[serde(default)]
8721 pub subpartition: bool,
8722}
8723
8724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8727#[cfg_attr(feature = "bindings", derive(TS))]
8728pub struct RefreshTriggerProperty {
8729 pub method: String,
8731 #[serde(default)]
8733 pub kind: Option<String>,
8734 #[serde(default)]
8736 pub every: Option<Box<Expression>>,
8737 #[serde(default)]
8739 pub unit: Option<String>,
8740 #[serde(default)]
8742 pub starts: Option<Box<Expression>>,
8743}
8744
8745#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8747#[cfg_attr(feature = "bindings", derive(TS))]
8748pub struct UniqueKeyProperty {
8749 #[serde(default)]
8750 pub expressions: Vec<Expression>,
8751}
8752
8753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8755#[cfg_attr(feature = "bindings", derive(TS))]
8756pub struct RollupProperty {
8757 pub expressions: Vec<RollupIndex>,
8758}
8759
8760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8762#[cfg_attr(feature = "bindings", derive(TS))]
8763pub struct RollupIndex {
8764 pub name: Identifier,
8765 pub expressions: Vec<Identifier>,
8766}
8767
8768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8770#[cfg_attr(feature = "bindings", derive(TS))]
8771pub struct PartitionBoundSpec {
8772 #[serde(default)]
8773 pub this: Option<Box<Expression>>,
8774 #[serde(default)]
8775 pub expression: Option<Box<Expression>>,
8776 #[serde(default)]
8777 pub from_expressions: Option<Box<Expression>>,
8778 #[serde(default)]
8779 pub to_expressions: Option<Box<Expression>>,
8780}
8781
8782#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8784#[cfg_attr(feature = "bindings", derive(TS))]
8785pub struct PartitionedOfProperty {
8786 pub this: Box<Expression>,
8787 pub expression: Box<Expression>,
8788}
8789
8790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8792#[cfg_attr(feature = "bindings", derive(TS))]
8793pub struct RemoteWithConnectionModelProperty {
8794 pub this: Box<Expression>,
8795}
8796
8797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8799#[cfg_attr(feature = "bindings", derive(TS))]
8800pub struct ReturnsProperty {
8801 #[serde(default)]
8802 pub this: Option<Box<Expression>>,
8803 #[serde(default)]
8804 pub is_table: Option<Box<Expression>>,
8805 #[serde(default)]
8806 pub table: Option<Box<Expression>>,
8807 #[serde(default)]
8808 pub null: Option<Box<Expression>>,
8809}
8810
8811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8813#[cfg_attr(feature = "bindings", derive(TS))]
8814pub struct RowFormatProperty {
8815 pub this: Box<Expression>,
8816}
8817
8818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8820#[cfg_attr(feature = "bindings", derive(TS))]
8821pub struct RowFormatDelimitedProperty {
8822 #[serde(default)]
8823 pub fields: Option<Box<Expression>>,
8824 #[serde(default)]
8825 pub escaped: Option<Box<Expression>>,
8826 #[serde(default)]
8827 pub collection_items: Option<Box<Expression>>,
8828 #[serde(default)]
8829 pub map_keys: Option<Box<Expression>>,
8830 #[serde(default)]
8831 pub lines: Option<Box<Expression>>,
8832 #[serde(default)]
8833 pub null: Option<Box<Expression>>,
8834 #[serde(default)]
8835 pub serde: Option<Box<Expression>>,
8836}
8837
8838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8840#[cfg_attr(feature = "bindings", derive(TS))]
8841pub struct RowFormatSerdeProperty {
8842 pub this: Box<Expression>,
8843 #[serde(default)]
8844 pub serde_properties: Option<Box<Expression>>,
8845}
8846
8847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8849#[cfg_attr(feature = "bindings", derive(TS))]
8850pub struct QueryTransform {
8851 #[serde(default)]
8852 pub expressions: Vec<Expression>,
8853 #[serde(default)]
8854 pub command_script: Option<Box<Expression>>,
8855 #[serde(default)]
8856 pub schema: Option<Box<Expression>>,
8857 #[serde(default)]
8858 pub row_format_before: Option<Box<Expression>>,
8859 #[serde(default)]
8860 pub record_writer: Option<Box<Expression>>,
8861 #[serde(default)]
8862 pub row_format_after: Option<Box<Expression>>,
8863 #[serde(default)]
8864 pub record_reader: Option<Box<Expression>>,
8865}
8866
8867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8869#[cfg_attr(feature = "bindings", derive(TS))]
8870pub struct SampleProperty {
8871 pub this: Box<Expression>,
8872}
8873
8874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8876#[cfg_attr(feature = "bindings", derive(TS))]
8877pub struct SecurityProperty {
8878 pub this: Box<Expression>,
8879}
8880
8881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8883#[cfg_attr(feature = "bindings", derive(TS))]
8884pub struct SchemaCommentProperty {
8885 pub this: Box<Expression>,
8886}
8887
8888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8890#[cfg_attr(feature = "bindings", derive(TS))]
8891pub struct SemanticView {
8892 pub this: Box<Expression>,
8893 #[serde(default)]
8894 pub metrics: Option<Box<Expression>>,
8895 #[serde(default)]
8896 pub dimensions: Option<Box<Expression>>,
8897 #[serde(default)]
8898 pub facts: Option<Box<Expression>>,
8899 #[serde(default)]
8900 pub where_: Option<Box<Expression>>,
8901}
8902
8903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8905#[cfg_attr(feature = "bindings", derive(TS))]
8906pub struct SerdeProperties {
8907 #[serde(default)]
8908 pub expressions: Vec<Expression>,
8909 #[serde(default)]
8910 pub with_: Option<Box<Expression>>,
8911}
8912
8913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8915#[cfg_attr(feature = "bindings", derive(TS))]
8916pub struct SetProperty {
8917 #[serde(default)]
8918 pub multi: Option<Box<Expression>>,
8919}
8920
8921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8923#[cfg_attr(feature = "bindings", derive(TS))]
8924pub struct SharingProperty {
8925 #[serde(default)]
8926 pub this: Option<Box<Expression>>,
8927}
8928
8929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8931#[cfg_attr(feature = "bindings", derive(TS))]
8932pub struct SetConfigProperty {
8933 pub this: Box<Expression>,
8934}
8935
8936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8938#[cfg_attr(feature = "bindings", derive(TS))]
8939pub struct SettingsProperty {
8940 #[serde(default)]
8941 pub expressions: Vec<Expression>,
8942}
8943
8944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8946#[cfg_attr(feature = "bindings", derive(TS))]
8947pub struct SortKeyProperty {
8948 pub this: Box<Expression>,
8949 #[serde(default)]
8950 pub compound: Option<Box<Expression>>,
8951}
8952
8953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8955#[cfg_attr(feature = "bindings", derive(TS))]
8956pub struct SqlReadWriteProperty {
8957 pub this: Box<Expression>,
8958}
8959
8960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8962#[cfg_attr(feature = "bindings", derive(TS))]
8963pub struct SqlSecurityProperty {
8964 pub this: Box<Expression>,
8965}
8966
8967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8969#[cfg_attr(feature = "bindings", derive(TS))]
8970pub struct StabilityProperty {
8971 pub this: Box<Expression>,
8972}
8973
8974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8976#[cfg_attr(feature = "bindings", derive(TS))]
8977pub struct StorageHandlerProperty {
8978 pub this: Box<Expression>,
8979}
8980
8981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8983#[cfg_attr(feature = "bindings", derive(TS))]
8984pub struct TemporaryProperty {
8985 #[serde(default)]
8986 pub this: Option<Box<Expression>>,
8987}
8988
8989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8991#[cfg_attr(feature = "bindings", derive(TS))]
8992pub struct Tags {
8993 #[serde(default)]
8994 pub expressions: Vec<Expression>,
8995}
8996
8997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8999#[cfg_attr(feature = "bindings", derive(TS))]
9000pub struct TransformModelProperty {
9001 #[serde(default)]
9002 pub expressions: Vec<Expression>,
9003}
9004
9005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9007#[cfg_attr(feature = "bindings", derive(TS))]
9008pub struct TransientProperty {
9009 #[serde(default)]
9010 pub this: Option<Box<Expression>>,
9011}
9012
9013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9015#[cfg_attr(feature = "bindings", derive(TS))]
9016pub struct UsingTemplateProperty {
9017 pub this: Box<Expression>,
9018}
9019
9020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9022#[cfg_attr(feature = "bindings", derive(TS))]
9023pub struct ViewAttributeProperty {
9024 pub this: Box<Expression>,
9025}
9026
9027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9029#[cfg_attr(feature = "bindings", derive(TS))]
9030pub struct VolatileProperty {
9031 #[serde(default)]
9032 pub this: Option<Box<Expression>>,
9033}
9034
9035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9037#[cfg_attr(feature = "bindings", derive(TS))]
9038pub struct WithDataProperty {
9039 #[serde(default)]
9040 pub no: Option<Box<Expression>>,
9041 #[serde(default)]
9042 pub statistics: Option<Box<Expression>>,
9043}
9044
9045#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9047#[cfg_attr(feature = "bindings", derive(TS))]
9048pub struct WithJournalTableProperty {
9049 pub this: Box<Expression>,
9050}
9051
9052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9054#[cfg_attr(feature = "bindings", derive(TS))]
9055pub struct WithSchemaBindingProperty {
9056 pub this: Box<Expression>,
9057}
9058
9059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9061#[cfg_attr(feature = "bindings", derive(TS))]
9062pub struct WithSystemVersioningProperty {
9063 #[serde(default)]
9064 pub on: Option<Box<Expression>>,
9065 #[serde(default)]
9066 pub this: Option<Box<Expression>>,
9067 #[serde(default)]
9068 pub data_consistency: Option<Box<Expression>>,
9069 #[serde(default)]
9070 pub retention_period: Option<Box<Expression>>,
9071 #[serde(default)]
9072 pub with_: Option<Box<Expression>>,
9073}
9074
9075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9077#[cfg_attr(feature = "bindings", derive(TS))]
9078pub struct WithProcedureOptions {
9079 #[serde(default)]
9080 pub expressions: Vec<Expression>,
9081}
9082
9083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9085#[cfg_attr(feature = "bindings", derive(TS))]
9086pub struct EncodeProperty {
9087 pub this: Box<Expression>,
9088 #[serde(default)]
9089 pub properties: Vec<Expression>,
9090 #[serde(default)]
9091 pub key: Option<Box<Expression>>,
9092}
9093
9094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9096#[cfg_attr(feature = "bindings", derive(TS))]
9097pub struct IncludeProperty {
9098 pub this: Box<Expression>,
9099 #[serde(default)]
9100 pub alias: Option<String>,
9101 #[serde(default)]
9102 pub column_def: Option<Box<Expression>>,
9103}
9104
9105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9107#[cfg_attr(feature = "bindings", derive(TS))]
9108pub struct Properties {
9109 #[serde(default)]
9110 pub expressions: Vec<Expression>,
9111}
9112
9113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9115#[cfg_attr(feature = "bindings", derive(TS))]
9116pub struct InputOutputFormat {
9117 #[serde(default)]
9118 pub input_format: Option<Box<Expression>>,
9119 #[serde(default)]
9120 pub output_format: Option<Box<Expression>>,
9121}
9122
9123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9125#[cfg_attr(feature = "bindings", derive(TS))]
9126pub struct Reference {
9127 pub this: Box<Expression>,
9128 #[serde(default)]
9129 pub expressions: Vec<Expression>,
9130 #[serde(default)]
9131 pub options: Vec<Expression>,
9132}
9133
9134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9136#[cfg_attr(feature = "bindings", derive(TS))]
9137pub struct QueryOption {
9138 pub this: Box<Expression>,
9139 #[serde(default)]
9140 pub expression: Option<Box<Expression>>,
9141}
9142
9143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9145#[cfg_attr(feature = "bindings", derive(TS))]
9146pub struct WithTableHint {
9147 #[serde(default)]
9148 pub expressions: Vec<Expression>,
9149}
9150
9151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9153#[cfg_attr(feature = "bindings", derive(TS))]
9154pub struct IndexTableHint {
9155 pub this: Box<Expression>,
9156 #[serde(default)]
9157 pub expressions: Vec<Expression>,
9158 #[serde(default)]
9159 pub target: Option<Box<Expression>>,
9160}
9161
9162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9164#[cfg_attr(feature = "bindings", derive(TS))]
9165pub struct Get {
9166 pub this: Box<Expression>,
9167 #[serde(default)]
9168 pub target: Option<Box<Expression>>,
9169 #[serde(default)]
9170 pub properties: Vec<Expression>,
9171}
9172
9173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9175#[cfg_attr(feature = "bindings", derive(TS))]
9176pub struct SetOperation {
9177 #[serde(default)]
9178 pub with_: Option<Box<Expression>>,
9179 pub this: Box<Expression>,
9180 pub expression: Box<Expression>,
9181 #[serde(default)]
9182 pub distinct: bool,
9183 #[serde(default)]
9184 pub by_name: Option<Box<Expression>>,
9185 #[serde(default)]
9186 pub side: Option<Box<Expression>>,
9187 #[serde(default)]
9188 pub kind: Option<String>,
9189 #[serde(default)]
9190 pub on: Option<Box<Expression>>,
9191}
9192
9193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9195#[cfg_attr(feature = "bindings", derive(TS))]
9196pub struct Var {
9197 pub this: String,
9198}
9199
9200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9202#[cfg_attr(feature = "bindings", derive(TS))]
9203pub struct Version {
9204 pub this: Box<Expression>,
9205 pub kind: String,
9206 #[serde(default)]
9207 pub expression: Option<Box<Expression>>,
9208}
9209
9210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9212#[cfg_attr(feature = "bindings", derive(TS))]
9213pub struct Schema {
9214 #[serde(default)]
9215 pub this: Option<Box<Expression>>,
9216 #[serde(default)]
9217 pub expressions: Vec<Expression>,
9218}
9219
9220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9222#[cfg_attr(feature = "bindings", derive(TS))]
9223pub struct Lock {
9224 #[serde(default)]
9225 pub update: Option<Box<Expression>>,
9226 #[serde(default)]
9227 pub expressions: Vec<Expression>,
9228 #[serde(default)]
9229 pub wait: Option<Box<Expression>>,
9230 #[serde(default)]
9231 pub key: Option<Box<Expression>>,
9232}
9233
9234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9237#[cfg_attr(feature = "bindings", derive(TS))]
9238pub struct TableSample {
9239 #[serde(default, skip_serializing_if = "Option::is_none")]
9241 pub this: Option<Box<Expression>>,
9242 #[serde(default, skip_serializing_if = "Option::is_none")]
9244 pub sample: Option<Box<Sample>>,
9245 #[serde(default)]
9246 pub expressions: Vec<Expression>,
9247 #[serde(default)]
9248 pub method: Option<String>,
9249 #[serde(default)]
9250 pub bucket_numerator: Option<Box<Expression>>,
9251 #[serde(default)]
9252 pub bucket_denominator: Option<Box<Expression>>,
9253 #[serde(default)]
9254 pub bucket_field: Option<Box<Expression>>,
9255 #[serde(default)]
9256 pub percent: Option<Box<Expression>>,
9257 #[serde(default)]
9258 pub rows: Option<Box<Expression>>,
9259 #[serde(default)]
9260 pub size: Option<i64>,
9261 #[serde(default)]
9262 pub seed: Option<Box<Expression>>,
9263}
9264
9265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9267#[cfg_attr(feature = "bindings", derive(TS))]
9268pub struct Tag {
9269 #[serde(default)]
9270 pub this: Option<Box<Expression>>,
9271 #[serde(default)]
9272 pub prefix: Option<Box<Expression>>,
9273 #[serde(default)]
9274 pub postfix: Option<Box<Expression>>,
9275}
9276
9277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9279#[cfg_attr(feature = "bindings", derive(TS))]
9280pub struct UnpivotColumns {
9281 pub this: Box<Expression>,
9282 #[serde(default)]
9283 pub expressions: Vec<Expression>,
9284}
9285
9286#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9288#[cfg_attr(feature = "bindings", derive(TS))]
9289pub struct SessionParameter {
9290 pub this: Box<Expression>,
9291 #[serde(default)]
9292 pub kind: Option<String>,
9293}
9294
9295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9297#[cfg_attr(feature = "bindings", derive(TS))]
9298pub struct PseudoType {
9299 pub this: Box<Expression>,
9300}
9301
9302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9304#[cfg_attr(feature = "bindings", derive(TS))]
9305pub struct ObjectIdentifier {
9306 pub this: Box<Expression>,
9307}
9308
9309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9311#[cfg_attr(feature = "bindings", derive(TS))]
9312pub struct Transaction {
9313 #[serde(default)]
9314 pub this: Option<Box<Expression>>,
9315 #[serde(default)]
9316 pub modes: Option<Box<Expression>>,
9317 #[serde(default)]
9318 pub mark: Option<Box<Expression>>,
9319}
9320
9321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9323#[cfg_attr(feature = "bindings", derive(TS))]
9324pub struct Commit {
9325 #[serde(default)]
9326 pub chain: Option<Box<Expression>>,
9327 #[serde(default)]
9328 pub this: Option<Box<Expression>>,
9329 #[serde(default)]
9330 pub durability: Option<Box<Expression>>,
9331}
9332
9333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9335#[cfg_attr(feature = "bindings", derive(TS))]
9336pub struct Rollback {
9337 #[serde(default)]
9338 pub savepoint: Option<Box<Expression>>,
9339 #[serde(default)]
9340 pub this: Option<Box<Expression>>,
9341}
9342
9343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9345#[cfg_attr(feature = "bindings", derive(TS))]
9346pub struct AlterSession {
9347 #[serde(default)]
9348 pub expressions: Vec<Expression>,
9349 #[serde(default)]
9350 pub unset: Option<Box<Expression>>,
9351}
9352
9353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9355#[cfg_attr(feature = "bindings", derive(TS))]
9356pub struct Analyze {
9357 #[serde(default)]
9358 pub kind: Option<String>,
9359 #[serde(default)]
9360 pub this: Option<Box<Expression>>,
9361 #[serde(default)]
9362 pub options: Vec<Expression>,
9363 #[serde(default)]
9364 pub mode: Option<Box<Expression>>,
9365 #[serde(default)]
9366 pub partition: Option<Box<Expression>>,
9367 #[serde(default)]
9368 pub expression: Option<Box<Expression>>,
9369 #[serde(default)]
9370 pub properties: Vec<Expression>,
9371 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9373 pub columns: Vec<String>,
9374}
9375
9376#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9378#[cfg_attr(feature = "bindings", derive(TS))]
9379pub struct AnalyzeStatistics {
9380 pub kind: String,
9381 #[serde(default)]
9382 pub option: Option<Box<Expression>>,
9383 #[serde(default)]
9384 pub this: Option<Box<Expression>>,
9385 #[serde(default)]
9386 pub expressions: Vec<Expression>,
9387}
9388
9389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9391#[cfg_attr(feature = "bindings", derive(TS))]
9392pub struct AnalyzeHistogram {
9393 pub this: Box<Expression>,
9394 #[serde(default)]
9395 pub expressions: Vec<Expression>,
9396 #[serde(default)]
9397 pub expression: Option<Box<Expression>>,
9398 #[serde(default)]
9399 pub update_options: Option<Box<Expression>>,
9400}
9401
9402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9404#[cfg_attr(feature = "bindings", derive(TS))]
9405pub struct AnalyzeSample {
9406 pub kind: String,
9407 #[serde(default)]
9408 pub sample: Option<Box<Expression>>,
9409}
9410
9411#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9413#[cfg_attr(feature = "bindings", derive(TS))]
9414pub struct AnalyzeListChainedRows {
9415 #[serde(default)]
9416 pub expression: Option<Box<Expression>>,
9417}
9418
9419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9421#[cfg_attr(feature = "bindings", derive(TS))]
9422pub struct AnalyzeDelete {
9423 #[serde(default)]
9424 pub kind: Option<String>,
9425}
9426
9427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9429#[cfg_attr(feature = "bindings", derive(TS))]
9430pub struct AnalyzeWith {
9431 #[serde(default)]
9432 pub expressions: Vec<Expression>,
9433}
9434
9435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9437#[cfg_attr(feature = "bindings", derive(TS))]
9438pub struct AnalyzeValidate {
9439 pub kind: String,
9440 #[serde(default)]
9441 pub this: Option<Box<Expression>>,
9442 #[serde(default)]
9443 pub expression: Option<Box<Expression>>,
9444}
9445
9446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9448#[cfg_attr(feature = "bindings", derive(TS))]
9449pub struct AddPartition {
9450 pub this: Box<Expression>,
9451 #[serde(default)]
9452 pub exists: bool,
9453 #[serde(default)]
9454 pub location: Option<Box<Expression>>,
9455}
9456
9457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9459#[cfg_attr(feature = "bindings", derive(TS))]
9460pub struct AttachOption {
9461 pub this: Box<Expression>,
9462 #[serde(default)]
9463 pub expression: Option<Box<Expression>>,
9464}
9465
9466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9468#[cfg_attr(feature = "bindings", derive(TS))]
9469pub struct DropPartition {
9470 #[serde(default)]
9471 pub expressions: Vec<Expression>,
9472 #[serde(default)]
9473 pub exists: bool,
9474}
9475
9476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9478#[cfg_attr(feature = "bindings", derive(TS))]
9479pub struct ReplacePartition {
9480 pub expression: Box<Expression>,
9481 #[serde(default)]
9482 pub source: Option<Box<Expression>>,
9483}
9484
9485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9487#[cfg_attr(feature = "bindings", derive(TS))]
9488pub struct DPipe {
9489 pub this: Box<Expression>,
9490 pub expression: Box<Expression>,
9491 #[serde(default)]
9492 pub safe: Option<Box<Expression>>,
9493}
9494
9495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9497#[cfg_attr(feature = "bindings", derive(TS))]
9498pub struct Operator {
9499 pub this: Box<Expression>,
9500 #[serde(default)]
9501 pub operator: Option<Box<Expression>>,
9502 pub expression: Box<Expression>,
9503}
9504
9505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9507#[cfg_attr(feature = "bindings", derive(TS))]
9508pub struct PivotAny {
9509 #[serde(default)]
9510 pub this: Option<Box<Expression>>,
9511}
9512
9513#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9515#[cfg_attr(feature = "bindings", derive(TS))]
9516pub struct Aliases {
9517 pub this: Box<Expression>,
9518 #[serde(default)]
9519 pub expressions: Vec<Expression>,
9520}
9521
9522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9524#[cfg_attr(feature = "bindings", derive(TS))]
9525pub struct AtIndex {
9526 pub this: Box<Expression>,
9527 pub expression: Box<Expression>,
9528}
9529
9530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9532#[cfg_attr(feature = "bindings", derive(TS))]
9533pub struct FromTimeZone {
9534 pub this: Box<Expression>,
9535 #[serde(default)]
9536 pub zone: Option<Box<Expression>>,
9537}
9538
9539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9541#[cfg_attr(feature = "bindings", derive(TS))]
9542pub struct FormatPhrase {
9543 pub this: Box<Expression>,
9544 pub format: String,
9545}
9546
9547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9549#[cfg_attr(feature = "bindings", derive(TS))]
9550pub struct ForIn {
9551 pub this: Box<Expression>,
9552 pub expression: Box<Expression>,
9553}
9554
9555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9557#[cfg_attr(feature = "bindings", derive(TS))]
9558pub struct TimeUnit {
9559 #[serde(default)]
9560 pub unit: Option<String>,
9561}
9562
9563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9565#[cfg_attr(feature = "bindings", derive(TS))]
9566pub struct IntervalOp {
9567 #[serde(default)]
9568 pub unit: Option<String>,
9569 pub expression: Box<Expression>,
9570}
9571
9572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9574#[cfg_attr(feature = "bindings", derive(TS))]
9575pub struct HavingMax {
9576 pub this: Box<Expression>,
9577 pub expression: Box<Expression>,
9578 #[serde(default)]
9579 pub max: Option<Box<Expression>>,
9580}
9581
9582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9584#[cfg_attr(feature = "bindings", derive(TS))]
9585pub struct CosineDistance {
9586 pub this: Box<Expression>,
9587 pub expression: Box<Expression>,
9588}
9589
9590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9592#[cfg_attr(feature = "bindings", derive(TS))]
9593pub struct DotProduct {
9594 pub this: Box<Expression>,
9595 pub expression: Box<Expression>,
9596}
9597
9598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9600#[cfg_attr(feature = "bindings", derive(TS))]
9601pub struct EuclideanDistance {
9602 pub this: Box<Expression>,
9603 pub expression: Box<Expression>,
9604}
9605
9606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9608#[cfg_attr(feature = "bindings", derive(TS))]
9609pub struct ManhattanDistance {
9610 pub this: Box<Expression>,
9611 pub expression: Box<Expression>,
9612}
9613
9614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9616#[cfg_attr(feature = "bindings", derive(TS))]
9617pub struct JarowinklerSimilarity {
9618 pub this: Box<Expression>,
9619 pub expression: Box<Expression>,
9620}
9621
9622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9624#[cfg_attr(feature = "bindings", derive(TS))]
9625pub struct Booland {
9626 pub this: Box<Expression>,
9627 pub expression: Box<Expression>,
9628}
9629
9630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9632#[cfg_attr(feature = "bindings", derive(TS))]
9633pub struct Boolor {
9634 pub this: Box<Expression>,
9635 pub expression: Box<Expression>,
9636}
9637
9638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9640#[cfg_attr(feature = "bindings", derive(TS))]
9641pub struct ParameterizedAgg {
9642 pub this: Box<Expression>,
9643 #[serde(default)]
9644 pub expressions: Vec<Expression>,
9645 #[serde(default)]
9646 pub params: Vec<Expression>,
9647}
9648
9649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9651#[cfg_attr(feature = "bindings", derive(TS))]
9652pub struct ArgMax {
9653 pub this: Box<Expression>,
9654 pub expression: Box<Expression>,
9655 #[serde(default)]
9656 pub count: Option<Box<Expression>>,
9657}
9658
9659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9661#[cfg_attr(feature = "bindings", derive(TS))]
9662pub struct ArgMin {
9663 pub this: Box<Expression>,
9664 pub expression: Box<Expression>,
9665 #[serde(default)]
9666 pub count: Option<Box<Expression>>,
9667}
9668
9669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9671#[cfg_attr(feature = "bindings", derive(TS))]
9672pub struct ApproxTopK {
9673 pub this: Box<Expression>,
9674 #[serde(default)]
9675 pub expression: Option<Box<Expression>>,
9676 #[serde(default)]
9677 pub counters: Option<Box<Expression>>,
9678}
9679
9680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9682#[cfg_attr(feature = "bindings", derive(TS))]
9683pub struct ApproxTopKAccumulate {
9684 pub this: Box<Expression>,
9685 #[serde(default)]
9686 pub expression: Option<Box<Expression>>,
9687}
9688
9689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9691#[cfg_attr(feature = "bindings", derive(TS))]
9692pub struct ApproxTopKCombine {
9693 pub this: Box<Expression>,
9694 #[serde(default)]
9695 pub expression: Option<Box<Expression>>,
9696}
9697
9698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9700#[cfg_attr(feature = "bindings", derive(TS))]
9701pub struct ApproxTopKEstimate {
9702 pub this: Box<Expression>,
9703 #[serde(default)]
9704 pub expression: Option<Box<Expression>>,
9705}
9706
9707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9709#[cfg_attr(feature = "bindings", derive(TS))]
9710pub struct ApproxTopSum {
9711 pub this: Box<Expression>,
9712 pub expression: Box<Expression>,
9713 #[serde(default)]
9714 pub count: Option<Box<Expression>>,
9715}
9716
9717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9719#[cfg_attr(feature = "bindings", derive(TS))]
9720pub struct ApproxQuantiles {
9721 pub this: Box<Expression>,
9722 #[serde(default)]
9723 pub expression: Option<Box<Expression>>,
9724}
9725
9726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9728#[cfg_attr(feature = "bindings", derive(TS))]
9729pub struct Minhash {
9730 pub this: Box<Expression>,
9731 #[serde(default)]
9732 pub expressions: Vec<Expression>,
9733}
9734
9735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9737#[cfg_attr(feature = "bindings", derive(TS))]
9738pub struct FarmFingerprint {
9739 #[serde(default)]
9740 pub expressions: Vec<Expression>,
9741}
9742
9743#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9745#[cfg_attr(feature = "bindings", derive(TS))]
9746pub struct Float64 {
9747 pub this: Box<Expression>,
9748 #[serde(default)]
9749 pub expression: Option<Box<Expression>>,
9750}
9751
9752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9754#[cfg_attr(feature = "bindings", derive(TS))]
9755pub struct Transform {
9756 pub this: Box<Expression>,
9757 pub expression: Box<Expression>,
9758}
9759
9760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9762#[cfg_attr(feature = "bindings", derive(TS))]
9763pub struct Translate {
9764 pub this: Box<Expression>,
9765 #[serde(default)]
9766 pub from_: Option<Box<Expression>>,
9767 #[serde(default)]
9768 pub to: Option<Box<Expression>>,
9769}
9770
9771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9773#[cfg_attr(feature = "bindings", derive(TS))]
9774pub struct Grouping {
9775 #[serde(default)]
9776 pub expressions: Vec<Expression>,
9777}
9778
9779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9781#[cfg_attr(feature = "bindings", derive(TS))]
9782pub struct GroupingId {
9783 #[serde(default)]
9784 pub expressions: Vec<Expression>,
9785}
9786
9787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9789#[cfg_attr(feature = "bindings", derive(TS))]
9790pub struct Anonymous {
9791 pub this: Box<Expression>,
9792 #[serde(default)]
9793 pub expressions: Vec<Expression>,
9794}
9795
9796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9798#[cfg_attr(feature = "bindings", derive(TS))]
9799pub struct AnonymousAggFunc {
9800 pub this: Box<Expression>,
9801 #[serde(default)]
9802 pub expressions: Vec<Expression>,
9803}
9804
9805#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9807#[cfg_attr(feature = "bindings", derive(TS))]
9808pub struct CombinedAggFunc {
9809 pub this: Box<Expression>,
9810 #[serde(default)]
9811 pub expressions: Vec<Expression>,
9812}
9813
9814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9816#[cfg_attr(feature = "bindings", derive(TS))]
9817pub struct CombinedParameterizedAgg {
9818 pub this: Box<Expression>,
9819 #[serde(default)]
9820 pub expressions: Vec<Expression>,
9821 #[serde(default)]
9822 pub params: Vec<Expression>,
9823}
9824
9825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9827#[cfg_attr(feature = "bindings", derive(TS))]
9828pub struct HashAgg {
9829 pub this: Box<Expression>,
9830 #[serde(default)]
9831 pub expressions: Vec<Expression>,
9832}
9833
9834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9836#[cfg_attr(feature = "bindings", derive(TS))]
9837pub struct Hll {
9838 pub this: Box<Expression>,
9839 #[serde(default)]
9840 pub expressions: Vec<Expression>,
9841}
9842
9843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9845#[cfg_attr(feature = "bindings", derive(TS))]
9846pub struct Apply {
9847 pub this: Box<Expression>,
9848 pub expression: Box<Expression>,
9849}
9850
9851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9853#[cfg_attr(feature = "bindings", derive(TS))]
9854pub struct ToBoolean {
9855 pub this: Box<Expression>,
9856 #[serde(default)]
9857 pub safe: Option<Box<Expression>>,
9858}
9859
9860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9862#[cfg_attr(feature = "bindings", derive(TS))]
9863pub struct List {
9864 #[serde(default)]
9865 pub expressions: Vec<Expression>,
9866}
9867
9868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9873#[cfg_attr(feature = "bindings", derive(TS))]
9874pub struct ToMap {
9875 pub this: Box<Expression>,
9877}
9878
9879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9881#[cfg_attr(feature = "bindings", derive(TS))]
9882pub struct Pad {
9883 pub this: Box<Expression>,
9884 pub expression: Box<Expression>,
9885 #[serde(default)]
9886 pub fill_pattern: Option<Box<Expression>>,
9887 #[serde(default)]
9888 pub is_left: Option<Box<Expression>>,
9889}
9890
9891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9893#[cfg_attr(feature = "bindings", derive(TS))]
9894pub struct ToChar {
9895 pub this: Box<Expression>,
9896 #[serde(default)]
9897 pub format: Option<String>,
9898 #[serde(default)]
9899 pub nlsparam: Option<Box<Expression>>,
9900 #[serde(default)]
9901 pub is_numeric: Option<Box<Expression>>,
9902}
9903
9904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9906#[cfg_attr(feature = "bindings", derive(TS))]
9907pub struct StringFunc {
9908 pub this: Box<Expression>,
9909 #[serde(default)]
9910 pub zone: Option<Box<Expression>>,
9911}
9912
9913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9915#[cfg_attr(feature = "bindings", derive(TS))]
9916pub struct ToNumber {
9917 pub this: Box<Expression>,
9918 #[serde(default)]
9919 pub format: Option<Box<Expression>>,
9920 #[serde(default)]
9921 pub nlsparam: Option<Box<Expression>>,
9922 #[serde(default)]
9923 pub precision: Option<Box<Expression>>,
9924 #[serde(default)]
9925 pub scale: Option<Box<Expression>>,
9926 #[serde(default)]
9927 pub safe: Option<Box<Expression>>,
9928 #[serde(default)]
9929 pub safe_name: Option<Box<Expression>>,
9930}
9931
9932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9934#[cfg_attr(feature = "bindings", derive(TS))]
9935pub struct ToDouble {
9936 pub this: Box<Expression>,
9937 #[serde(default)]
9938 pub format: Option<String>,
9939 #[serde(default)]
9940 pub safe: Option<Box<Expression>>,
9941}
9942
9943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9945#[cfg_attr(feature = "bindings", derive(TS))]
9946pub struct ToDecfloat {
9947 pub this: Box<Expression>,
9948 #[serde(default)]
9949 pub format: Option<String>,
9950}
9951
9952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9954#[cfg_attr(feature = "bindings", derive(TS))]
9955pub struct TryToDecfloat {
9956 pub this: Box<Expression>,
9957 #[serde(default)]
9958 pub format: Option<String>,
9959}
9960
9961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9963#[cfg_attr(feature = "bindings", derive(TS))]
9964pub struct ToFile {
9965 pub this: Box<Expression>,
9966 #[serde(default)]
9967 pub path: Option<Box<Expression>>,
9968 #[serde(default)]
9969 pub safe: Option<Box<Expression>>,
9970}
9971
9972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9974#[cfg_attr(feature = "bindings", derive(TS))]
9975pub struct Columns {
9976 pub this: Box<Expression>,
9977 #[serde(default)]
9978 pub unpack: Option<Box<Expression>>,
9979}
9980
9981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9983#[cfg_attr(feature = "bindings", derive(TS))]
9984pub struct ConvertToCharset {
9985 pub this: Box<Expression>,
9986 #[serde(default)]
9987 pub dest: Option<Box<Expression>>,
9988 #[serde(default)]
9989 pub source: Option<Box<Expression>>,
9990}
9991
9992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9994#[cfg_attr(feature = "bindings", derive(TS))]
9995pub struct ConvertTimezone {
9996 #[serde(default)]
9997 pub source_tz: Option<Box<Expression>>,
9998 #[serde(default)]
9999 pub target_tz: Option<Box<Expression>>,
10000 #[serde(default)]
10001 pub timestamp: Option<Box<Expression>>,
10002 #[serde(default)]
10003 pub options: Vec<Expression>,
10004}
10005
10006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10008#[cfg_attr(feature = "bindings", derive(TS))]
10009pub struct GenerateSeries {
10010 #[serde(default)]
10011 pub start: Option<Box<Expression>>,
10012 #[serde(default)]
10013 pub end: Option<Box<Expression>>,
10014 #[serde(default)]
10015 pub step: Option<Box<Expression>>,
10016 #[serde(default)]
10017 pub is_end_exclusive: Option<Box<Expression>>,
10018}
10019
10020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10022#[cfg_attr(feature = "bindings", derive(TS))]
10023pub struct AIAgg {
10024 pub this: Box<Expression>,
10025 pub expression: Box<Expression>,
10026}
10027
10028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10030#[cfg_attr(feature = "bindings", derive(TS))]
10031pub struct AIClassify {
10032 pub this: Box<Expression>,
10033 #[serde(default)]
10034 pub categories: Option<Box<Expression>>,
10035 #[serde(default)]
10036 pub config: Option<Box<Expression>>,
10037}
10038
10039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10041#[cfg_attr(feature = "bindings", derive(TS))]
10042pub struct ArrayAll {
10043 pub this: Box<Expression>,
10044 pub expression: Box<Expression>,
10045}
10046
10047#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10049#[cfg_attr(feature = "bindings", derive(TS))]
10050pub struct ArrayAny {
10051 pub this: Box<Expression>,
10052 pub expression: Box<Expression>,
10053}
10054
10055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10057#[cfg_attr(feature = "bindings", derive(TS))]
10058pub struct ArrayConstructCompact {
10059 #[serde(default)]
10060 pub expressions: Vec<Expression>,
10061}
10062
10063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10065#[cfg_attr(feature = "bindings", derive(TS))]
10066pub struct StPoint {
10067 pub this: Box<Expression>,
10068 pub expression: Box<Expression>,
10069 #[serde(default)]
10070 pub null: Option<Box<Expression>>,
10071}
10072
10073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10075#[cfg_attr(feature = "bindings", derive(TS))]
10076pub struct StDistance {
10077 pub this: Box<Expression>,
10078 pub expression: Box<Expression>,
10079 #[serde(default)]
10080 pub use_spheroid: Option<Box<Expression>>,
10081}
10082
10083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10085#[cfg_attr(feature = "bindings", derive(TS))]
10086pub struct StringToArray {
10087 pub this: Box<Expression>,
10088 #[serde(default)]
10089 pub expression: Option<Box<Expression>>,
10090 #[serde(default)]
10091 pub null: Option<Box<Expression>>,
10092}
10093
10094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10096#[cfg_attr(feature = "bindings", derive(TS))]
10097pub struct ArraySum {
10098 pub this: Box<Expression>,
10099 #[serde(default)]
10100 pub expression: Option<Box<Expression>>,
10101}
10102
10103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10105#[cfg_attr(feature = "bindings", derive(TS))]
10106pub struct ObjectAgg {
10107 pub this: Box<Expression>,
10108 pub expression: Box<Expression>,
10109}
10110
10111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10113#[cfg_attr(feature = "bindings", derive(TS))]
10114pub struct CastToStrType {
10115 pub this: Box<Expression>,
10116 #[serde(default)]
10117 pub to: Option<Box<Expression>>,
10118}
10119
10120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10122#[cfg_attr(feature = "bindings", derive(TS))]
10123pub struct CheckJson {
10124 pub this: Box<Expression>,
10125}
10126
10127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10129#[cfg_attr(feature = "bindings", derive(TS))]
10130pub struct CheckXml {
10131 pub this: Box<Expression>,
10132 #[serde(default)]
10133 pub disable_auto_convert: Option<Box<Expression>>,
10134}
10135
10136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10138#[cfg_attr(feature = "bindings", derive(TS))]
10139pub struct TranslateCharacters {
10140 pub this: Box<Expression>,
10141 pub expression: Box<Expression>,
10142 #[serde(default)]
10143 pub with_error: Option<Box<Expression>>,
10144}
10145
10146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10148#[cfg_attr(feature = "bindings", derive(TS))]
10149pub struct CurrentSchemas {
10150 #[serde(default)]
10151 pub this: Option<Box<Expression>>,
10152}
10153
10154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10156#[cfg_attr(feature = "bindings", derive(TS))]
10157pub struct CurrentDatetime {
10158 #[serde(default)]
10159 pub this: Option<Box<Expression>>,
10160}
10161
10162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10164#[cfg_attr(feature = "bindings", derive(TS))]
10165pub struct Localtime {
10166 #[serde(default)]
10167 pub this: Option<Box<Expression>>,
10168}
10169
10170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10172#[cfg_attr(feature = "bindings", derive(TS))]
10173pub struct Localtimestamp {
10174 #[serde(default)]
10175 pub this: Option<Box<Expression>>,
10176}
10177
10178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10180#[cfg_attr(feature = "bindings", derive(TS))]
10181pub struct Systimestamp {
10182 #[serde(default)]
10183 pub this: Option<Box<Expression>>,
10184}
10185
10186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10188#[cfg_attr(feature = "bindings", derive(TS))]
10189pub struct CurrentSchema {
10190 #[serde(default)]
10191 pub this: Option<Box<Expression>>,
10192}
10193
10194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10196#[cfg_attr(feature = "bindings", derive(TS))]
10197pub struct CurrentUser {
10198 #[serde(default)]
10199 pub this: Option<Box<Expression>>,
10200}
10201
10202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10204#[cfg_attr(feature = "bindings", derive(TS))]
10205pub struct SessionUser;
10206
10207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10209#[cfg_attr(feature = "bindings", derive(TS))]
10210pub struct JSONPathRoot;
10211
10212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10214#[cfg_attr(feature = "bindings", derive(TS))]
10215pub struct UtcTime {
10216 #[serde(default)]
10217 pub this: Option<Box<Expression>>,
10218}
10219
10220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10222#[cfg_attr(feature = "bindings", derive(TS))]
10223pub struct UtcTimestamp {
10224 #[serde(default)]
10225 pub this: Option<Box<Expression>>,
10226}
10227
10228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10230#[cfg_attr(feature = "bindings", derive(TS))]
10231pub struct TimestampFunc {
10232 #[serde(default)]
10233 pub this: Option<Box<Expression>>,
10234 #[serde(default)]
10235 pub zone: Option<Box<Expression>>,
10236 #[serde(default)]
10237 pub with_tz: Option<bool>,
10238 #[serde(default)]
10239 pub safe: Option<bool>,
10240}
10241
10242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10244#[cfg_attr(feature = "bindings", derive(TS))]
10245pub struct DateBin {
10246 pub this: Box<Expression>,
10247 pub expression: Box<Expression>,
10248 #[serde(default)]
10249 pub unit: Option<String>,
10250 #[serde(default)]
10251 pub zone: Option<Box<Expression>>,
10252 #[serde(default)]
10253 pub origin: Option<Box<Expression>>,
10254}
10255
10256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10258#[cfg_attr(feature = "bindings", derive(TS))]
10259pub struct Datetime {
10260 pub this: Box<Expression>,
10261 #[serde(default)]
10262 pub expression: Option<Box<Expression>>,
10263}
10264
10265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10267#[cfg_attr(feature = "bindings", derive(TS))]
10268pub struct DatetimeAdd {
10269 pub this: Box<Expression>,
10270 pub expression: Box<Expression>,
10271 #[serde(default)]
10272 pub unit: Option<String>,
10273}
10274
10275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10277#[cfg_attr(feature = "bindings", derive(TS))]
10278pub struct DatetimeSub {
10279 pub this: Box<Expression>,
10280 pub expression: Box<Expression>,
10281 #[serde(default)]
10282 pub unit: Option<String>,
10283}
10284
10285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10287#[cfg_attr(feature = "bindings", derive(TS))]
10288pub struct DatetimeDiff {
10289 pub this: Box<Expression>,
10290 pub expression: Box<Expression>,
10291 #[serde(default)]
10292 pub unit: Option<String>,
10293}
10294
10295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10297#[cfg_attr(feature = "bindings", derive(TS))]
10298pub struct DatetimeTrunc {
10299 pub this: Box<Expression>,
10300 pub unit: String,
10301 #[serde(default)]
10302 pub zone: Option<Box<Expression>>,
10303}
10304
10305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10307#[cfg_attr(feature = "bindings", derive(TS))]
10308pub struct Dayname {
10309 pub this: Box<Expression>,
10310 #[serde(default)]
10311 pub abbreviated: Option<Box<Expression>>,
10312}
10313
10314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10316#[cfg_attr(feature = "bindings", derive(TS))]
10317pub struct MakeInterval {
10318 #[serde(default)]
10319 pub year: Option<Box<Expression>>,
10320 #[serde(default)]
10321 pub month: Option<Box<Expression>>,
10322 #[serde(default)]
10323 pub week: Option<Box<Expression>>,
10324 #[serde(default)]
10325 pub day: Option<Box<Expression>>,
10326 #[serde(default)]
10327 pub hour: Option<Box<Expression>>,
10328 #[serde(default)]
10329 pub minute: Option<Box<Expression>>,
10330 #[serde(default)]
10331 pub second: Option<Box<Expression>>,
10332}
10333
10334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10336#[cfg_attr(feature = "bindings", derive(TS))]
10337pub struct PreviousDay {
10338 pub this: Box<Expression>,
10339 pub expression: Box<Expression>,
10340}
10341
10342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10344#[cfg_attr(feature = "bindings", derive(TS))]
10345pub struct Elt {
10346 pub this: Box<Expression>,
10347 #[serde(default)]
10348 pub expressions: Vec<Expression>,
10349}
10350
10351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10353#[cfg_attr(feature = "bindings", derive(TS))]
10354pub struct TimestampAdd {
10355 pub this: Box<Expression>,
10356 pub expression: Box<Expression>,
10357 #[serde(default)]
10358 pub unit: Option<String>,
10359}
10360
10361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10363#[cfg_attr(feature = "bindings", derive(TS))]
10364pub struct TimestampSub {
10365 pub this: Box<Expression>,
10366 pub expression: Box<Expression>,
10367 #[serde(default)]
10368 pub unit: Option<String>,
10369}
10370
10371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10373#[cfg_attr(feature = "bindings", derive(TS))]
10374pub struct TimestampDiff {
10375 pub this: Box<Expression>,
10376 pub expression: Box<Expression>,
10377 #[serde(default)]
10378 pub unit: Option<String>,
10379}
10380
10381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10383#[cfg_attr(feature = "bindings", derive(TS))]
10384pub struct TimeSlice {
10385 pub this: Box<Expression>,
10386 pub expression: Box<Expression>,
10387 pub unit: String,
10388 #[serde(default)]
10389 pub kind: Option<String>,
10390}
10391
10392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10394#[cfg_attr(feature = "bindings", derive(TS))]
10395pub struct TimeAdd {
10396 pub this: Box<Expression>,
10397 pub expression: Box<Expression>,
10398 #[serde(default)]
10399 pub unit: Option<String>,
10400}
10401
10402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10404#[cfg_attr(feature = "bindings", derive(TS))]
10405pub struct TimeSub {
10406 pub this: Box<Expression>,
10407 pub expression: Box<Expression>,
10408 #[serde(default)]
10409 pub unit: Option<String>,
10410}
10411
10412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10414#[cfg_attr(feature = "bindings", derive(TS))]
10415pub struct TimeDiff {
10416 pub this: Box<Expression>,
10417 pub expression: Box<Expression>,
10418 #[serde(default)]
10419 pub unit: Option<String>,
10420}
10421
10422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10424#[cfg_attr(feature = "bindings", derive(TS))]
10425pub struct TimeTrunc {
10426 pub this: Box<Expression>,
10427 pub unit: String,
10428 #[serde(default)]
10429 pub zone: Option<Box<Expression>>,
10430}
10431
10432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10434#[cfg_attr(feature = "bindings", derive(TS))]
10435pub struct DateFromParts {
10436 #[serde(default)]
10437 pub year: Option<Box<Expression>>,
10438 #[serde(default)]
10439 pub month: Option<Box<Expression>>,
10440 #[serde(default)]
10441 pub day: Option<Box<Expression>>,
10442 #[serde(default)]
10443 pub allow_overflow: Option<Box<Expression>>,
10444}
10445
10446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10448#[cfg_attr(feature = "bindings", derive(TS))]
10449pub struct TimeFromParts {
10450 #[serde(default)]
10451 pub hour: Option<Box<Expression>>,
10452 #[serde(default)]
10453 pub min: Option<Box<Expression>>,
10454 #[serde(default)]
10455 pub sec: Option<Box<Expression>>,
10456 #[serde(default)]
10457 pub nano: Option<Box<Expression>>,
10458 #[serde(default)]
10459 pub fractions: Option<Box<Expression>>,
10460 #[serde(default)]
10461 pub precision: Option<i64>,
10462}
10463
10464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10466#[cfg_attr(feature = "bindings", derive(TS))]
10467pub struct DecodeCase {
10468 #[serde(default)]
10469 pub expressions: Vec<Expression>,
10470}
10471
10472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10474#[cfg_attr(feature = "bindings", derive(TS))]
10475pub struct Decrypt {
10476 pub this: Box<Expression>,
10477 #[serde(default)]
10478 pub passphrase: Option<Box<Expression>>,
10479 #[serde(default)]
10480 pub aad: Option<Box<Expression>>,
10481 #[serde(default)]
10482 pub encryption_method: Option<Box<Expression>>,
10483 #[serde(default)]
10484 pub safe: Option<Box<Expression>>,
10485}
10486
10487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10489#[cfg_attr(feature = "bindings", derive(TS))]
10490pub struct DecryptRaw {
10491 pub this: Box<Expression>,
10492 #[serde(default)]
10493 pub key: Option<Box<Expression>>,
10494 #[serde(default)]
10495 pub iv: Option<Box<Expression>>,
10496 #[serde(default)]
10497 pub aad: Option<Box<Expression>>,
10498 #[serde(default)]
10499 pub encryption_method: Option<Box<Expression>>,
10500 #[serde(default)]
10501 pub aead: Option<Box<Expression>>,
10502 #[serde(default)]
10503 pub safe: Option<Box<Expression>>,
10504}
10505
10506#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10508#[cfg_attr(feature = "bindings", derive(TS))]
10509pub struct Encode {
10510 pub this: Box<Expression>,
10511 #[serde(default)]
10512 pub charset: Option<Box<Expression>>,
10513}
10514
10515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10517#[cfg_attr(feature = "bindings", derive(TS))]
10518pub struct Encrypt {
10519 pub this: Box<Expression>,
10520 #[serde(default)]
10521 pub passphrase: Option<Box<Expression>>,
10522 #[serde(default)]
10523 pub aad: Option<Box<Expression>>,
10524 #[serde(default)]
10525 pub encryption_method: Option<Box<Expression>>,
10526}
10527
10528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10530#[cfg_attr(feature = "bindings", derive(TS))]
10531pub struct EncryptRaw {
10532 pub this: Box<Expression>,
10533 #[serde(default)]
10534 pub key: Option<Box<Expression>>,
10535 #[serde(default)]
10536 pub iv: Option<Box<Expression>>,
10537 #[serde(default)]
10538 pub aad: Option<Box<Expression>>,
10539 #[serde(default)]
10540 pub encryption_method: Option<Box<Expression>>,
10541}
10542
10543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10545#[cfg_attr(feature = "bindings", derive(TS))]
10546pub struct EqualNull {
10547 pub this: Box<Expression>,
10548 pub expression: Box<Expression>,
10549}
10550
10551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10553#[cfg_attr(feature = "bindings", derive(TS))]
10554pub struct ToBinary {
10555 pub this: Box<Expression>,
10556 #[serde(default)]
10557 pub format: Option<String>,
10558 #[serde(default)]
10559 pub safe: Option<Box<Expression>>,
10560}
10561
10562#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10564#[cfg_attr(feature = "bindings", derive(TS))]
10565pub struct Base64DecodeBinary {
10566 pub this: Box<Expression>,
10567 #[serde(default)]
10568 pub alphabet: Option<Box<Expression>>,
10569}
10570
10571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10573#[cfg_attr(feature = "bindings", derive(TS))]
10574pub struct Base64DecodeString {
10575 pub this: Box<Expression>,
10576 #[serde(default)]
10577 pub alphabet: Option<Box<Expression>>,
10578}
10579
10580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10582#[cfg_attr(feature = "bindings", derive(TS))]
10583pub struct Base64Encode {
10584 pub this: Box<Expression>,
10585 #[serde(default)]
10586 pub max_line_length: Option<Box<Expression>>,
10587 #[serde(default)]
10588 pub alphabet: Option<Box<Expression>>,
10589}
10590
10591#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10593#[cfg_attr(feature = "bindings", derive(TS))]
10594pub struct TryBase64DecodeBinary {
10595 pub this: Box<Expression>,
10596 #[serde(default)]
10597 pub alphabet: Option<Box<Expression>>,
10598}
10599
10600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10602#[cfg_attr(feature = "bindings", derive(TS))]
10603pub struct TryBase64DecodeString {
10604 pub this: Box<Expression>,
10605 #[serde(default)]
10606 pub alphabet: Option<Box<Expression>>,
10607}
10608
10609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10611#[cfg_attr(feature = "bindings", derive(TS))]
10612pub struct GapFill {
10613 pub this: Box<Expression>,
10614 #[serde(default)]
10615 pub ts_column: Option<Box<Expression>>,
10616 #[serde(default)]
10617 pub bucket_width: Option<Box<Expression>>,
10618 #[serde(default)]
10619 pub partitioning_columns: Option<Box<Expression>>,
10620 #[serde(default)]
10621 pub value_columns: Option<Box<Expression>>,
10622 #[serde(default)]
10623 pub origin: Option<Box<Expression>>,
10624 #[serde(default)]
10625 pub ignore_nulls: Option<Box<Expression>>,
10626}
10627
10628#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10630#[cfg_attr(feature = "bindings", derive(TS))]
10631pub struct GenerateDateArray {
10632 #[serde(default)]
10633 pub start: Option<Box<Expression>>,
10634 #[serde(default)]
10635 pub end: Option<Box<Expression>>,
10636 #[serde(default)]
10637 pub step: Option<Box<Expression>>,
10638}
10639
10640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10642#[cfg_attr(feature = "bindings", derive(TS))]
10643pub struct GenerateTimestampArray {
10644 #[serde(default)]
10645 pub start: Option<Box<Expression>>,
10646 #[serde(default)]
10647 pub end: Option<Box<Expression>>,
10648 #[serde(default)]
10649 pub step: Option<Box<Expression>>,
10650}
10651
10652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10654#[cfg_attr(feature = "bindings", derive(TS))]
10655pub struct GetExtract {
10656 pub this: Box<Expression>,
10657 pub expression: Box<Expression>,
10658}
10659
10660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10662#[cfg_attr(feature = "bindings", derive(TS))]
10663pub struct Getbit {
10664 pub this: Box<Expression>,
10665 pub expression: Box<Expression>,
10666 #[serde(default)]
10667 pub zero_is_msb: Option<Box<Expression>>,
10668}
10669
10670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10672#[cfg_attr(feature = "bindings", derive(TS))]
10673pub struct OverflowTruncateBehavior {
10674 #[serde(default)]
10675 pub this: Option<Box<Expression>>,
10676 #[serde(default)]
10677 pub with_count: Option<Box<Expression>>,
10678}
10679
10680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10682#[cfg_attr(feature = "bindings", derive(TS))]
10683pub struct HexEncode {
10684 pub this: Box<Expression>,
10685 #[serde(default)]
10686 pub case: Option<Box<Expression>>,
10687}
10688
10689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10691#[cfg_attr(feature = "bindings", derive(TS))]
10692pub struct Compress {
10693 pub this: Box<Expression>,
10694 #[serde(default)]
10695 pub method: Option<String>,
10696}
10697
10698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10700#[cfg_attr(feature = "bindings", derive(TS))]
10701pub struct DecompressBinary {
10702 pub this: Box<Expression>,
10703 pub method: String,
10704}
10705
10706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10708#[cfg_attr(feature = "bindings", derive(TS))]
10709pub struct DecompressString {
10710 pub this: Box<Expression>,
10711 pub method: String,
10712}
10713
10714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10716#[cfg_attr(feature = "bindings", derive(TS))]
10717pub struct Xor {
10718 #[serde(default)]
10719 pub this: Option<Box<Expression>>,
10720 #[serde(default)]
10721 pub expression: Option<Box<Expression>>,
10722 #[serde(default)]
10723 pub expressions: Vec<Expression>,
10724}
10725
10726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10728#[cfg_attr(feature = "bindings", derive(TS))]
10729pub struct Nullif {
10730 pub this: Box<Expression>,
10731 pub expression: Box<Expression>,
10732}
10733
10734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10736#[cfg_attr(feature = "bindings", derive(TS))]
10737pub struct JSON {
10738 #[serde(default)]
10739 pub this: Option<Box<Expression>>,
10740 #[serde(default)]
10741 pub with_: Option<Box<Expression>>,
10742 #[serde(default)]
10743 pub unique: bool,
10744}
10745
10746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10748#[cfg_attr(feature = "bindings", derive(TS))]
10749pub struct JSONPath {
10750 #[serde(default)]
10751 pub expressions: Vec<Expression>,
10752 #[serde(default)]
10753 pub escape: Option<Box<Expression>>,
10754}
10755
10756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10758#[cfg_attr(feature = "bindings", derive(TS))]
10759pub struct JSONPathFilter {
10760 pub this: Box<Expression>,
10761}
10762
10763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10765#[cfg_attr(feature = "bindings", derive(TS))]
10766pub struct JSONPathKey {
10767 pub this: Box<Expression>,
10768}
10769
10770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10772#[cfg_attr(feature = "bindings", derive(TS))]
10773pub struct JSONPathRecursive {
10774 #[serde(default)]
10775 pub this: Option<Box<Expression>>,
10776}
10777
10778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10780#[cfg_attr(feature = "bindings", derive(TS))]
10781pub struct JSONPathScript {
10782 pub this: Box<Expression>,
10783}
10784
10785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10787#[cfg_attr(feature = "bindings", derive(TS))]
10788pub struct JSONPathSlice {
10789 #[serde(default)]
10790 pub start: Option<Box<Expression>>,
10791 #[serde(default)]
10792 pub end: Option<Box<Expression>>,
10793 #[serde(default)]
10794 pub step: Option<Box<Expression>>,
10795}
10796
10797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10799#[cfg_attr(feature = "bindings", derive(TS))]
10800pub struct JSONPathSelector {
10801 pub this: Box<Expression>,
10802}
10803
10804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10806#[cfg_attr(feature = "bindings", derive(TS))]
10807pub struct JSONPathSubscript {
10808 pub this: Box<Expression>,
10809}
10810
10811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10813#[cfg_attr(feature = "bindings", derive(TS))]
10814pub struct JSONPathUnion {
10815 #[serde(default)]
10816 pub expressions: Vec<Expression>,
10817}
10818
10819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10821#[cfg_attr(feature = "bindings", derive(TS))]
10822pub struct Format {
10823 pub this: Box<Expression>,
10824 #[serde(default)]
10825 pub expressions: Vec<Expression>,
10826}
10827
10828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10830#[cfg_attr(feature = "bindings", derive(TS))]
10831pub struct JSONKeys {
10832 pub this: Box<Expression>,
10833 #[serde(default)]
10834 pub expression: Option<Box<Expression>>,
10835 #[serde(default)]
10836 pub expressions: Vec<Expression>,
10837}
10838
10839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10841#[cfg_attr(feature = "bindings", derive(TS))]
10842pub struct JSONKeyValue {
10843 pub this: Box<Expression>,
10844 pub expression: Box<Expression>,
10845}
10846
10847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10849#[cfg_attr(feature = "bindings", derive(TS))]
10850pub struct JSONKeysAtDepth {
10851 pub this: Box<Expression>,
10852 #[serde(default)]
10853 pub expression: Option<Box<Expression>>,
10854 #[serde(default)]
10855 pub mode: Option<Box<Expression>>,
10856}
10857
10858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10860#[cfg_attr(feature = "bindings", derive(TS))]
10861pub struct JSONObject {
10862 #[serde(default)]
10863 pub expressions: Vec<Expression>,
10864 #[serde(default)]
10865 pub null_handling: Option<Box<Expression>>,
10866 #[serde(default)]
10867 pub unique_keys: Option<Box<Expression>>,
10868 #[serde(default)]
10869 pub return_type: Option<Box<Expression>>,
10870 #[serde(default)]
10871 pub encoding: Option<Box<Expression>>,
10872}
10873
10874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10876#[cfg_attr(feature = "bindings", derive(TS))]
10877pub struct JSONObjectAgg {
10878 #[serde(default)]
10879 pub expressions: Vec<Expression>,
10880 #[serde(default)]
10881 pub null_handling: Option<Box<Expression>>,
10882 #[serde(default)]
10883 pub unique_keys: Option<Box<Expression>>,
10884 #[serde(default)]
10885 pub return_type: Option<Box<Expression>>,
10886 #[serde(default)]
10887 pub encoding: Option<Box<Expression>>,
10888}
10889
10890#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10892#[cfg_attr(feature = "bindings", derive(TS))]
10893pub struct JSONBObjectAgg {
10894 pub this: Box<Expression>,
10895 pub expression: Box<Expression>,
10896}
10897
10898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10900#[cfg_attr(feature = "bindings", derive(TS))]
10901pub struct JSONArray {
10902 #[serde(default)]
10903 pub expressions: Vec<Expression>,
10904 #[serde(default)]
10905 pub null_handling: Option<Box<Expression>>,
10906 #[serde(default)]
10907 pub return_type: Option<Box<Expression>>,
10908 #[serde(default)]
10909 pub strict: Option<Box<Expression>>,
10910}
10911
10912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10914#[cfg_attr(feature = "bindings", derive(TS))]
10915pub struct JSONArrayAgg {
10916 pub this: Box<Expression>,
10917 #[serde(default)]
10918 pub order: Option<Box<Expression>>,
10919 #[serde(default)]
10920 pub null_handling: Option<Box<Expression>>,
10921 #[serde(default)]
10922 pub return_type: Option<Box<Expression>>,
10923 #[serde(default)]
10924 pub strict: Option<Box<Expression>>,
10925}
10926
10927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10929#[cfg_attr(feature = "bindings", derive(TS))]
10930pub struct JSONExists {
10931 pub this: Box<Expression>,
10932 #[serde(default)]
10933 pub path: Option<Box<Expression>>,
10934 #[serde(default)]
10935 pub passing: Option<Box<Expression>>,
10936 #[serde(default)]
10937 pub on_condition: Option<Box<Expression>>,
10938 #[serde(default)]
10939 pub from_dcolonqmark: Option<Box<Expression>>,
10940}
10941
10942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10944#[cfg_attr(feature = "bindings", derive(TS))]
10945pub struct JSONColumnDef {
10946 #[serde(default)]
10947 pub this: Option<Box<Expression>>,
10948 #[serde(default)]
10949 pub kind: Option<String>,
10950 #[serde(default)]
10951 pub path: Option<Box<Expression>>,
10952 #[serde(default)]
10953 pub nested_schema: Option<Box<Expression>>,
10954 #[serde(default)]
10955 pub ordinality: Option<Box<Expression>>,
10956}
10957
10958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10960#[cfg_attr(feature = "bindings", derive(TS))]
10961pub struct JSONSchema {
10962 #[serde(default)]
10963 pub expressions: Vec<Expression>,
10964}
10965
10966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10968#[cfg_attr(feature = "bindings", derive(TS))]
10969pub struct JSONSet {
10970 pub this: Box<Expression>,
10971 #[serde(default)]
10972 pub expressions: Vec<Expression>,
10973}
10974
10975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10977#[cfg_attr(feature = "bindings", derive(TS))]
10978pub struct JSONStripNulls {
10979 pub this: Box<Expression>,
10980 #[serde(default)]
10981 pub expression: Option<Box<Expression>>,
10982 #[serde(default)]
10983 pub include_arrays: Option<Box<Expression>>,
10984 #[serde(default)]
10985 pub remove_empty: Option<Box<Expression>>,
10986}
10987
10988#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10990#[cfg_attr(feature = "bindings", derive(TS))]
10991pub struct JSONValue {
10992 pub this: Box<Expression>,
10993 #[serde(default)]
10994 pub path: Option<Box<Expression>>,
10995 #[serde(default)]
10996 pub returning: Option<Box<Expression>>,
10997 #[serde(default)]
10998 pub on_condition: Option<Box<Expression>>,
10999}
11000
11001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11003#[cfg_attr(feature = "bindings", derive(TS))]
11004pub struct JSONValueArray {
11005 pub this: Box<Expression>,
11006 #[serde(default)]
11007 pub expression: Option<Box<Expression>>,
11008}
11009
11010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11012#[cfg_attr(feature = "bindings", derive(TS))]
11013pub struct JSONRemove {
11014 pub this: Box<Expression>,
11015 #[serde(default)]
11016 pub expressions: Vec<Expression>,
11017}
11018
11019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11021#[cfg_attr(feature = "bindings", derive(TS))]
11022pub struct JSONTable {
11023 pub this: Box<Expression>,
11024 #[serde(default)]
11025 pub schema: Option<Box<Expression>>,
11026 #[serde(default)]
11027 pub path: Option<Box<Expression>>,
11028 #[serde(default)]
11029 pub error_handling: Option<Box<Expression>>,
11030 #[serde(default)]
11031 pub empty_handling: Option<Box<Expression>>,
11032}
11033
11034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11036#[cfg_attr(feature = "bindings", derive(TS))]
11037pub struct JSONType {
11038 pub this: Box<Expression>,
11039 #[serde(default)]
11040 pub expression: Option<Box<Expression>>,
11041}
11042
11043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11045#[cfg_attr(feature = "bindings", derive(TS))]
11046pub struct ObjectInsert {
11047 pub this: Box<Expression>,
11048 #[serde(default)]
11049 pub key: Option<Box<Expression>>,
11050 #[serde(default)]
11051 pub value: Option<Box<Expression>>,
11052 #[serde(default)]
11053 pub update_flag: Option<Box<Expression>>,
11054}
11055
11056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11058#[cfg_attr(feature = "bindings", derive(TS))]
11059pub struct OpenJSONColumnDef {
11060 pub this: Box<Expression>,
11061 pub kind: String,
11062 #[serde(default)]
11063 pub path: Option<Box<Expression>>,
11064 #[serde(default)]
11065 pub as_json: Option<Box<Expression>>,
11066 #[serde(default, skip_serializing_if = "Option::is_none")]
11068 pub data_type: Option<DataType>,
11069}
11070
11071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11073#[cfg_attr(feature = "bindings", derive(TS))]
11074pub struct OpenJSON {
11075 pub this: Box<Expression>,
11076 #[serde(default)]
11077 pub path: Option<Box<Expression>>,
11078 #[serde(default)]
11079 pub expressions: Vec<Expression>,
11080}
11081
11082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11084#[cfg_attr(feature = "bindings", derive(TS))]
11085pub struct JSONBExists {
11086 pub this: Box<Expression>,
11087 #[serde(default)]
11088 pub path: Option<Box<Expression>>,
11089}
11090
11091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11093#[cfg_attr(feature = "bindings", derive(TS))]
11094pub struct JSONCast {
11095 pub this: Box<Expression>,
11096 pub to: DataType,
11097}
11098
11099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11101#[cfg_attr(feature = "bindings", derive(TS))]
11102pub struct JSONExtract {
11103 pub this: Box<Expression>,
11104 pub expression: Box<Expression>,
11105 #[serde(default)]
11106 pub only_json_types: Option<Box<Expression>>,
11107 #[serde(default)]
11108 pub expressions: Vec<Expression>,
11109 #[serde(default)]
11110 pub variant_extract: Option<Box<Expression>>,
11111 #[serde(default)]
11112 pub json_query: Option<Box<Expression>>,
11113 #[serde(default)]
11114 pub option: Option<Box<Expression>>,
11115 #[serde(default)]
11116 pub quote: Option<Box<Expression>>,
11117 #[serde(default)]
11118 pub on_condition: Option<Box<Expression>>,
11119 #[serde(default)]
11120 pub requires_json: Option<Box<Expression>>,
11121}
11122
11123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11125#[cfg_attr(feature = "bindings", derive(TS))]
11126pub struct JSONExtractQuote {
11127 #[serde(default)]
11128 pub option: Option<Box<Expression>>,
11129 #[serde(default)]
11130 pub scalar: Option<Box<Expression>>,
11131}
11132
11133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11135#[cfg_attr(feature = "bindings", derive(TS))]
11136pub struct JSONExtractArray {
11137 pub this: Box<Expression>,
11138 #[serde(default)]
11139 pub expression: Option<Box<Expression>>,
11140}
11141
11142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11144#[cfg_attr(feature = "bindings", derive(TS))]
11145pub struct JSONExtractScalar {
11146 pub this: Box<Expression>,
11147 pub expression: Box<Expression>,
11148 #[serde(default)]
11149 pub only_json_types: Option<Box<Expression>>,
11150 #[serde(default)]
11151 pub expressions: Vec<Expression>,
11152 #[serde(default)]
11153 pub json_type: Option<Box<Expression>>,
11154 #[serde(default)]
11155 pub scalar_only: Option<Box<Expression>>,
11156}
11157
11158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11160#[cfg_attr(feature = "bindings", derive(TS))]
11161pub struct JSONBExtractScalar {
11162 pub this: Box<Expression>,
11163 pub expression: Box<Expression>,
11164 #[serde(default)]
11165 pub json_type: Option<Box<Expression>>,
11166}
11167
11168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11170#[cfg_attr(feature = "bindings", derive(TS))]
11171pub struct JSONFormat {
11172 #[serde(default)]
11173 pub this: Option<Box<Expression>>,
11174 #[serde(default)]
11175 pub options: Vec<Expression>,
11176 #[serde(default)]
11177 pub is_json: Option<Box<Expression>>,
11178 #[serde(default)]
11179 pub to_json: Option<Box<Expression>>,
11180}
11181
11182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11184#[cfg_attr(feature = "bindings", derive(TS))]
11185pub struct JSONArrayAppend {
11186 pub this: Box<Expression>,
11187 #[serde(default)]
11188 pub expressions: Vec<Expression>,
11189}
11190
11191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11193#[cfg_attr(feature = "bindings", derive(TS))]
11194pub struct JSONArrayContains {
11195 pub this: Box<Expression>,
11196 pub expression: Box<Expression>,
11197 #[serde(default)]
11198 pub json_type: Option<Box<Expression>>,
11199}
11200
11201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11203#[cfg_attr(feature = "bindings", derive(TS))]
11204pub struct JSONArrayInsert {
11205 pub this: Box<Expression>,
11206 #[serde(default)]
11207 pub expressions: Vec<Expression>,
11208}
11209
11210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11212#[cfg_attr(feature = "bindings", derive(TS))]
11213pub struct ParseJSON {
11214 pub this: Box<Expression>,
11215 #[serde(default)]
11216 pub expression: Option<Box<Expression>>,
11217 #[serde(default)]
11218 pub safe: Option<Box<Expression>>,
11219}
11220
11221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11223#[cfg_attr(feature = "bindings", derive(TS))]
11224pub struct ParseUrl {
11225 pub this: Box<Expression>,
11226 #[serde(default)]
11227 pub part_to_extract: Option<Box<Expression>>,
11228 #[serde(default)]
11229 pub key: Option<Box<Expression>>,
11230 #[serde(default)]
11231 pub permissive: Option<Box<Expression>>,
11232}
11233
11234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11236#[cfg_attr(feature = "bindings", derive(TS))]
11237pub struct ParseIp {
11238 pub this: Box<Expression>,
11239 #[serde(default)]
11240 pub type_: Option<Box<Expression>>,
11241 #[serde(default)]
11242 pub permissive: Option<Box<Expression>>,
11243}
11244
11245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11247#[cfg_attr(feature = "bindings", derive(TS))]
11248pub struct ParseTime {
11249 pub this: Box<Expression>,
11250 pub format: String,
11251}
11252
11253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11255#[cfg_attr(feature = "bindings", derive(TS))]
11256pub struct ParseDatetime {
11257 pub this: Box<Expression>,
11258 #[serde(default)]
11259 pub format: Option<String>,
11260 #[serde(default)]
11261 pub zone: Option<Box<Expression>>,
11262}
11263
11264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11266#[cfg_attr(feature = "bindings", derive(TS))]
11267pub struct Map {
11268 #[serde(default)]
11269 pub keys: Vec<Expression>,
11270 #[serde(default)]
11271 pub values: Vec<Expression>,
11272}
11273
11274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11276#[cfg_attr(feature = "bindings", derive(TS))]
11277pub struct MapCat {
11278 pub this: Box<Expression>,
11279 pub expression: Box<Expression>,
11280}
11281
11282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11284#[cfg_attr(feature = "bindings", derive(TS))]
11285pub struct MapDelete {
11286 pub this: Box<Expression>,
11287 #[serde(default)]
11288 pub expressions: Vec<Expression>,
11289}
11290
11291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11293#[cfg_attr(feature = "bindings", derive(TS))]
11294pub struct MapInsert {
11295 pub this: Box<Expression>,
11296 #[serde(default)]
11297 pub key: Option<Box<Expression>>,
11298 #[serde(default)]
11299 pub value: Option<Box<Expression>>,
11300 #[serde(default)]
11301 pub update_flag: Option<Box<Expression>>,
11302}
11303
11304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11306#[cfg_attr(feature = "bindings", derive(TS))]
11307pub struct MapPick {
11308 pub this: Box<Expression>,
11309 #[serde(default)]
11310 pub expressions: Vec<Expression>,
11311}
11312
11313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11315#[cfg_attr(feature = "bindings", derive(TS))]
11316pub struct ScopeResolution {
11317 #[serde(default)]
11318 pub this: Option<Box<Expression>>,
11319 pub expression: Box<Expression>,
11320}
11321
11322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11324#[cfg_attr(feature = "bindings", derive(TS))]
11325pub struct Slice {
11326 #[serde(default)]
11327 pub this: Option<Box<Expression>>,
11328 #[serde(default)]
11329 pub expression: Option<Box<Expression>>,
11330 #[serde(default)]
11331 pub step: Option<Box<Expression>>,
11332}
11333
11334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11336#[cfg_attr(feature = "bindings", derive(TS))]
11337pub struct VarMap {
11338 #[serde(default)]
11339 pub keys: Vec<Expression>,
11340 #[serde(default)]
11341 pub values: Vec<Expression>,
11342}
11343
11344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11346#[cfg_attr(feature = "bindings", derive(TS))]
11347pub struct MatchAgainst {
11348 pub this: Box<Expression>,
11349 #[serde(default)]
11350 pub expressions: Vec<Expression>,
11351 #[serde(default)]
11352 pub modifier: Option<Box<Expression>>,
11353}
11354
11355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11357#[cfg_attr(feature = "bindings", derive(TS))]
11358pub struct MD5Digest {
11359 pub this: Box<Expression>,
11360 #[serde(default)]
11361 pub expressions: Vec<Expression>,
11362}
11363
11364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11366#[cfg_attr(feature = "bindings", derive(TS))]
11367pub struct Monthname {
11368 pub this: Box<Expression>,
11369 #[serde(default)]
11370 pub abbreviated: Option<Box<Expression>>,
11371}
11372
11373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11375#[cfg_attr(feature = "bindings", derive(TS))]
11376pub struct Ntile {
11377 #[serde(default)]
11378 pub this: Option<Box<Expression>>,
11379}
11380
11381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11383#[cfg_attr(feature = "bindings", derive(TS))]
11384pub struct Normalize {
11385 pub this: Box<Expression>,
11386 #[serde(default)]
11387 pub form: Option<Box<Expression>>,
11388 #[serde(default)]
11389 pub is_casefold: Option<Box<Expression>>,
11390}
11391
11392#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11394#[cfg_attr(feature = "bindings", derive(TS))]
11395pub struct Normal {
11396 pub this: Box<Expression>,
11397 #[serde(default)]
11398 pub stddev: Option<Box<Expression>>,
11399 #[serde(default)]
11400 pub gen: Option<Box<Expression>>,
11401}
11402
11403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11405#[cfg_attr(feature = "bindings", derive(TS))]
11406pub struct Predict {
11407 pub this: Box<Expression>,
11408 pub expression: Box<Expression>,
11409 #[serde(default)]
11410 pub params_struct: Option<Box<Expression>>,
11411}
11412
11413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11415#[cfg_attr(feature = "bindings", derive(TS))]
11416pub struct MLTranslate {
11417 pub this: Box<Expression>,
11418 pub expression: Box<Expression>,
11419 #[serde(default)]
11420 pub params_struct: Option<Box<Expression>>,
11421}
11422
11423#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11425#[cfg_attr(feature = "bindings", derive(TS))]
11426pub struct FeaturesAtTime {
11427 pub this: Box<Expression>,
11428 #[serde(default)]
11429 pub time: Option<Box<Expression>>,
11430 #[serde(default)]
11431 pub num_rows: Option<Box<Expression>>,
11432 #[serde(default)]
11433 pub ignore_feature_nulls: Option<Box<Expression>>,
11434}
11435
11436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11438#[cfg_attr(feature = "bindings", derive(TS))]
11439pub struct GenerateEmbedding {
11440 pub this: Box<Expression>,
11441 pub expression: Box<Expression>,
11442 #[serde(default)]
11443 pub params_struct: Option<Box<Expression>>,
11444 #[serde(default)]
11445 pub is_text: Option<Box<Expression>>,
11446}
11447
11448#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11450#[cfg_attr(feature = "bindings", derive(TS))]
11451pub struct MLForecast {
11452 pub this: Box<Expression>,
11453 #[serde(default)]
11454 pub expression: Option<Box<Expression>>,
11455 #[serde(default)]
11456 pub params_struct: Option<Box<Expression>>,
11457}
11458
11459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11461#[cfg_attr(feature = "bindings", derive(TS))]
11462pub struct ModelAttribute {
11463 pub this: Box<Expression>,
11464 pub expression: Box<Expression>,
11465}
11466
11467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11469#[cfg_attr(feature = "bindings", derive(TS))]
11470pub struct VectorSearch {
11471 pub this: Box<Expression>,
11472 #[serde(default)]
11473 pub column_to_search: Option<Box<Expression>>,
11474 #[serde(default)]
11475 pub query_table: Option<Box<Expression>>,
11476 #[serde(default)]
11477 pub query_column_to_search: Option<Box<Expression>>,
11478 #[serde(default)]
11479 pub top_k: Option<Box<Expression>>,
11480 #[serde(default)]
11481 pub distance_type: Option<Box<Expression>>,
11482 #[serde(default)]
11483 pub options: Vec<Expression>,
11484}
11485
11486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11488#[cfg_attr(feature = "bindings", derive(TS))]
11489pub struct Quantile {
11490 pub this: Box<Expression>,
11491 #[serde(default)]
11492 pub quantile: Option<Box<Expression>>,
11493}
11494
11495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11497#[cfg_attr(feature = "bindings", derive(TS))]
11498pub struct ApproxQuantile {
11499 pub this: Box<Expression>,
11500 #[serde(default)]
11501 pub quantile: Option<Box<Expression>>,
11502 #[serde(default)]
11503 pub accuracy: Option<Box<Expression>>,
11504 #[serde(default)]
11505 pub weight: Option<Box<Expression>>,
11506 #[serde(default)]
11507 pub error_tolerance: Option<Box<Expression>>,
11508}
11509
11510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11512#[cfg_attr(feature = "bindings", derive(TS))]
11513pub struct ApproxPercentileEstimate {
11514 pub this: Box<Expression>,
11515 #[serde(default)]
11516 pub percentile: Option<Box<Expression>>,
11517}
11518
11519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11521#[cfg_attr(feature = "bindings", derive(TS))]
11522pub struct Randn {
11523 #[serde(default)]
11524 pub this: Option<Box<Expression>>,
11525}
11526
11527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11529#[cfg_attr(feature = "bindings", derive(TS))]
11530pub struct Randstr {
11531 pub this: Box<Expression>,
11532 #[serde(default)]
11533 pub generator: Option<Box<Expression>>,
11534}
11535
11536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11538#[cfg_attr(feature = "bindings", derive(TS))]
11539pub struct RangeN {
11540 pub this: Box<Expression>,
11541 #[serde(default)]
11542 pub expressions: Vec<Expression>,
11543 #[serde(default)]
11544 pub each: Option<Box<Expression>>,
11545}
11546
11547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11549#[cfg_attr(feature = "bindings", derive(TS))]
11550pub struct RangeBucket {
11551 pub this: Box<Expression>,
11552 pub expression: Box<Expression>,
11553}
11554
11555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11557#[cfg_attr(feature = "bindings", derive(TS))]
11558pub struct ReadCSV {
11559 pub this: Box<Expression>,
11560 #[serde(default)]
11561 pub expressions: Vec<Expression>,
11562}
11563
11564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11566#[cfg_attr(feature = "bindings", derive(TS))]
11567pub struct ReadParquet {
11568 #[serde(default)]
11569 pub expressions: Vec<Expression>,
11570}
11571
11572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11574#[cfg_attr(feature = "bindings", derive(TS))]
11575pub struct Reduce {
11576 pub this: Box<Expression>,
11577 #[serde(default)]
11578 pub initial: Option<Box<Expression>>,
11579 #[serde(default)]
11580 pub merge: Option<Box<Expression>>,
11581 #[serde(default)]
11582 pub finish: Option<Box<Expression>>,
11583}
11584
11585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11587#[cfg_attr(feature = "bindings", derive(TS))]
11588pub struct RegexpExtractAll {
11589 pub this: Box<Expression>,
11590 pub expression: Box<Expression>,
11591 #[serde(default)]
11592 pub group: Option<Box<Expression>>,
11593 #[serde(default)]
11594 pub parameters: Option<Box<Expression>>,
11595 #[serde(default)]
11596 pub position: Option<Box<Expression>>,
11597 #[serde(default)]
11598 pub occurrence: Option<Box<Expression>>,
11599}
11600
11601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11603#[cfg_attr(feature = "bindings", derive(TS))]
11604pub struct RegexpILike {
11605 pub this: Box<Expression>,
11606 pub expression: Box<Expression>,
11607 #[serde(default)]
11608 pub flag: Option<Box<Expression>>,
11609}
11610
11611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11613#[cfg_attr(feature = "bindings", derive(TS))]
11614pub struct RegexpFullMatch {
11615 pub this: Box<Expression>,
11616 pub expression: Box<Expression>,
11617 #[serde(default)]
11618 pub options: Vec<Expression>,
11619}
11620
11621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11623#[cfg_attr(feature = "bindings", derive(TS))]
11624pub struct RegexpInstr {
11625 pub this: Box<Expression>,
11626 pub expression: Box<Expression>,
11627 #[serde(default)]
11628 pub position: Option<Box<Expression>>,
11629 #[serde(default)]
11630 pub occurrence: Option<Box<Expression>>,
11631 #[serde(default)]
11632 pub option: Option<Box<Expression>>,
11633 #[serde(default)]
11634 pub parameters: Option<Box<Expression>>,
11635 #[serde(default)]
11636 pub group: Option<Box<Expression>>,
11637}
11638
11639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11641#[cfg_attr(feature = "bindings", derive(TS))]
11642pub struct RegexpSplit {
11643 pub this: Box<Expression>,
11644 pub expression: Box<Expression>,
11645 #[serde(default)]
11646 pub limit: Option<Box<Expression>>,
11647}
11648
11649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11651#[cfg_attr(feature = "bindings", derive(TS))]
11652pub struct RegexpCount {
11653 pub this: Box<Expression>,
11654 pub expression: Box<Expression>,
11655 #[serde(default)]
11656 pub position: Option<Box<Expression>>,
11657 #[serde(default)]
11658 pub parameters: Option<Box<Expression>>,
11659}
11660
11661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11663#[cfg_attr(feature = "bindings", derive(TS))]
11664pub struct RegrValx {
11665 pub this: Box<Expression>,
11666 pub expression: Box<Expression>,
11667}
11668
11669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11671#[cfg_attr(feature = "bindings", derive(TS))]
11672pub struct RegrValy {
11673 pub this: Box<Expression>,
11674 pub expression: Box<Expression>,
11675}
11676
11677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11679#[cfg_attr(feature = "bindings", derive(TS))]
11680pub struct RegrAvgy {
11681 pub this: Box<Expression>,
11682 pub expression: Box<Expression>,
11683}
11684
11685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11687#[cfg_attr(feature = "bindings", derive(TS))]
11688pub struct RegrAvgx {
11689 pub this: Box<Expression>,
11690 pub expression: Box<Expression>,
11691}
11692
11693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11695#[cfg_attr(feature = "bindings", derive(TS))]
11696pub struct RegrCount {
11697 pub this: Box<Expression>,
11698 pub expression: Box<Expression>,
11699}
11700
11701#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11703#[cfg_attr(feature = "bindings", derive(TS))]
11704pub struct RegrIntercept {
11705 pub this: Box<Expression>,
11706 pub expression: Box<Expression>,
11707}
11708
11709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11711#[cfg_attr(feature = "bindings", derive(TS))]
11712pub struct RegrR2 {
11713 pub this: Box<Expression>,
11714 pub expression: Box<Expression>,
11715}
11716
11717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11719#[cfg_attr(feature = "bindings", derive(TS))]
11720pub struct RegrSxx {
11721 pub this: Box<Expression>,
11722 pub expression: Box<Expression>,
11723}
11724
11725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11727#[cfg_attr(feature = "bindings", derive(TS))]
11728pub struct RegrSxy {
11729 pub this: Box<Expression>,
11730 pub expression: Box<Expression>,
11731}
11732
11733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11735#[cfg_attr(feature = "bindings", derive(TS))]
11736pub struct RegrSyy {
11737 pub this: Box<Expression>,
11738 pub expression: Box<Expression>,
11739}
11740
11741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11743#[cfg_attr(feature = "bindings", derive(TS))]
11744pub struct RegrSlope {
11745 pub this: Box<Expression>,
11746 pub expression: Box<Expression>,
11747}
11748
11749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11751#[cfg_attr(feature = "bindings", derive(TS))]
11752pub struct SafeAdd {
11753 pub this: Box<Expression>,
11754 pub expression: Box<Expression>,
11755}
11756
11757#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11759#[cfg_attr(feature = "bindings", derive(TS))]
11760pub struct SafeDivide {
11761 pub this: Box<Expression>,
11762 pub expression: Box<Expression>,
11763}
11764
11765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11767#[cfg_attr(feature = "bindings", derive(TS))]
11768pub struct SafeMultiply {
11769 pub this: Box<Expression>,
11770 pub expression: Box<Expression>,
11771}
11772
11773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11775#[cfg_attr(feature = "bindings", derive(TS))]
11776pub struct SafeSubtract {
11777 pub this: Box<Expression>,
11778 pub expression: Box<Expression>,
11779}
11780
11781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11783#[cfg_attr(feature = "bindings", derive(TS))]
11784pub struct SHA2 {
11785 pub this: Box<Expression>,
11786 #[serde(default)]
11787 pub length: Option<i64>,
11788}
11789
11790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11792#[cfg_attr(feature = "bindings", derive(TS))]
11793pub struct SHA2Digest {
11794 pub this: Box<Expression>,
11795 #[serde(default)]
11796 pub length: Option<i64>,
11797}
11798
11799#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11801#[cfg_attr(feature = "bindings", derive(TS))]
11802pub struct SortArray {
11803 pub this: Box<Expression>,
11804 #[serde(default)]
11805 pub asc: Option<Box<Expression>>,
11806 #[serde(default)]
11807 pub nulls_first: Option<Box<Expression>>,
11808}
11809
11810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11812#[cfg_attr(feature = "bindings", derive(TS))]
11813pub struct SplitPart {
11814 pub this: Box<Expression>,
11815 #[serde(default)]
11816 pub delimiter: Option<Box<Expression>>,
11817 #[serde(default)]
11818 pub part_index: Option<Box<Expression>>,
11819}
11820
11821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11823#[cfg_attr(feature = "bindings", derive(TS))]
11824pub struct SubstringIndex {
11825 pub this: Box<Expression>,
11826 #[serde(default)]
11827 pub delimiter: Option<Box<Expression>>,
11828 #[serde(default)]
11829 pub count: Option<Box<Expression>>,
11830}
11831
11832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11834#[cfg_attr(feature = "bindings", derive(TS))]
11835pub struct StandardHash {
11836 pub this: Box<Expression>,
11837 #[serde(default)]
11838 pub expression: Option<Box<Expression>>,
11839}
11840
11841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11843#[cfg_attr(feature = "bindings", derive(TS))]
11844pub struct StrPosition {
11845 pub this: Box<Expression>,
11846 #[serde(default)]
11847 pub substr: Option<Box<Expression>>,
11848 #[serde(default)]
11849 pub position: Option<Box<Expression>>,
11850 #[serde(default)]
11851 pub occurrence: Option<Box<Expression>>,
11852}
11853
11854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11856#[cfg_attr(feature = "bindings", derive(TS))]
11857pub struct Search {
11858 pub this: Box<Expression>,
11859 pub expression: Box<Expression>,
11860 #[serde(default)]
11861 pub json_scope: Option<Box<Expression>>,
11862 #[serde(default)]
11863 pub analyzer: Option<Box<Expression>>,
11864 #[serde(default)]
11865 pub analyzer_options: Option<Box<Expression>>,
11866 #[serde(default)]
11867 pub search_mode: Option<Box<Expression>>,
11868}
11869
11870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11872#[cfg_attr(feature = "bindings", derive(TS))]
11873pub struct SearchIp {
11874 pub this: Box<Expression>,
11875 pub expression: Box<Expression>,
11876}
11877
11878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11880#[cfg_attr(feature = "bindings", derive(TS))]
11881pub struct StrToDate {
11882 pub this: Box<Expression>,
11883 #[serde(default)]
11884 pub format: Option<String>,
11885 #[serde(default)]
11886 pub safe: Option<Box<Expression>>,
11887}
11888
11889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11891#[cfg_attr(feature = "bindings", derive(TS))]
11892pub struct StrToTime {
11893 pub this: Box<Expression>,
11894 pub format: String,
11895 #[serde(default)]
11896 pub zone: Option<Box<Expression>>,
11897 #[serde(default)]
11898 pub safe: Option<Box<Expression>>,
11899 #[serde(default)]
11900 pub target_type: Option<Box<Expression>>,
11901}
11902
11903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11905#[cfg_attr(feature = "bindings", derive(TS))]
11906pub struct StrToUnix {
11907 #[serde(default)]
11908 pub this: Option<Box<Expression>>,
11909 #[serde(default)]
11910 pub format: Option<String>,
11911}
11912
11913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11915#[cfg_attr(feature = "bindings", derive(TS))]
11916pub struct StrToMap {
11917 pub this: Box<Expression>,
11918 #[serde(default)]
11919 pub pair_delim: Option<Box<Expression>>,
11920 #[serde(default)]
11921 pub key_value_delim: Option<Box<Expression>>,
11922 #[serde(default)]
11923 pub duplicate_resolution_callback: Option<Box<Expression>>,
11924}
11925
11926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11928#[cfg_attr(feature = "bindings", derive(TS))]
11929pub struct NumberToStr {
11930 pub this: Box<Expression>,
11931 pub format: String,
11932 #[serde(default)]
11933 pub culture: Option<Box<Expression>>,
11934}
11935
11936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11938#[cfg_attr(feature = "bindings", derive(TS))]
11939pub struct FromBase {
11940 pub this: Box<Expression>,
11941 pub expression: Box<Expression>,
11942}
11943
11944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11946#[cfg_attr(feature = "bindings", derive(TS))]
11947pub struct Stuff {
11948 pub this: Box<Expression>,
11949 #[serde(default)]
11950 pub start: Option<Box<Expression>>,
11951 #[serde(default)]
11952 pub length: Option<i64>,
11953 pub expression: Box<Expression>,
11954}
11955
11956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11958#[cfg_attr(feature = "bindings", derive(TS))]
11959pub struct TimeToStr {
11960 pub this: Box<Expression>,
11961 pub format: String,
11962 #[serde(default)]
11963 pub culture: Option<Box<Expression>>,
11964 #[serde(default)]
11965 pub zone: Option<Box<Expression>>,
11966}
11967
11968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11970#[cfg_attr(feature = "bindings", derive(TS))]
11971pub struct TimeStrToTime {
11972 pub this: Box<Expression>,
11973 #[serde(default)]
11974 pub zone: Option<Box<Expression>>,
11975}
11976
11977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11979#[cfg_attr(feature = "bindings", derive(TS))]
11980pub struct TsOrDsAdd {
11981 pub this: Box<Expression>,
11982 pub expression: Box<Expression>,
11983 #[serde(default)]
11984 pub unit: Option<String>,
11985 #[serde(default)]
11986 pub return_type: Option<Box<Expression>>,
11987}
11988
11989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11991#[cfg_attr(feature = "bindings", derive(TS))]
11992pub struct TsOrDsDiff {
11993 pub this: Box<Expression>,
11994 pub expression: Box<Expression>,
11995 #[serde(default)]
11996 pub unit: Option<String>,
11997}
11998
11999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12001#[cfg_attr(feature = "bindings", derive(TS))]
12002pub struct TsOrDsToDate {
12003 pub this: Box<Expression>,
12004 #[serde(default)]
12005 pub format: Option<String>,
12006 #[serde(default)]
12007 pub safe: Option<Box<Expression>>,
12008}
12009
12010#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12012#[cfg_attr(feature = "bindings", derive(TS))]
12013pub struct TsOrDsToTime {
12014 pub this: Box<Expression>,
12015 #[serde(default)]
12016 pub format: Option<String>,
12017 #[serde(default)]
12018 pub safe: Option<Box<Expression>>,
12019}
12020
12021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12023#[cfg_attr(feature = "bindings", derive(TS))]
12024pub struct Unhex {
12025 pub this: Box<Expression>,
12026 #[serde(default)]
12027 pub expression: Option<Box<Expression>>,
12028}
12029
12030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12032#[cfg_attr(feature = "bindings", derive(TS))]
12033pub struct Uniform {
12034 pub this: Box<Expression>,
12035 pub expression: Box<Expression>,
12036 #[serde(default)]
12037 pub gen: Option<Box<Expression>>,
12038 #[serde(default)]
12039 pub seed: Option<Box<Expression>>,
12040}
12041
12042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12044#[cfg_attr(feature = "bindings", derive(TS))]
12045pub struct UnixToStr {
12046 pub this: Box<Expression>,
12047 #[serde(default)]
12048 pub format: Option<String>,
12049}
12050
12051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12053#[cfg_attr(feature = "bindings", derive(TS))]
12054pub struct UnixToTime {
12055 pub this: Box<Expression>,
12056 #[serde(default)]
12057 pub scale: Option<i64>,
12058 #[serde(default)]
12059 pub zone: Option<Box<Expression>>,
12060 #[serde(default)]
12061 pub hours: Option<Box<Expression>>,
12062 #[serde(default)]
12063 pub minutes: Option<Box<Expression>>,
12064 #[serde(default)]
12065 pub format: Option<String>,
12066 #[serde(default)]
12067 pub target_type: Option<Box<Expression>>,
12068}
12069
12070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12072#[cfg_attr(feature = "bindings", derive(TS))]
12073pub struct Uuid {
12074 #[serde(default)]
12075 pub this: Option<Box<Expression>>,
12076 #[serde(default)]
12077 pub name: Option<String>,
12078 #[serde(default)]
12079 pub is_string: Option<Box<Expression>>,
12080}
12081
12082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12084#[cfg_attr(feature = "bindings", derive(TS))]
12085pub struct TimestampFromParts {
12086 #[serde(default)]
12087 pub zone: Option<Box<Expression>>,
12088 #[serde(default)]
12089 pub milli: Option<Box<Expression>>,
12090 #[serde(default)]
12091 pub this: Option<Box<Expression>>,
12092 #[serde(default)]
12093 pub expression: Option<Box<Expression>>,
12094}
12095
12096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12098#[cfg_attr(feature = "bindings", derive(TS))]
12099pub struct TimestampTzFromParts {
12100 #[serde(default)]
12101 pub zone: Option<Box<Expression>>,
12102}
12103
12104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12106#[cfg_attr(feature = "bindings", derive(TS))]
12107pub struct Corr {
12108 pub this: Box<Expression>,
12109 pub expression: Box<Expression>,
12110 #[serde(default)]
12111 pub null_on_zero_variance: Option<Box<Expression>>,
12112}
12113
12114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12116#[cfg_attr(feature = "bindings", derive(TS))]
12117pub struct WidthBucket {
12118 pub this: Box<Expression>,
12119 #[serde(default)]
12120 pub min_value: Option<Box<Expression>>,
12121 #[serde(default)]
12122 pub max_value: Option<Box<Expression>>,
12123 #[serde(default)]
12124 pub num_buckets: Option<Box<Expression>>,
12125 #[serde(default)]
12126 pub threshold: Option<Box<Expression>>,
12127}
12128
12129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12131#[cfg_attr(feature = "bindings", derive(TS))]
12132pub struct CovarSamp {
12133 pub this: Box<Expression>,
12134 pub expression: Box<Expression>,
12135}
12136
12137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12139#[cfg_attr(feature = "bindings", derive(TS))]
12140pub struct CovarPop {
12141 pub this: Box<Expression>,
12142 pub expression: Box<Expression>,
12143}
12144
12145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12147#[cfg_attr(feature = "bindings", derive(TS))]
12148pub struct Week {
12149 pub this: Box<Expression>,
12150 #[serde(default)]
12151 pub mode: Option<Box<Expression>>,
12152}
12153
12154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12156#[cfg_attr(feature = "bindings", derive(TS))]
12157pub struct XMLElement {
12158 pub this: Box<Expression>,
12159 #[serde(default)]
12160 pub expressions: Vec<Expression>,
12161 #[serde(default)]
12162 pub evalname: Option<Box<Expression>>,
12163}
12164
12165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12167#[cfg_attr(feature = "bindings", derive(TS))]
12168pub struct XMLGet {
12169 pub this: Box<Expression>,
12170 pub expression: Box<Expression>,
12171 #[serde(default)]
12172 pub instance: Option<Box<Expression>>,
12173}
12174
12175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12177#[cfg_attr(feature = "bindings", derive(TS))]
12178pub struct XMLTable {
12179 pub this: Box<Expression>,
12180 #[serde(default)]
12181 pub namespaces: Option<Box<Expression>>,
12182 #[serde(default)]
12183 pub passing: Option<Box<Expression>>,
12184 #[serde(default)]
12185 pub columns: Vec<Expression>,
12186 #[serde(default)]
12187 pub by_ref: Option<Box<Expression>>,
12188}
12189
12190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12192#[cfg_attr(feature = "bindings", derive(TS))]
12193pub struct XMLKeyValueOption {
12194 pub this: Box<Expression>,
12195 #[serde(default)]
12196 pub expression: Option<Box<Expression>>,
12197}
12198
12199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12201#[cfg_attr(feature = "bindings", derive(TS))]
12202pub struct Zipf {
12203 pub this: Box<Expression>,
12204 #[serde(default)]
12205 pub elementcount: Option<Box<Expression>>,
12206 #[serde(default)]
12207 pub gen: Option<Box<Expression>>,
12208}
12209
12210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12212#[cfg_attr(feature = "bindings", derive(TS))]
12213pub struct Merge {
12214 pub this: Box<Expression>,
12215 pub using: Box<Expression>,
12216 #[serde(default)]
12217 pub on: Option<Box<Expression>>,
12218 #[serde(default)]
12219 pub using_cond: Option<Box<Expression>>,
12220 #[serde(default)]
12221 pub whens: Option<Box<Expression>>,
12222 #[serde(default)]
12223 pub with_: Option<Box<Expression>>,
12224 #[serde(default)]
12225 pub returning: Option<Box<Expression>>,
12226}
12227
12228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12230#[cfg_attr(feature = "bindings", derive(TS))]
12231pub struct When {
12232 #[serde(default)]
12233 pub matched: Option<Box<Expression>>,
12234 #[serde(default)]
12235 pub source: Option<Box<Expression>>,
12236 #[serde(default)]
12237 pub condition: Option<Box<Expression>>,
12238 pub then: Box<Expression>,
12239}
12240
12241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12243#[cfg_attr(feature = "bindings", derive(TS))]
12244pub struct Whens {
12245 #[serde(default)]
12246 pub expressions: Vec<Expression>,
12247}
12248
12249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12251#[cfg_attr(feature = "bindings", derive(TS))]
12252pub struct NextValueFor {
12253 pub this: Box<Expression>,
12254 #[serde(default)]
12255 pub order: Option<Box<Expression>>,
12256}
12257
12258
12259#[cfg(test)]
12260mod tests {
12261 use super::*;
12262
12263 #[test]
12264 #[cfg(feature = "bindings")]
12265 fn export_typescript_types() {
12266 Expression::export_all(&ts_rs::Config::default()).expect("Failed to export Expression types");
12269 }
12270
12271 #[test]
12272 fn test_simple_select_builder() {
12273 let select = Select::new()
12274 .column(Expression::star())
12275 .from(Expression::Table(TableRef::new("users")));
12276
12277 assert_eq!(select.expressions.len(), 1);
12278 assert!(select.from.is_some());
12279 }
12280
12281 #[test]
12282 fn test_expression_alias() {
12283 let expr = Expression::column("id").alias("user_id");
12284
12285 match expr {
12286 Expression::Alias(a) => {
12287 assert_eq!(a.alias.name, "user_id");
12288 }
12289 _ => panic!("Expected Alias"),
12290 }
12291 }
12292
12293 #[test]
12294 fn test_literal_creation() {
12295 let num = Expression::number(42);
12296 let str = Expression::string("hello");
12297
12298 match num {
12299 Expression::Literal(Literal::Number(n)) => assert_eq!(n, "42"),
12300 _ => panic!("Expected Number"),
12301 }
12302
12303 match str {
12304 Expression::Literal(Literal::String(s)) => assert_eq!(s, "hello"),
12305 _ => panic!("Expected String"),
12306 }
12307 }
12308
12309 #[test]
12310 fn test_expression_sql() {
12311 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
12312 assert_eq!(expr.sql(), "SELECT 1 + 2");
12313 }
12314
12315 #[test]
12316 fn test_expression_sql_for() {
12317 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
12318 let sql = expr.sql_for(crate::DialectType::Generic);
12319 assert!(sql.contains("IF"));
12320 }
12321}