1use crate::tokens::Span;
34use serde::{Deserialize, Serialize};
35use std::fmt;
36#[cfg(feature = "bindings")]
37use ts_rs::TS;
38
39fn default_true() -> bool {
41 true
42}
43
44fn is_true(v: &bool) -> bool {
45 *v
46}
47
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
77#[cfg_attr(feature = "bindings", derive(TS))]
78#[serde(rename_all = "snake_case")]
79#[cfg_attr(feature = "bindings", ts(export))]
80pub enum Expression {
81 Literal(Literal),
83 Boolean(BooleanLiteral),
84 Null(Null),
85
86 Identifier(Identifier),
88 Column(Column),
89 Table(TableRef),
90 Star(Star),
91 BracedWildcard(Box<Expression>),
93
94 Select(Box<Select>),
96 Union(Box<Union>),
97 Intersect(Box<Intersect>),
98 Except(Box<Except>),
99 Subquery(Box<Subquery>),
100 PipeOperator(Box<PipeOperator>),
101 Pivot(Box<Pivot>),
102 PivotAlias(Box<PivotAlias>),
103 Unpivot(Box<Unpivot>),
104 Values(Box<Values>),
105 PreWhere(Box<PreWhere>),
106 Stream(Box<Stream>),
107 UsingData(Box<UsingData>),
108 XmlNamespace(Box<XmlNamespace>),
109
110 Insert(Box<Insert>),
112 Update(Box<Update>),
113 Delete(Box<Delete>),
114 Copy(Box<CopyStmt>),
115 Put(Box<PutStmt>),
116 StageReference(Box<StageReference>),
117
118 Alias(Box<Alias>),
120 Cast(Box<Cast>),
121 Collation(Box<CollationExpr>),
122 Case(Box<Case>),
123
124 And(Box<BinaryOp>),
126 Or(Box<BinaryOp>),
127 Add(Box<BinaryOp>),
128 Sub(Box<BinaryOp>),
129 Mul(Box<BinaryOp>),
130 Div(Box<BinaryOp>),
131 Mod(Box<BinaryOp>),
132 Eq(Box<BinaryOp>),
133 Neq(Box<BinaryOp>),
134 Lt(Box<BinaryOp>),
135 Lte(Box<BinaryOp>),
136 Gt(Box<BinaryOp>),
137 Gte(Box<BinaryOp>),
138 Like(Box<LikeOp>),
139 ILike(Box<LikeOp>),
140 Match(Box<BinaryOp>),
142 BitwiseAnd(Box<BinaryOp>),
143 BitwiseOr(Box<BinaryOp>),
144 BitwiseXor(Box<BinaryOp>),
145 Concat(Box<BinaryOp>),
146 Adjacent(Box<BinaryOp>), TsMatch(Box<BinaryOp>), PropertyEQ(Box<BinaryOp>), ArrayContainsAll(Box<BinaryOp>), ArrayContainedBy(Box<BinaryOp>), ArrayOverlaps(Box<BinaryOp>), JSONBContainsAllTopKeys(Box<BinaryOp>), JSONBContainsAnyTopKeys(Box<BinaryOp>), JSONBDeleteAtPath(Box<BinaryOp>), ExtendsLeft(Box<BinaryOp>), ExtendsRight(Box<BinaryOp>), Not(Box<UnaryOp>),
162 Neg(Box<UnaryOp>),
163 BitwiseNot(Box<UnaryOp>),
164
165 In(Box<In>),
167 Between(Box<Between>),
168 IsNull(Box<IsNull>),
169 IsTrue(Box<IsTrueFalse>),
170 IsFalse(Box<IsTrueFalse>),
171 IsJson(Box<IsJson>),
172 Is(Box<BinaryOp>), Exists(Box<Exists>),
174 MemberOf(Box<BinaryOp>),
176
177 Function(Box<Function>),
179 AggregateFunction(Box<AggregateFunction>),
180 WindowFunction(Box<WindowFunction>),
181
182 From(Box<From>),
184 Join(Box<Join>),
185 JoinedTable(Box<JoinedTable>),
186 Where(Box<Where>),
187 GroupBy(Box<GroupBy>),
188 Having(Box<Having>),
189 OrderBy(Box<OrderBy>),
190 Limit(Box<Limit>),
191 Offset(Box<Offset>),
192 Qualify(Box<Qualify>),
193 With(Box<With>),
194 Cte(Box<Cte>),
195 DistributeBy(Box<DistributeBy>),
196 ClusterBy(Box<ClusterBy>),
197 SortBy(Box<SortBy>),
198 LateralView(Box<LateralView>),
199 Hint(Box<Hint>),
200 Pseudocolumn(Pseudocolumn),
201
202 Connect(Box<Connect>),
204 Prior(Box<Prior>),
205 ConnectByRoot(Box<ConnectByRoot>),
206
207 MatchRecognize(Box<MatchRecognize>),
209
210 Ordered(Box<Ordered>),
212
213 Window(Box<WindowSpec>),
215 Over(Box<Over>),
216 WithinGroup(Box<WithinGroup>),
217
218 DataType(DataType),
220
221 Array(Box<Array>),
223 Struct(Box<Struct>),
224 Tuple(Box<Tuple>),
225
226 Interval(Box<Interval>),
228
229 ConcatWs(Box<ConcatWs>),
231 Substring(Box<SubstringFunc>),
232 Upper(Box<UnaryFunc>),
233 Lower(Box<UnaryFunc>),
234 Length(Box<UnaryFunc>),
235 Trim(Box<TrimFunc>),
236 LTrim(Box<UnaryFunc>),
237 RTrim(Box<UnaryFunc>),
238 Replace(Box<ReplaceFunc>),
239 Reverse(Box<UnaryFunc>),
240 Left(Box<LeftRightFunc>),
241 Right(Box<LeftRightFunc>),
242 Repeat(Box<RepeatFunc>),
243 Lpad(Box<PadFunc>),
244 Rpad(Box<PadFunc>),
245 Split(Box<SplitFunc>),
246 RegexpLike(Box<RegexpFunc>),
247 RegexpReplace(Box<RegexpReplaceFunc>),
248 RegexpExtract(Box<RegexpExtractFunc>),
249 Overlay(Box<OverlayFunc>),
250
251 Abs(Box<UnaryFunc>),
253 Round(Box<RoundFunc>),
254 Floor(Box<FloorFunc>),
255 Ceil(Box<CeilFunc>),
256 Power(Box<BinaryFunc>),
257 Sqrt(Box<UnaryFunc>),
258 Cbrt(Box<UnaryFunc>),
259 Ln(Box<UnaryFunc>),
260 Log(Box<LogFunc>),
261 Exp(Box<UnaryFunc>),
262 Sign(Box<UnaryFunc>),
263 Greatest(Box<VarArgFunc>),
264 Least(Box<VarArgFunc>),
265
266 CurrentDate(CurrentDate),
268 CurrentTime(CurrentTime),
269 CurrentTimestamp(CurrentTimestamp),
270 CurrentTimestampLTZ(CurrentTimestampLTZ),
271 AtTimeZone(Box<AtTimeZone>),
272 DateAdd(Box<DateAddFunc>),
273 DateSub(Box<DateAddFunc>),
274 DateDiff(Box<DateDiffFunc>),
275 DateTrunc(Box<DateTruncFunc>),
276 Extract(Box<ExtractFunc>),
277 ToDate(Box<ToDateFunc>),
278 ToTimestamp(Box<ToTimestampFunc>),
279 Date(Box<UnaryFunc>),
280 Time(Box<UnaryFunc>),
281 DateFromUnixDate(Box<UnaryFunc>),
282 UnixDate(Box<UnaryFunc>),
283 UnixSeconds(Box<UnaryFunc>),
284 UnixMillis(Box<UnaryFunc>),
285 UnixMicros(Box<UnaryFunc>),
286 UnixToTimeStr(Box<BinaryFunc>),
287 TimeStrToDate(Box<UnaryFunc>),
288 DateToDi(Box<UnaryFunc>),
289 DiToDate(Box<UnaryFunc>),
290 TsOrDiToDi(Box<UnaryFunc>),
291 TsOrDsToDatetime(Box<UnaryFunc>),
292 TsOrDsToTimestamp(Box<UnaryFunc>),
293 YearOfWeek(Box<UnaryFunc>),
294 YearOfWeekIso(Box<UnaryFunc>),
295
296 Coalesce(Box<VarArgFunc>),
298 NullIf(Box<BinaryFunc>),
299 IfFunc(Box<IfFunc>),
300 IfNull(Box<BinaryFunc>),
301 Nvl(Box<BinaryFunc>),
302 Nvl2(Box<Nvl2Func>),
303
304 TryCast(Box<Cast>),
306 SafeCast(Box<Cast>),
307
308 Count(Box<CountFunc>),
310 Sum(Box<AggFunc>),
311 Avg(Box<AggFunc>),
312 Min(Box<AggFunc>),
313 Max(Box<AggFunc>),
314 GroupConcat(Box<GroupConcatFunc>),
315 StringAgg(Box<StringAggFunc>),
316 ListAgg(Box<ListAggFunc>),
317 ArrayAgg(Box<AggFunc>),
318 CountIf(Box<AggFunc>),
319 SumIf(Box<SumIfFunc>),
320 Stddev(Box<AggFunc>),
321 StddevPop(Box<AggFunc>),
322 StddevSamp(Box<AggFunc>),
323 Variance(Box<AggFunc>),
324 VarPop(Box<AggFunc>),
325 VarSamp(Box<AggFunc>),
326 Median(Box<AggFunc>),
327 Mode(Box<AggFunc>),
328 First(Box<AggFunc>),
329 Last(Box<AggFunc>),
330 AnyValue(Box<AggFunc>),
331 ApproxDistinct(Box<AggFunc>),
332 ApproxCountDistinct(Box<AggFunc>),
333 ApproxPercentile(Box<ApproxPercentileFunc>),
334 Percentile(Box<PercentileFunc>),
335 LogicalAnd(Box<AggFunc>),
336 LogicalOr(Box<AggFunc>),
337 Skewness(Box<AggFunc>),
338 BitwiseCount(Box<UnaryFunc>),
339 ArrayConcatAgg(Box<AggFunc>),
340 ArrayUniqueAgg(Box<AggFunc>),
341 BoolXorAgg(Box<AggFunc>),
342
343 RowNumber(RowNumber),
345 Rank(Rank),
346 DenseRank(DenseRank),
347 NTile(Box<NTileFunc>),
348 Lead(Box<LeadLagFunc>),
349 Lag(Box<LeadLagFunc>),
350 FirstValue(Box<ValueFunc>),
351 LastValue(Box<ValueFunc>),
352 NthValue(Box<NthValueFunc>),
353 PercentRank(PercentRank),
354 CumeDist(CumeDist),
355 PercentileCont(Box<PercentileFunc>),
356 PercentileDisc(Box<PercentileFunc>),
357
358 Contains(Box<BinaryFunc>),
360 StartsWith(Box<BinaryFunc>),
361 EndsWith(Box<BinaryFunc>),
362 Position(Box<PositionFunc>),
363 Initcap(Box<UnaryFunc>),
364 Ascii(Box<UnaryFunc>),
365 Chr(Box<UnaryFunc>),
366 CharFunc(Box<CharFunc>),
368 Soundex(Box<UnaryFunc>),
369 Levenshtein(Box<BinaryFunc>),
370 ByteLength(Box<UnaryFunc>),
371 Hex(Box<UnaryFunc>),
372 LowerHex(Box<UnaryFunc>),
373 Unicode(Box<UnaryFunc>),
374
375 ModFunc(Box<BinaryFunc>),
377 Random(Random),
378 Rand(Box<Rand>),
379 TruncFunc(Box<TruncateFunc>),
380 Pi(Pi),
381 Radians(Box<UnaryFunc>),
382 Degrees(Box<UnaryFunc>),
383 Sin(Box<UnaryFunc>),
384 Cos(Box<UnaryFunc>),
385 Tan(Box<UnaryFunc>),
386 Asin(Box<UnaryFunc>),
387 Acos(Box<UnaryFunc>),
388 Atan(Box<UnaryFunc>),
389 Atan2(Box<BinaryFunc>),
390 IsNan(Box<UnaryFunc>),
391 IsInf(Box<UnaryFunc>),
392 IntDiv(Box<BinaryFunc>),
393
394 Decode(Box<DecodeFunc>),
396
397 DateFormat(Box<DateFormatFunc>),
399 FormatDate(Box<DateFormatFunc>),
400 Year(Box<UnaryFunc>),
401 Month(Box<UnaryFunc>),
402 Day(Box<UnaryFunc>),
403 Hour(Box<UnaryFunc>),
404 Minute(Box<UnaryFunc>),
405 Second(Box<UnaryFunc>),
406 DayOfWeek(Box<UnaryFunc>),
407 DayOfWeekIso(Box<UnaryFunc>),
408 DayOfMonth(Box<UnaryFunc>),
409 DayOfYear(Box<UnaryFunc>),
410 WeekOfYear(Box<UnaryFunc>),
411 Quarter(Box<UnaryFunc>),
412 AddMonths(Box<BinaryFunc>),
413 MonthsBetween(Box<BinaryFunc>),
414 LastDay(Box<LastDayFunc>),
415 NextDay(Box<BinaryFunc>),
416 Epoch(Box<UnaryFunc>),
417 EpochMs(Box<UnaryFunc>),
418 FromUnixtime(Box<FromUnixtimeFunc>),
419 UnixTimestamp(Box<UnixTimestampFunc>),
420 MakeDate(Box<MakeDateFunc>),
421 MakeTimestamp(Box<MakeTimestampFunc>),
422 TimestampTrunc(Box<DateTruncFunc>),
423 TimeStrToUnix(Box<UnaryFunc>),
424
425 SessionUser(SessionUser),
427
428 SHA(Box<UnaryFunc>),
430 SHA1Digest(Box<UnaryFunc>),
431
432 TimeToUnix(Box<UnaryFunc>),
434
435 ArrayFunc(Box<ArrayConstructor>),
437 ArrayLength(Box<UnaryFunc>),
438 ArraySize(Box<UnaryFunc>),
439 Cardinality(Box<UnaryFunc>),
440 ArrayContains(Box<BinaryFunc>),
441 ArrayPosition(Box<BinaryFunc>),
442 ArrayAppend(Box<BinaryFunc>),
443 ArrayPrepend(Box<BinaryFunc>),
444 ArrayConcat(Box<VarArgFunc>),
445 ArraySort(Box<ArraySortFunc>),
446 ArrayReverse(Box<UnaryFunc>),
447 ArrayDistinct(Box<UnaryFunc>),
448 ArrayJoin(Box<ArrayJoinFunc>),
449 ArrayToString(Box<ArrayJoinFunc>),
450 Unnest(Box<UnnestFunc>),
451 Explode(Box<UnaryFunc>),
452 ExplodeOuter(Box<UnaryFunc>),
453 ArrayFilter(Box<ArrayFilterFunc>),
454 ArrayTransform(Box<ArrayTransformFunc>),
455 ArrayFlatten(Box<UnaryFunc>),
456 ArrayCompact(Box<UnaryFunc>),
457 ArrayIntersect(Box<VarArgFunc>),
458 ArrayUnion(Box<BinaryFunc>),
459 ArrayExcept(Box<BinaryFunc>),
460 ArrayRemove(Box<BinaryFunc>),
461 ArrayZip(Box<VarArgFunc>),
462 Sequence(Box<SequenceFunc>),
463 Generate(Box<SequenceFunc>),
464 ExplodingGenerateSeries(Box<SequenceFunc>),
465 ToArray(Box<UnaryFunc>),
466 StarMap(Box<BinaryFunc>),
467
468 StructFunc(Box<StructConstructor>),
470 StructExtract(Box<StructExtractFunc>),
471 NamedStruct(Box<NamedStructFunc>),
472
473 MapFunc(Box<MapConstructor>),
475 MapFromEntries(Box<UnaryFunc>),
476 MapFromArrays(Box<BinaryFunc>),
477 MapKeys(Box<UnaryFunc>),
478 MapValues(Box<UnaryFunc>),
479 MapContainsKey(Box<BinaryFunc>),
480 MapConcat(Box<VarArgFunc>),
481 ElementAt(Box<BinaryFunc>),
482 TransformKeys(Box<TransformFunc>),
483 TransformValues(Box<TransformFunc>),
484
485 JsonExtract(Box<JsonExtractFunc>),
487 JsonExtractScalar(Box<JsonExtractFunc>),
488 JsonExtractPath(Box<JsonPathFunc>),
489 JsonArray(Box<VarArgFunc>),
490 JsonObject(Box<JsonObjectFunc>),
491 JsonQuery(Box<JsonExtractFunc>),
492 JsonValue(Box<JsonExtractFunc>),
493 JsonArrayLength(Box<UnaryFunc>),
494 JsonKeys(Box<UnaryFunc>),
495 JsonType(Box<UnaryFunc>),
496 ParseJson(Box<UnaryFunc>),
497 ToJson(Box<UnaryFunc>),
498 JsonSet(Box<JsonModifyFunc>),
499 JsonInsert(Box<JsonModifyFunc>),
500 JsonRemove(Box<JsonPathFunc>),
501 JsonMergePatch(Box<BinaryFunc>),
502 JsonArrayAgg(Box<JsonArrayAggFunc>),
503 JsonObjectAgg(Box<JsonObjectAggFunc>),
504
505 Convert(Box<ConvertFunc>),
507 Typeof(Box<UnaryFunc>),
508
509 Lambda(Box<LambdaExpr>),
511 Parameter(Box<Parameter>),
512 Placeholder(Placeholder),
513 NamedArgument(Box<NamedArgument>),
514 TableArgument(Box<TableArgument>),
517 SqlComment(Box<SqlComment>),
518
519 NullSafeEq(Box<BinaryOp>),
521 NullSafeNeq(Box<BinaryOp>),
522 Glob(Box<BinaryOp>),
523 SimilarTo(Box<SimilarToExpr>),
524 Any(Box<QuantifiedExpr>),
525 All(Box<QuantifiedExpr>),
526 Overlaps(Box<OverlapsExpr>),
527
528 BitwiseLeftShift(Box<BinaryOp>),
530 BitwiseRightShift(Box<BinaryOp>),
531 BitwiseAndAgg(Box<AggFunc>),
532 BitwiseOrAgg(Box<AggFunc>),
533 BitwiseXorAgg(Box<AggFunc>),
534
535 Subscript(Box<Subscript>),
537 Dot(Box<DotAccess>),
538 MethodCall(Box<MethodCall>),
539 ArraySlice(Box<ArraySlice>),
540
541 CreateTable(Box<CreateTable>),
543 DropTable(Box<DropTable>),
544 AlterTable(Box<AlterTable>),
545 CreateIndex(Box<CreateIndex>),
546 DropIndex(Box<DropIndex>),
547 CreateView(Box<CreateView>),
548 DropView(Box<DropView>),
549 AlterView(Box<AlterView>),
550 AlterIndex(Box<AlterIndex>),
551 Truncate(Box<Truncate>),
552 Use(Box<Use>),
553 Cache(Box<Cache>),
554 Uncache(Box<Uncache>),
555 LoadData(Box<LoadData>),
556 Pragma(Box<Pragma>),
557 Grant(Box<Grant>),
558 Revoke(Box<Revoke>),
559 Comment(Box<Comment>),
560 SetStatement(Box<SetStatement>),
561 CreateSchema(Box<CreateSchema>),
563 DropSchema(Box<DropSchema>),
564 DropNamespace(Box<DropNamespace>),
565 CreateDatabase(Box<CreateDatabase>),
566 DropDatabase(Box<DropDatabase>),
567 CreateFunction(Box<CreateFunction>),
568 DropFunction(Box<DropFunction>),
569 CreateProcedure(Box<CreateProcedure>),
570 DropProcedure(Box<DropProcedure>),
571 CreateSequence(Box<CreateSequence>),
572 DropSequence(Box<DropSequence>),
573 AlterSequence(Box<AlterSequence>),
574 CreateTrigger(Box<CreateTrigger>),
575 DropTrigger(Box<DropTrigger>),
576 CreateType(Box<CreateType>),
577 DropType(Box<DropType>),
578 Describe(Box<Describe>),
579 Show(Box<Show>),
580
581 Command(Box<Command>),
583 Kill(Box<Kill>),
584 Execute(Box<ExecuteStatement>),
586
587 Raw(Raw),
589
590 Paren(Box<Paren>),
592
593 Annotated(Box<Annotated>),
595
596 Refresh(Box<Refresh>),
599 LockingStatement(Box<LockingStatement>),
600 SequenceProperties(Box<SequenceProperties>),
601 TruncateTable(Box<TruncateTable>),
602 Clone(Box<Clone>),
603 Attach(Box<Attach>),
604 Detach(Box<Detach>),
605 Install(Box<Install>),
606 Summarize(Box<Summarize>),
607 Declare(Box<Declare>),
608 DeclareItem(Box<DeclareItem>),
609 Set(Box<Set>),
610 Heredoc(Box<Heredoc>),
611 SetItem(Box<SetItem>),
612 QueryBand(Box<QueryBand>),
613 UserDefinedFunction(Box<UserDefinedFunction>),
614 RecursiveWithSearch(Box<RecursiveWithSearch>),
615 ProjectionDef(Box<ProjectionDef>),
616 TableAlias(Box<TableAlias>),
617 ByteString(Box<ByteString>),
618 HexStringExpr(Box<HexStringExpr>),
619 UnicodeString(Box<UnicodeString>),
620 ColumnPosition(Box<ColumnPosition>),
621 ColumnDef(Box<ColumnDef>),
622 AlterColumn(Box<AlterColumn>),
623 AlterSortKey(Box<AlterSortKey>),
624 AlterSet(Box<AlterSet>),
625 RenameColumn(Box<RenameColumn>),
626 Comprehension(Box<Comprehension>),
627 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
628 MergeTreeTTL(Box<MergeTreeTTL>),
629 IndexConstraintOption(Box<IndexConstraintOption>),
630 ColumnConstraint(Box<ColumnConstraint>),
631 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
632 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
633 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
634 CheckColumnConstraint(Box<CheckColumnConstraint>),
635 CompressColumnConstraint(Box<CompressColumnConstraint>),
636 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
637 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
638 WithOperator(Box<WithOperator>),
639 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
640 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
641 CommentColumnConstraint(CommentColumnConstraint),
642 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
643 IndexColumnConstraint(Box<IndexColumnConstraint>),
644 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
645 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
646 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
647 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
648 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
649 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
650 InOutColumnConstraint(Box<InOutColumnConstraint>),
651 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
652 PathColumnConstraint(Box<PathColumnConstraint>),
653 Constraint(Box<Constraint>),
654 Export(Box<Export>),
655 Filter(Box<Filter>),
656 Changes(Box<Changes>),
657 CopyParameter(Box<CopyParameter>),
658 Credentials(Box<Credentials>),
659 Directory(Box<Directory>),
660 ForeignKey(Box<ForeignKey>),
661 ColumnPrefix(Box<ColumnPrefix>),
662 PrimaryKey(Box<PrimaryKey>),
663 IntoClause(Box<IntoClause>),
664 JoinHint(Box<JoinHint>),
665 Opclass(Box<Opclass>),
666 Index(Box<Index>),
667 IndexParameters(Box<IndexParameters>),
668 ConditionalInsert(Box<ConditionalInsert>),
669 MultitableInserts(Box<MultitableInserts>),
670 OnConflict(Box<OnConflict>),
671 OnCondition(Box<OnCondition>),
672 Returning(Box<Returning>),
673 Introducer(Box<Introducer>),
674 PartitionRange(Box<PartitionRange>),
675 Fetch(Box<Fetch>),
676 Group(Box<Group>),
677 Cube(Box<Cube>),
678 Rollup(Box<Rollup>),
679 GroupingSets(Box<GroupingSets>),
680 LimitOptions(Box<LimitOptions>),
681 Lateral(Box<Lateral>),
682 TableFromRows(Box<TableFromRows>),
683 RowsFrom(Box<RowsFrom>),
684 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
685 WithFill(Box<WithFill>),
686 Property(Box<Property>),
687 GrantPrivilege(Box<GrantPrivilege>),
688 GrantPrincipal(Box<GrantPrincipal>),
689 AllowedValuesProperty(Box<AllowedValuesProperty>),
690 AlgorithmProperty(Box<AlgorithmProperty>),
691 AutoIncrementProperty(Box<AutoIncrementProperty>),
692 AutoRefreshProperty(Box<AutoRefreshProperty>),
693 BackupProperty(Box<BackupProperty>),
694 BuildProperty(Box<BuildProperty>),
695 BlockCompressionProperty(Box<BlockCompressionProperty>),
696 CharacterSetProperty(Box<CharacterSetProperty>),
697 ChecksumProperty(Box<ChecksumProperty>),
698 CollateProperty(Box<CollateProperty>),
699 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
700 DataDeletionProperty(Box<DataDeletionProperty>),
701 DefinerProperty(Box<DefinerProperty>),
702 DistKeyProperty(Box<DistKeyProperty>),
703 DistributedByProperty(Box<DistributedByProperty>),
704 DistStyleProperty(Box<DistStyleProperty>),
705 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
706 EngineProperty(Box<EngineProperty>),
707 ToTableProperty(Box<ToTableProperty>),
708 ExecuteAsProperty(Box<ExecuteAsProperty>),
709 ExternalProperty(Box<ExternalProperty>),
710 FallbackProperty(Box<FallbackProperty>),
711 FileFormatProperty(Box<FileFormatProperty>),
712 CredentialsProperty(Box<CredentialsProperty>),
713 FreespaceProperty(Box<FreespaceProperty>),
714 InheritsProperty(Box<InheritsProperty>),
715 InputModelProperty(Box<InputModelProperty>),
716 OutputModelProperty(Box<OutputModelProperty>),
717 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
718 JournalProperty(Box<JournalProperty>),
719 LanguageProperty(Box<LanguageProperty>),
720 EnviromentProperty(Box<EnviromentProperty>),
721 ClusteredByProperty(Box<ClusteredByProperty>),
722 DictProperty(Box<DictProperty>),
723 DictRange(Box<DictRange>),
724 OnCluster(Box<OnCluster>),
725 LikeProperty(Box<LikeProperty>),
726 LocationProperty(Box<LocationProperty>),
727 LockProperty(Box<LockProperty>),
728 LockingProperty(Box<LockingProperty>),
729 LogProperty(Box<LogProperty>),
730 MaterializedProperty(Box<MaterializedProperty>),
731 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
732 OnProperty(Box<OnProperty>),
733 OnCommitProperty(Box<OnCommitProperty>),
734 PartitionedByProperty(Box<PartitionedByProperty>),
735 PartitionedByBucket(Box<PartitionedByBucket>),
736 PartitionByTruncate(Box<PartitionByTruncate>),
737 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
738 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
739 PartitionByListProperty(Box<PartitionByListProperty>),
740 PartitionList(Box<PartitionList>),
741 Partition(Box<Partition>),
742 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
743 UniqueKeyProperty(Box<UniqueKeyProperty>),
744 RollupProperty(Box<RollupProperty>),
745 PartitionBoundSpec(Box<PartitionBoundSpec>),
746 PartitionedOfProperty(Box<PartitionedOfProperty>),
747 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
748 ReturnsProperty(Box<ReturnsProperty>),
749 RowFormatProperty(Box<RowFormatProperty>),
750 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
751 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
752 QueryTransform(Box<QueryTransform>),
753 SampleProperty(Box<SampleProperty>),
754 SecurityProperty(Box<SecurityProperty>),
755 SchemaCommentProperty(Box<SchemaCommentProperty>),
756 SemanticView(Box<SemanticView>),
757 SerdeProperties(Box<SerdeProperties>),
758 SetProperty(Box<SetProperty>),
759 SharingProperty(Box<SharingProperty>),
760 SetConfigProperty(Box<SetConfigProperty>),
761 SettingsProperty(Box<SettingsProperty>),
762 SortKeyProperty(Box<SortKeyProperty>),
763 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
764 SqlSecurityProperty(Box<SqlSecurityProperty>),
765 StabilityProperty(Box<StabilityProperty>),
766 StorageHandlerProperty(Box<StorageHandlerProperty>),
767 TemporaryProperty(Box<TemporaryProperty>),
768 Tags(Box<Tags>),
769 TransformModelProperty(Box<TransformModelProperty>),
770 TransientProperty(Box<TransientProperty>),
771 UsingTemplateProperty(Box<UsingTemplateProperty>),
772 ViewAttributeProperty(Box<ViewAttributeProperty>),
773 VolatileProperty(Box<VolatileProperty>),
774 WithDataProperty(Box<WithDataProperty>),
775 WithJournalTableProperty(Box<WithJournalTableProperty>),
776 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
777 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
778 WithProcedureOptions(Box<WithProcedureOptions>),
779 EncodeProperty(Box<EncodeProperty>),
780 IncludeProperty(Box<IncludeProperty>),
781 Properties(Box<Properties>),
782 InputOutputFormat(Box<InputOutputFormat>),
783 Reference(Box<Reference>),
784 QueryOption(Box<QueryOption>),
785 WithTableHint(Box<WithTableHint>),
786 IndexTableHint(Box<IndexTableHint>),
787 HistoricalData(Box<HistoricalData>),
788 Get(Box<Get>),
789 SetOperation(Box<SetOperation>),
790 Var(Box<Var>),
791 Variadic(Box<Variadic>),
792 Version(Box<Version>),
793 Schema(Box<Schema>),
794 Lock(Box<Lock>),
795 TableSample(Box<TableSample>),
796 Tag(Box<Tag>),
797 UnpivotColumns(Box<UnpivotColumns>),
798 WindowSpec(Box<WindowSpec>),
799 SessionParameter(Box<SessionParameter>),
800 PseudoType(Box<PseudoType>),
801 ObjectIdentifier(Box<ObjectIdentifier>),
802 Transaction(Box<Transaction>),
803 Commit(Box<Commit>),
804 Rollback(Box<Rollback>),
805 AlterSession(Box<AlterSession>),
806 Analyze(Box<Analyze>),
807 AnalyzeStatistics(Box<AnalyzeStatistics>),
808 AnalyzeHistogram(Box<AnalyzeHistogram>),
809 AnalyzeSample(Box<AnalyzeSample>),
810 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
811 AnalyzeDelete(Box<AnalyzeDelete>),
812 AnalyzeWith(Box<AnalyzeWith>),
813 AnalyzeValidate(Box<AnalyzeValidate>),
814 AddPartition(Box<AddPartition>),
815 AttachOption(Box<AttachOption>),
816 DropPartition(Box<DropPartition>),
817 ReplacePartition(Box<ReplacePartition>),
818 DPipe(Box<DPipe>),
819 Operator(Box<Operator>),
820 PivotAny(Box<PivotAny>),
821 Aliases(Box<Aliases>),
822 AtIndex(Box<AtIndex>),
823 FromTimeZone(Box<FromTimeZone>),
824 FormatPhrase(Box<FormatPhrase>),
825 ForIn(Box<ForIn>),
826 TimeUnit(Box<TimeUnit>),
827 IntervalOp(Box<IntervalOp>),
828 IntervalSpan(Box<IntervalSpan>),
829 HavingMax(Box<HavingMax>),
830 CosineDistance(Box<CosineDistance>),
831 DotProduct(Box<DotProduct>),
832 EuclideanDistance(Box<EuclideanDistance>),
833 ManhattanDistance(Box<ManhattanDistance>),
834 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
835 Booland(Box<Booland>),
836 Boolor(Box<Boolor>),
837 ParameterizedAgg(Box<ParameterizedAgg>),
838 ArgMax(Box<ArgMax>),
839 ArgMin(Box<ArgMin>),
840 ApproxTopK(Box<ApproxTopK>),
841 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
842 ApproxTopKCombine(Box<ApproxTopKCombine>),
843 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
844 ApproxTopSum(Box<ApproxTopSum>),
845 ApproxQuantiles(Box<ApproxQuantiles>),
846 Minhash(Box<Minhash>),
847 FarmFingerprint(Box<FarmFingerprint>),
848 Float64(Box<Float64>),
849 Transform(Box<Transform>),
850 Translate(Box<Translate>),
851 Grouping(Box<Grouping>),
852 GroupingId(Box<GroupingId>),
853 Anonymous(Box<Anonymous>),
854 AnonymousAggFunc(Box<AnonymousAggFunc>),
855 CombinedAggFunc(Box<CombinedAggFunc>),
856 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
857 HashAgg(Box<HashAgg>),
858 Hll(Box<Hll>),
859 Apply(Box<Apply>),
860 ToBoolean(Box<ToBoolean>),
861 List(Box<List>),
862 ToMap(Box<ToMap>),
863 Pad(Box<Pad>),
864 ToChar(Box<ToChar>),
865 ToNumber(Box<ToNumber>),
866 ToDouble(Box<ToDouble>),
867 Int64(Box<UnaryFunc>),
868 StringFunc(Box<StringFunc>),
869 ToDecfloat(Box<ToDecfloat>),
870 TryToDecfloat(Box<TryToDecfloat>),
871 ToFile(Box<ToFile>),
872 Columns(Box<Columns>),
873 ConvertToCharset(Box<ConvertToCharset>),
874 ConvertTimezone(Box<ConvertTimezone>),
875 GenerateSeries(Box<GenerateSeries>),
876 AIAgg(Box<AIAgg>),
877 AIClassify(Box<AIClassify>),
878 ArrayAll(Box<ArrayAll>),
879 ArrayAny(Box<ArrayAny>),
880 ArrayConstructCompact(Box<ArrayConstructCompact>),
881 StPoint(Box<StPoint>),
882 StDistance(Box<StDistance>),
883 StringToArray(Box<StringToArray>),
884 ArraySum(Box<ArraySum>),
885 ObjectAgg(Box<ObjectAgg>),
886 CastToStrType(Box<CastToStrType>),
887 CheckJson(Box<CheckJson>),
888 CheckXml(Box<CheckXml>),
889 TranslateCharacters(Box<TranslateCharacters>),
890 CurrentSchemas(Box<CurrentSchemas>),
891 CurrentDatetime(Box<CurrentDatetime>),
892 Localtime(Box<Localtime>),
893 Localtimestamp(Box<Localtimestamp>),
894 Systimestamp(Box<Systimestamp>),
895 CurrentSchema(Box<CurrentSchema>),
896 CurrentUser(Box<CurrentUser>),
897 UtcTime(Box<UtcTime>),
898 UtcTimestamp(Box<UtcTimestamp>),
899 Timestamp(Box<TimestampFunc>),
900 DateBin(Box<DateBin>),
901 Datetime(Box<Datetime>),
902 DatetimeAdd(Box<DatetimeAdd>),
903 DatetimeSub(Box<DatetimeSub>),
904 DatetimeDiff(Box<DatetimeDiff>),
905 DatetimeTrunc(Box<DatetimeTrunc>),
906 Dayname(Box<Dayname>),
907 MakeInterval(Box<MakeInterval>),
908 PreviousDay(Box<PreviousDay>),
909 Elt(Box<Elt>),
910 TimestampAdd(Box<TimestampAdd>),
911 TimestampSub(Box<TimestampSub>),
912 TimestampDiff(Box<TimestampDiff>),
913 TimeSlice(Box<TimeSlice>),
914 TimeAdd(Box<TimeAdd>),
915 TimeSub(Box<TimeSub>),
916 TimeDiff(Box<TimeDiff>),
917 TimeTrunc(Box<TimeTrunc>),
918 DateFromParts(Box<DateFromParts>),
919 TimeFromParts(Box<TimeFromParts>),
920 DecodeCase(Box<DecodeCase>),
921 Decrypt(Box<Decrypt>),
922 DecryptRaw(Box<DecryptRaw>),
923 Encode(Box<Encode>),
924 Encrypt(Box<Encrypt>),
925 EncryptRaw(Box<EncryptRaw>),
926 EqualNull(Box<EqualNull>),
927 ToBinary(Box<ToBinary>),
928 Base64DecodeBinary(Box<Base64DecodeBinary>),
929 Base64DecodeString(Box<Base64DecodeString>),
930 Base64Encode(Box<Base64Encode>),
931 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
932 TryBase64DecodeString(Box<TryBase64DecodeString>),
933 GapFill(Box<GapFill>),
934 GenerateDateArray(Box<GenerateDateArray>),
935 GenerateTimestampArray(Box<GenerateTimestampArray>),
936 GetExtract(Box<GetExtract>),
937 Getbit(Box<Getbit>),
938 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
939 HexEncode(Box<HexEncode>),
940 Compress(Box<Compress>),
941 DecompressBinary(Box<DecompressBinary>),
942 DecompressString(Box<DecompressString>),
943 Xor(Box<Xor>),
944 Nullif(Box<Nullif>),
945 JSON(Box<JSON>),
946 JSONPath(Box<JSONPath>),
947 JSONPathFilter(Box<JSONPathFilter>),
948 JSONPathKey(Box<JSONPathKey>),
949 JSONPathRecursive(Box<JSONPathRecursive>),
950 JSONPathScript(Box<JSONPathScript>),
951 JSONPathSlice(Box<JSONPathSlice>),
952 JSONPathSelector(Box<JSONPathSelector>),
953 JSONPathSubscript(Box<JSONPathSubscript>),
954 JSONPathUnion(Box<JSONPathUnion>),
955 Format(Box<Format>),
956 JSONKeys(Box<JSONKeys>),
957 JSONKeyValue(Box<JSONKeyValue>),
958 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
959 JSONObject(Box<JSONObject>),
960 JSONObjectAgg(Box<JSONObjectAgg>),
961 JSONBObjectAgg(Box<JSONBObjectAgg>),
962 JSONArray(Box<JSONArray>),
963 JSONArrayAgg(Box<JSONArrayAgg>),
964 JSONExists(Box<JSONExists>),
965 JSONColumnDef(Box<JSONColumnDef>),
966 JSONSchema(Box<JSONSchema>),
967 JSONSet(Box<JSONSet>),
968 JSONStripNulls(Box<JSONStripNulls>),
969 JSONValue(Box<JSONValue>),
970 JSONValueArray(Box<JSONValueArray>),
971 JSONRemove(Box<JSONRemove>),
972 JSONTable(Box<JSONTable>),
973 JSONType(Box<JSONType>),
974 ObjectInsert(Box<ObjectInsert>),
975 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
976 OpenJSON(Box<OpenJSON>),
977 JSONBExists(Box<JSONBExists>),
978 JSONBContains(Box<BinaryFunc>),
979 JSONBExtract(Box<BinaryFunc>),
980 JSONCast(Box<JSONCast>),
981 JSONExtract(Box<JSONExtract>),
982 JSONExtractQuote(Box<JSONExtractQuote>),
983 JSONExtractArray(Box<JSONExtractArray>),
984 JSONExtractScalar(Box<JSONExtractScalar>),
985 JSONBExtractScalar(Box<JSONBExtractScalar>),
986 JSONFormat(Box<JSONFormat>),
987 JSONBool(Box<UnaryFunc>),
988 JSONPathRoot(JSONPathRoot),
989 JSONArrayAppend(Box<JSONArrayAppend>),
990 JSONArrayContains(Box<JSONArrayContains>),
991 JSONArrayInsert(Box<JSONArrayInsert>),
992 ParseJSON(Box<ParseJSON>),
993 ParseUrl(Box<ParseUrl>),
994 ParseIp(Box<ParseIp>),
995 ParseTime(Box<ParseTime>),
996 ParseDatetime(Box<ParseDatetime>),
997 Map(Box<Map>),
998 MapCat(Box<MapCat>),
999 MapDelete(Box<MapDelete>),
1000 MapInsert(Box<MapInsert>),
1001 MapPick(Box<MapPick>),
1002 ScopeResolution(Box<ScopeResolution>),
1003 Slice(Box<Slice>),
1004 VarMap(Box<VarMap>),
1005 MatchAgainst(Box<MatchAgainst>),
1006 MD5Digest(Box<MD5Digest>),
1007 MD5NumberLower64(Box<UnaryFunc>),
1008 MD5NumberUpper64(Box<UnaryFunc>),
1009 Monthname(Box<Monthname>),
1010 Ntile(Box<Ntile>),
1011 Normalize(Box<Normalize>),
1012 Normal(Box<Normal>),
1013 Predict(Box<Predict>),
1014 MLTranslate(Box<MLTranslate>),
1015 FeaturesAtTime(Box<FeaturesAtTime>),
1016 GenerateEmbedding(Box<GenerateEmbedding>),
1017 MLForecast(Box<MLForecast>),
1018 ModelAttribute(Box<ModelAttribute>),
1019 VectorSearch(Box<VectorSearch>),
1020 Quantile(Box<Quantile>),
1021 ApproxQuantile(Box<ApproxQuantile>),
1022 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1023 Randn(Box<Randn>),
1024 Randstr(Box<Randstr>),
1025 RangeN(Box<RangeN>),
1026 RangeBucket(Box<RangeBucket>),
1027 ReadCSV(Box<ReadCSV>),
1028 ReadParquet(Box<ReadParquet>),
1029 Reduce(Box<Reduce>),
1030 RegexpExtractAll(Box<RegexpExtractAll>),
1031 RegexpILike(Box<RegexpILike>),
1032 RegexpFullMatch(Box<RegexpFullMatch>),
1033 RegexpInstr(Box<RegexpInstr>),
1034 RegexpSplit(Box<RegexpSplit>),
1035 RegexpCount(Box<RegexpCount>),
1036 RegrValx(Box<RegrValx>),
1037 RegrValy(Box<RegrValy>),
1038 RegrAvgy(Box<RegrAvgy>),
1039 RegrAvgx(Box<RegrAvgx>),
1040 RegrCount(Box<RegrCount>),
1041 RegrIntercept(Box<RegrIntercept>),
1042 RegrR2(Box<RegrR2>),
1043 RegrSxx(Box<RegrSxx>),
1044 RegrSxy(Box<RegrSxy>),
1045 RegrSyy(Box<RegrSyy>),
1046 RegrSlope(Box<RegrSlope>),
1047 SafeAdd(Box<SafeAdd>),
1048 SafeDivide(Box<SafeDivide>),
1049 SafeMultiply(Box<SafeMultiply>),
1050 SafeSubtract(Box<SafeSubtract>),
1051 SHA2(Box<SHA2>),
1052 SHA2Digest(Box<SHA2Digest>),
1053 SortArray(Box<SortArray>),
1054 SplitPart(Box<SplitPart>),
1055 SubstringIndex(Box<SubstringIndex>),
1056 StandardHash(Box<StandardHash>),
1057 StrPosition(Box<StrPosition>),
1058 Search(Box<Search>),
1059 SearchIp(Box<SearchIp>),
1060 StrToDate(Box<StrToDate>),
1061 DateStrToDate(Box<UnaryFunc>),
1062 DateToDateStr(Box<UnaryFunc>),
1063 StrToTime(Box<StrToTime>),
1064 StrToUnix(Box<StrToUnix>),
1065 StrToMap(Box<StrToMap>),
1066 NumberToStr(Box<NumberToStr>),
1067 FromBase(Box<FromBase>),
1068 Stuff(Box<Stuff>),
1069 TimeToStr(Box<TimeToStr>),
1070 TimeStrToTime(Box<TimeStrToTime>),
1071 TsOrDsAdd(Box<TsOrDsAdd>),
1072 TsOrDsDiff(Box<TsOrDsDiff>),
1073 TsOrDsToDate(Box<TsOrDsToDate>),
1074 TsOrDsToTime(Box<TsOrDsToTime>),
1075 Unhex(Box<Unhex>),
1076 Uniform(Box<Uniform>),
1077 UnixToStr(Box<UnixToStr>),
1078 UnixToTime(Box<UnixToTime>),
1079 Uuid(Box<Uuid>),
1080 TimestampFromParts(Box<TimestampFromParts>),
1081 TimestampTzFromParts(Box<TimestampTzFromParts>),
1082 Corr(Box<Corr>),
1083 WidthBucket(Box<WidthBucket>),
1084 CovarSamp(Box<CovarSamp>),
1085 CovarPop(Box<CovarPop>),
1086 Week(Box<Week>),
1087 XMLElement(Box<XMLElement>),
1088 XMLGet(Box<XMLGet>),
1089 XMLTable(Box<XMLTable>),
1090 XMLKeyValueOption(Box<XMLKeyValueOption>),
1091 Zipf(Box<Zipf>),
1092 Merge(Box<Merge>),
1093 When(Box<When>),
1094 Whens(Box<Whens>),
1095 NextValueFor(Box<NextValueFor>),
1096 ReturnStmt(Box<Expression>),
1098}
1099
1100impl Expression {
1101 pub fn is_statement(&self) -> bool {
1108 match self {
1109 Expression::Select(_)
1111 | Expression::Union(_)
1112 | Expression::Intersect(_)
1113 | Expression::Except(_)
1114 | Expression::Subquery(_)
1115 | Expression::Values(_)
1116 | Expression::PipeOperator(_)
1117
1118 | Expression::Insert(_)
1120 | Expression::Update(_)
1121 | Expression::Delete(_)
1122 | Expression::Copy(_)
1123 | Expression::Put(_)
1124 | Expression::Merge(_)
1125
1126 | Expression::CreateTable(_)
1128 | Expression::DropTable(_)
1129 | Expression::AlterTable(_)
1130 | Expression::CreateIndex(_)
1131 | Expression::DropIndex(_)
1132 | Expression::CreateView(_)
1133 | Expression::DropView(_)
1134 | Expression::AlterView(_)
1135 | Expression::AlterIndex(_)
1136 | Expression::Truncate(_)
1137 | Expression::TruncateTable(_)
1138 | Expression::CreateSchema(_)
1139 | Expression::DropSchema(_)
1140 | Expression::DropNamespace(_)
1141 | Expression::CreateDatabase(_)
1142 | Expression::DropDatabase(_)
1143 | Expression::CreateFunction(_)
1144 | Expression::DropFunction(_)
1145 | Expression::CreateProcedure(_)
1146 | Expression::DropProcedure(_)
1147 | Expression::CreateSequence(_)
1148 | Expression::DropSequence(_)
1149 | Expression::AlterSequence(_)
1150 | Expression::CreateTrigger(_)
1151 | Expression::DropTrigger(_)
1152 | Expression::CreateType(_)
1153 | Expression::DropType(_)
1154 | Expression::Comment(_)
1155
1156 | Expression::Use(_)
1158 | Expression::Set(_)
1159 | Expression::SetStatement(_)
1160 | Expression::Transaction(_)
1161 | Expression::Commit(_)
1162 | Expression::Rollback(_)
1163 | Expression::Grant(_)
1164 | Expression::Revoke(_)
1165 | Expression::Cache(_)
1166 | Expression::Uncache(_)
1167 | Expression::LoadData(_)
1168 | Expression::Pragma(_)
1169 | Expression::Describe(_)
1170 | Expression::Show(_)
1171 | Expression::Kill(_)
1172 | Expression::Execute(_)
1173 | Expression::Declare(_)
1174 | Expression::Refresh(_)
1175 | Expression::AlterSession(_)
1176 | Expression::LockingStatement(_)
1177
1178 | Expression::Analyze(_)
1180 | Expression::AnalyzeStatistics(_)
1181 | Expression::AnalyzeHistogram(_)
1182 | Expression::AnalyzeSample(_)
1183 | Expression::AnalyzeListChainedRows(_)
1184 | Expression::AnalyzeDelete(_)
1185
1186 | Expression::Attach(_)
1188 | Expression::Detach(_)
1189 | Expression::Install(_)
1190 | Expression::Summarize(_)
1191
1192 | Expression::Pivot(_)
1194 | Expression::Unpivot(_)
1195
1196 | Expression::Command(_)
1198 | Expression::Raw(_)
1199
1200 | Expression::ReturnStmt(_) => true,
1202
1203 Expression::Annotated(a) => a.this.is_statement(),
1205
1206 Expression::Alias(a) => a.this.is_statement(),
1208
1209 _ => false,
1211 }
1212 }
1213
1214 pub fn number(n: i64) -> Self {
1216 Expression::Literal(Literal::Number(n.to_string()))
1217 }
1218
1219 pub fn string(s: impl Into<String>) -> Self {
1221 Expression::Literal(Literal::String(s.into()))
1222 }
1223
1224 pub fn float(f: f64) -> Self {
1226 Expression::Literal(Literal::Number(f.to_string()))
1227 }
1228
1229 pub fn column(name: impl Into<String>) -> Self {
1231 Expression::Column(Column {
1232 name: Identifier::new(name),
1233 table: None,
1234 join_mark: false,
1235 trailing_comments: Vec::new(),
1236 span: None,
1237 })
1238 }
1239
1240 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1242 Expression::Column(Column {
1243 name: Identifier::new(column),
1244 table: Some(Identifier::new(table)),
1245 join_mark: false,
1246 trailing_comments: Vec::new(),
1247 span: None,
1248 })
1249 }
1250
1251 pub fn identifier(name: impl Into<String>) -> Self {
1253 Expression::Identifier(Identifier::new(name))
1254 }
1255
1256 pub fn null() -> Self {
1258 Expression::Null(Null)
1259 }
1260
1261 pub fn true_() -> Self {
1263 Expression::Boolean(BooleanLiteral { value: true })
1264 }
1265
1266 pub fn false_() -> Self {
1268 Expression::Boolean(BooleanLiteral { value: false })
1269 }
1270
1271 pub fn star() -> Self {
1273 Expression::Star(Star {
1274 table: None,
1275 except: None,
1276 replace: None,
1277 rename: None,
1278 trailing_comments: Vec::new(),
1279 span: None,
1280 })
1281 }
1282
1283 pub fn alias(self, name: impl Into<String>) -> Self {
1285 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1286 }
1287
1288 pub fn is_select(&self) -> bool {
1290 matches!(self, Expression::Select(_))
1291 }
1292
1293 pub fn as_select(&self) -> Option<&Select> {
1295 match self {
1296 Expression::Select(s) => Some(s),
1297 _ => None,
1298 }
1299 }
1300
1301 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1303 match self {
1304 Expression::Select(s) => Some(s),
1305 _ => None,
1306 }
1307 }
1308
1309 pub fn sql(&self) -> String {
1314 crate::generator::Generator::sql(self).unwrap_or_default()
1315 }
1316
1317 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1323 crate::generate(self, dialect).unwrap_or_default()
1324 }
1325}
1326
1327impl fmt::Display for Expression {
1328 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1329 match self {
1331 Expression::Literal(lit) => write!(f, "{}", lit),
1332 Expression::Identifier(id) => write!(f, "{}", id),
1333 Expression::Column(col) => write!(f, "{}", col),
1334 Expression::Star(_) => write!(f, "*"),
1335 Expression::Null(_) => write!(f, "NULL"),
1336 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
1337 Expression::Select(_) => write!(f, "SELECT ..."),
1338 _ => write!(f, "{:?}", self),
1339 }
1340 }
1341}
1342
1343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1353#[cfg_attr(feature = "bindings", derive(TS))]
1354#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
1355pub enum Literal {
1356 String(String),
1358 Number(String),
1360 HexString(String),
1362 HexNumber(String),
1364 BitString(String),
1365 ByteString(String),
1367 NationalString(String),
1369 Date(String),
1371 Time(String),
1373 Timestamp(String),
1375 Datetime(String),
1377 TripleQuotedString(String, char),
1380 EscapeString(String),
1382 DollarString(String),
1384 RawString(String),
1388}
1389
1390impl fmt::Display for Literal {
1391 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1392 match self {
1393 Literal::String(s) => write!(f, "'{}'", s),
1394 Literal::Number(n) => write!(f, "{}", n),
1395 Literal::HexString(h) => write!(f, "X'{}'", h),
1396 Literal::HexNumber(h) => write!(f, "0x{}", h),
1397 Literal::BitString(b) => write!(f, "B'{}'", b),
1398 Literal::ByteString(b) => write!(f, "b'{}'", b),
1399 Literal::NationalString(s) => write!(f, "N'{}'", s),
1400 Literal::Date(d) => write!(f, "DATE '{}'", d),
1401 Literal::Time(t) => write!(f, "TIME '{}'", t),
1402 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
1403 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
1404 Literal::TripleQuotedString(s, q) => {
1405 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
1406 }
1407 Literal::EscapeString(s) => write!(f, "E'{}'", s),
1408 Literal::DollarString(s) => write!(f, "$${}$$", s),
1409 Literal::RawString(s) => write!(f, "r'{}'", s),
1410 }
1411 }
1412}
1413
1414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1416#[cfg_attr(feature = "bindings", derive(TS))]
1417pub struct BooleanLiteral {
1418 pub value: bool,
1419}
1420
1421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1423#[cfg_attr(feature = "bindings", derive(TS))]
1424pub struct Null;
1425
1426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1433#[cfg_attr(feature = "bindings", derive(TS))]
1434pub struct Identifier {
1435 pub name: String,
1437 pub quoted: bool,
1439 #[serde(default)]
1440 pub trailing_comments: Vec<String>,
1441 #[serde(default, skip_serializing_if = "Option::is_none")]
1443 pub span: Option<Span>,
1444}
1445
1446impl Identifier {
1447 pub fn new(name: impl Into<String>) -> Self {
1448 Self {
1449 name: name.into(),
1450 quoted: false,
1451 trailing_comments: Vec::new(),
1452 span: None,
1453 }
1454 }
1455
1456 pub fn quoted(name: impl Into<String>) -> Self {
1457 Self {
1458 name: name.into(),
1459 quoted: true,
1460 trailing_comments: Vec::new(),
1461 span: None,
1462 }
1463 }
1464
1465 pub fn empty() -> Self {
1466 Self {
1467 name: String::new(),
1468 quoted: false,
1469 trailing_comments: Vec::new(),
1470 span: None,
1471 }
1472 }
1473
1474 pub fn is_empty(&self) -> bool {
1475 self.name.is_empty()
1476 }
1477
1478 pub fn with_span(mut self, span: Span) -> Self {
1480 self.span = Some(span);
1481 self
1482 }
1483}
1484
1485impl fmt::Display for Identifier {
1486 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1487 if self.quoted {
1488 write!(f, "\"{}\"", self.name)
1489 } else {
1490 write!(f, "{}", self.name)
1491 }
1492 }
1493}
1494
1495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1501#[cfg_attr(feature = "bindings", derive(TS))]
1502pub struct Column {
1503 pub name: Identifier,
1505 pub table: Option<Identifier>,
1507 #[serde(default)]
1509 pub join_mark: bool,
1510 #[serde(default)]
1512 pub trailing_comments: Vec<String>,
1513 #[serde(default, skip_serializing_if = "Option::is_none")]
1515 pub span: Option<Span>,
1516}
1517
1518impl fmt::Display for Column {
1519 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1520 if let Some(table) = &self.table {
1521 write!(f, "{}.{}", table, self.name)
1522 } else {
1523 write!(f, "{}", self.name)
1524 }
1525 }
1526}
1527
1528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1535#[cfg_attr(feature = "bindings", derive(TS))]
1536pub struct TableRef {
1537 pub name: Identifier,
1539 pub schema: Option<Identifier>,
1541 pub catalog: Option<Identifier>,
1543 pub alias: Option<Identifier>,
1545 #[serde(default)]
1547 pub alias_explicit_as: bool,
1548 #[serde(default)]
1550 pub column_aliases: Vec<Identifier>,
1551 #[serde(default)]
1553 pub trailing_comments: Vec<String>,
1554 #[serde(default)]
1556 pub when: Option<Box<HistoricalData>>,
1557 #[serde(default)]
1559 pub only: bool,
1560 #[serde(default)]
1562 pub final_: bool,
1563 #[serde(default, skip_serializing_if = "Option::is_none")]
1565 pub table_sample: Option<Box<Sample>>,
1566 #[serde(default)]
1568 pub hints: Vec<Expression>,
1569 #[serde(default, skip_serializing_if = "Option::is_none")]
1572 pub system_time: Option<String>,
1573 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1575 pub partitions: Vec<Identifier>,
1576 #[serde(default, skip_serializing_if = "Option::is_none")]
1579 pub identifier_func: Option<Box<Expression>>,
1580 #[serde(default, skip_serializing_if = "Option::is_none")]
1582 pub changes: Option<Box<Changes>>,
1583 #[serde(default, skip_serializing_if = "Option::is_none")]
1585 pub version: Option<Box<Version>>,
1586 #[serde(default, skip_serializing_if = "Option::is_none")]
1588 pub span: Option<Span>,
1589}
1590
1591impl TableRef {
1592 pub fn new(name: impl Into<String>) -> Self {
1593 Self {
1594 name: Identifier::new(name),
1595 schema: None,
1596 catalog: None,
1597 alias: None,
1598 alias_explicit_as: false,
1599 column_aliases: Vec::new(),
1600 trailing_comments: Vec::new(),
1601 when: None,
1602 only: false,
1603 final_: false,
1604 table_sample: None,
1605 hints: Vec::new(),
1606 system_time: None,
1607 partitions: Vec::new(),
1608 identifier_func: None,
1609 changes: None,
1610 version: None,
1611 span: None,
1612 }
1613 }
1614
1615 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
1617 let mut t = Self::new(name);
1618 t.schema = Some(Identifier::new(schema));
1619 t
1620 }
1621
1622 pub fn new_with_catalog(
1624 name: impl Into<String>,
1625 schema: impl Into<String>,
1626 catalog: impl Into<String>,
1627 ) -> Self {
1628 let mut t = Self::new(name);
1629 t.schema = Some(Identifier::new(schema));
1630 t.catalog = Some(Identifier::new(catalog));
1631 t
1632 }
1633
1634 pub fn from_identifier(name: Identifier) -> Self {
1636 Self {
1637 name,
1638 schema: None,
1639 catalog: None,
1640 alias: None,
1641 alias_explicit_as: false,
1642 column_aliases: Vec::new(),
1643 trailing_comments: Vec::new(),
1644 when: None,
1645 only: false,
1646 final_: false,
1647 table_sample: None,
1648 hints: Vec::new(),
1649 system_time: None,
1650 partitions: Vec::new(),
1651 identifier_func: None,
1652 changes: None,
1653 version: None,
1654 span: None,
1655 }
1656 }
1657
1658 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
1659 self.alias = Some(Identifier::new(alias));
1660 self
1661 }
1662
1663 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
1664 self.schema = Some(Identifier::new(schema));
1665 self
1666 }
1667}
1668
1669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1674#[cfg_attr(feature = "bindings", derive(TS))]
1675pub struct Star {
1676 pub table: Option<Identifier>,
1678 pub except: Option<Vec<Identifier>>,
1680 pub replace: Option<Vec<Alias>>,
1682 pub rename: Option<Vec<(Identifier, Identifier)>>,
1684 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1686 pub trailing_comments: Vec<String>,
1687 #[serde(default, skip_serializing_if = "Option::is_none")]
1689 pub span: Option<Span>,
1690}
1691
1692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1716#[cfg_attr(feature = "bindings", derive(TS))]
1717pub struct Select {
1718 pub expressions: Vec<Expression>,
1720 pub from: Option<From>,
1722 pub joins: Vec<Join>,
1724 pub lateral_views: Vec<LateralView>,
1725 #[serde(default, skip_serializing_if = "Option::is_none")]
1727 pub prewhere: Option<Expression>,
1728 pub where_clause: Option<Where>,
1729 pub group_by: Option<GroupBy>,
1730 pub having: Option<Having>,
1731 pub qualify: Option<Qualify>,
1732 pub order_by: Option<OrderBy>,
1733 pub distribute_by: Option<DistributeBy>,
1734 pub cluster_by: Option<ClusterBy>,
1735 pub sort_by: Option<SortBy>,
1736 pub limit: Option<Limit>,
1737 pub offset: Option<Offset>,
1738 #[serde(default, skip_serializing_if = "Option::is_none")]
1740 pub limit_by: Option<Vec<Expression>>,
1741 pub fetch: Option<Fetch>,
1742 pub distinct: bool,
1743 pub distinct_on: Option<Vec<Expression>>,
1744 pub top: Option<Top>,
1745 pub with: Option<With>,
1746 pub sample: Option<Sample>,
1747 #[serde(default, skip_serializing_if = "Option::is_none")]
1749 pub settings: Option<Vec<Expression>>,
1750 #[serde(default, skip_serializing_if = "Option::is_none")]
1752 pub format: Option<Expression>,
1753 pub windows: Option<Vec<NamedWindow>>,
1754 pub hint: Option<Hint>,
1755 pub connect: Option<Connect>,
1757 pub into: Option<SelectInto>,
1759 #[serde(default)]
1761 pub locks: Vec<Lock>,
1762 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1764 pub for_xml: Vec<Expression>,
1765 #[serde(default)]
1767 pub leading_comments: Vec<String>,
1768 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1771 pub post_select_comments: Vec<String>,
1772 #[serde(default, skip_serializing_if = "Option::is_none")]
1774 pub kind: Option<String>,
1775 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1777 pub operation_modifiers: Vec<String>,
1778 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
1780 pub qualify_after_window: bool,
1781 #[serde(default, skip_serializing_if = "Option::is_none")]
1783 pub option: Option<String>,
1784}
1785
1786impl Select {
1787 pub fn new() -> Self {
1788 Self {
1789 expressions: Vec::new(),
1790 from: None,
1791 joins: Vec::new(),
1792 lateral_views: Vec::new(),
1793 prewhere: None,
1794 where_clause: None,
1795 group_by: None,
1796 having: None,
1797 qualify: None,
1798 order_by: None,
1799 distribute_by: None,
1800 cluster_by: None,
1801 sort_by: None,
1802 limit: None,
1803 offset: None,
1804 limit_by: None,
1805 fetch: None,
1806 distinct: false,
1807 distinct_on: None,
1808 top: None,
1809 with: None,
1810 sample: None,
1811 settings: None,
1812 format: None,
1813 windows: None,
1814 hint: None,
1815 connect: None,
1816 into: None,
1817 locks: Vec::new(),
1818 for_xml: Vec::new(),
1819 leading_comments: Vec::new(),
1820 post_select_comments: Vec::new(),
1821 kind: None,
1822 operation_modifiers: Vec::new(),
1823 qualify_after_window: false,
1824 option: None,
1825 }
1826 }
1827
1828 pub fn column(mut self, expr: Expression) -> Self {
1830 self.expressions.push(expr);
1831 self
1832 }
1833
1834 pub fn from(mut self, table: Expression) -> Self {
1836 self.from = Some(From {
1837 expressions: vec![table],
1838 });
1839 self
1840 }
1841
1842 pub fn where_(mut self, condition: Expression) -> Self {
1844 self.where_clause = Some(Where { this: condition });
1845 self
1846 }
1847
1848 pub fn distinct(mut self) -> Self {
1850 self.distinct = true;
1851 self
1852 }
1853
1854 pub fn join(mut self, join: Join) -> Self {
1856 self.joins.push(join);
1857 self
1858 }
1859
1860 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
1862 self.order_by = Some(OrderBy {
1863 expressions,
1864 siblings: false,
1865 comments: Vec::new(),
1866 });
1867 self
1868 }
1869
1870 pub fn limit(mut self, n: Expression) -> Self {
1872 self.limit = Some(Limit {
1873 this: n,
1874 percent: false,
1875 comments: Vec::new(),
1876 });
1877 self
1878 }
1879
1880 pub fn offset(mut self, n: Expression) -> Self {
1882 self.offset = Some(Offset {
1883 this: n,
1884 rows: None,
1885 });
1886 self
1887 }
1888}
1889
1890impl Default for Select {
1891 fn default() -> Self {
1892 Self::new()
1893 }
1894}
1895
1896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1902#[cfg_attr(feature = "bindings", derive(TS))]
1903pub struct Union {
1904 pub left: Expression,
1906 pub right: Expression,
1908 pub all: bool,
1910 #[serde(default)]
1912 pub distinct: bool,
1913 pub with: Option<With>,
1915 pub order_by: Option<OrderBy>,
1917 pub limit: Option<Box<Expression>>,
1919 pub offset: Option<Box<Expression>>,
1921 #[serde(default, skip_serializing_if = "Option::is_none")]
1923 pub distribute_by: Option<DistributeBy>,
1924 #[serde(default, skip_serializing_if = "Option::is_none")]
1926 pub sort_by: Option<SortBy>,
1927 #[serde(default, skip_serializing_if = "Option::is_none")]
1929 pub cluster_by: Option<ClusterBy>,
1930 #[serde(default)]
1932 pub by_name: bool,
1933 #[serde(default, skip_serializing_if = "Option::is_none")]
1935 pub side: Option<String>,
1936 #[serde(default, skip_serializing_if = "Option::is_none")]
1938 pub kind: Option<String>,
1939 #[serde(default)]
1941 pub corresponding: bool,
1942 #[serde(default)]
1944 pub strict: bool,
1945 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1947 pub on_columns: Vec<Expression>,
1948}
1949
1950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1955#[cfg_attr(feature = "bindings", derive(TS))]
1956pub struct Intersect {
1957 pub left: Expression,
1959 pub right: Expression,
1961 pub all: bool,
1963 #[serde(default)]
1965 pub distinct: bool,
1966 pub with: Option<With>,
1968 pub order_by: Option<OrderBy>,
1970 pub limit: Option<Box<Expression>>,
1972 pub offset: Option<Box<Expression>>,
1974 #[serde(default, skip_serializing_if = "Option::is_none")]
1976 pub distribute_by: Option<DistributeBy>,
1977 #[serde(default, skip_serializing_if = "Option::is_none")]
1979 pub sort_by: Option<SortBy>,
1980 #[serde(default, skip_serializing_if = "Option::is_none")]
1982 pub cluster_by: Option<ClusterBy>,
1983 #[serde(default)]
1985 pub by_name: bool,
1986 #[serde(default, skip_serializing_if = "Option::is_none")]
1988 pub side: Option<String>,
1989 #[serde(default, skip_serializing_if = "Option::is_none")]
1991 pub kind: Option<String>,
1992 #[serde(default)]
1994 pub corresponding: bool,
1995 #[serde(default)]
1997 pub strict: bool,
1998 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2000 pub on_columns: Vec<Expression>,
2001}
2002
2003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2008#[cfg_attr(feature = "bindings", derive(TS))]
2009pub struct Except {
2010 pub left: Expression,
2012 pub right: Expression,
2014 pub all: bool,
2016 #[serde(default)]
2018 pub distinct: bool,
2019 pub with: Option<With>,
2021 pub order_by: Option<OrderBy>,
2023 pub limit: Option<Box<Expression>>,
2025 pub offset: Option<Box<Expression>>,
2027 #[serde(default, skip_serializing_if = "Option::is_none")]
2029 pub distribute_by: Option<DistributeBy>,
2030 #[serde(default, skip_serializing_if = "Option::is_none")]
2032 pub sort_by: Option<SortBy>,
2033 #[serde(default, skip_serializing_if = "Option::is_none")]
2035 pub cluster_by: Option<ClusterBy>,
2036 #[serde(default)]
2038 pub by_name: bool,
2039 #[serde(default, skip_serializing_if = "Option::is_none")]
2041 pub side: Option<String>,
2042 #[serde(default, skip_serializing_if = "Option::is_none")]
2044 pub kind: Option<String>,
2045 #[serde(default)]
2047 pub corresponding: bool,
2048 #[serde(default)]
2050 pub strict: bool,
2051 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2053 pub on_columns: Vec<Expression>,
2054}
2055
2056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2058#[cfg_attr(feature = "bindings", derive(TS))]
2059pub struct SelectInto {
2060 pub this: Expression,
2062 #[serde(default)]
2064 pub temporary: bool,
2065 #[serde(default)]
2067 pub unlogged: bool,
2068 #[serde(default)]
2070 pub bulk_collect: bool,
2071 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2073 pub expressions: Vec<Expression>,
2074}
2075
2076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2086#[cfg_attr(feature = "bindings", derive(TS))]
2087pub struct Subquery {
2088 pub this: Expression,
2090 pub alias: Option<Identifier>,
2092 pub column_aliases: Vec<Identifier>,
2094 pub order_by: Option<OrderBy>,
2096 pub limit: Option<Limit>,
2098 pub offset: Option<Offset>,
2100 #[serde(default, skip_serializing_if = "Option::is_none")]
2102 pub distribute_by: Option<DistributeBy>,
2103 #[serde(default, skip_serializing_if = "Option::is_none")]
2105 pub sort_by: Option<SortBy>,
2106 #[serde(default, skip_serializing_if = "Option::is_none")]
2108 pub cluster_by: Option<ClusterBy>,
2109 #[serde(default)]
2111 pub lateral: bool,
2112 #[serde(default)]
2116 pub modifiers_inside: bool,
2117 #[serde(default)]
2119 pub trailing_comments: Vec<String>,
2120}
2121
2122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2127#[cfg_attr(feature = "bindings", derive(TS))]
2128pub struct PipeOperator {
2129 pub this: Expression,
2131 pub expression: Expression,
2133}
2134
2135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2137#[cfg_attr(feature = "bindings", derive(TS))]
2138pub struct Values {
2139 pub expressions: Vec<Tuple>,
2141 pub alias: Option<Identifier>,
2143 pub column_aliases: Vec<Identifier>,
2145}
2146
2147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2157#[cfg_attr(feature = "bindings", derive(TS))]
2158pub struct Pivot {
2159 pub this: Expression,
2161 #[serde(default)]
2164 pub expressions: Vec<Expression>,
2165 #[serde(default)]
2167 pub fields: Vec<Expression>,
2168 #[serde(default)]
2170 pub using: Vec<Expression>,
2171 #[serde(default)]
2173 pub group: Option<Box<Expression>>,
2174 #[serde(default)]
2176 pub unpivot: bool,
2177 #[serde(default)]
2179 pub into: Option<Box<Expression>>,
2180 #[serde(default)]
2182 pub alias: Option<Identifier>,
2183 #[serde(default)]
2185 pub include_nulls: Option<bool>,
2186 #[serde(default)]
2188 pub default_on_null: Option<Box<Expression>>,
2189 #[serde(default, skip_serializing_if = "Option::is_none")]
2191 pub with: Option<With>,
2192}
2193
2194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2196#[cfg_attr(feature = "bindings", derive(TS))]
2197pub struct Unpivot {
2198 pub this: Expression,
2199 pub value_column: Identifier,
2200 pub name_column: Identifier,
2201 pub columns: Vec<Expression>,
2202 pub alias: Option<Identifier>,
2203 #[serde(default)]
2205 pub value_column_parenthesized: bool,
2206 #[serde(default)]
2208 pub include_nulls: Option<bool>,
2209 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2211 pub extra_value_columns: Vec<Identifier>,
2212}
2213
2214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2217#[cfg_attr(feature = "bindings", derive(TS))]
2218pub struct PivotAlias {
2219 pub this: Expression,
2220 pub alias: Expression,
2221}
2222
2223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2225#[cfg_attr(feature = "bindings", derive(TS))]
2226pub struct PreWhere {
2227 pub this: Expression,
2228}
2229
2230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2232#[cfg_attr(feature = "bindings", derive(TS))]
2233pub struct Stream {
2234 pub this: Expression,
2235 #[serde(skip_serializing_if = "Option::is_none")]
2236 pub on: Option<Expression>,
2237 #[serde(skip_serializing_if = "Option::is_none")]
2238 pub show_initial_rows: Option<bool>,
2239}
2240
2241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2243#[cfg_attr(feature = "bindings", derive(TS))]
2244pub struct UsingData {
2245 pub this: Expression,
2246}
2247
2248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2250#[cfg_attr(feature = "bindings", derive(TS))]
2251pub struct XmlNamespace {
2252 pub this: Expression,
2253 #[serde(skip_serializing_if = "Option::is_none")]
2254 pub alias: Option<Identifier>,
2255}
2256
2257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2259#[cfg_attr(feature = "bindings", derive(TS))]
2260pub struct RowFormat {
2261 pub delimited: bool,
2262 pub fields_terminated_by: Option<String>,
2263 pub collection_items_terminated_by: Option<String>,
2264 pub map_keys_terminated_by: Option<String>,
2265 pub lines_terminated_by: Option<String>,
2266 pub null_defined_as: Option<String>,
2267}
2268
2269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2271#[cfg_attr(feature = "bindings", derive(TS))]
2272pub struct DirectoryInsert {
2273 pub local: bool,
2274 pub path: String,
2275 pub row_format: Option<RowFormat>,
2276 #[serde(default)]
2278 pub stored_as: Option<String>,
2279}
2280
2281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2283#[cfg_attr(feature = "bindings", derive(TS))]
2284pub struct Insert {
2285 pub table: TableRef,
2286 pub columns: Vec<Identifier>,
2287 pub values: Vec<Vec<Expression>>,
2288 pub query: Option<Expression>,
2289 pub overwrite: bool,
2291 pub partition: Vec<(Identifier, Option<Expression>)>,
2293 #[serde(default)]
2295 pub directory: Option<DirectoryInsert>,
2296 #[serde(default)]
2298 pub returning: Vec<Expression>,
2299 #[serde(default)]
2301 pub output: Option<OutputClause>,
2302 #[serde(default)]
2304 pub on_conflict: Option<Box<Expression>>,
2305 #[serde(default)]
2307 pub leading_comments: Vec<String>,
2308 #[serde(default)]
2310 pub if_exists: bool,
2311 #[serde(default)]
2313 pub with: Option<With>,
2314 #[serde(default)]
2316 pub ignore: bool,
2317 #[serde(default)]
2319 pub source_alias: Option<Identifier>,
2320 #[serde(default)]
2322 pub alias: Option<Identifier>,
2323 #[serde(default)]
2325 pub alias_explicit_as: bool,
2326 #[serde(default)]
2328 pub default_values: bool,
2329 #[serde(default)]
2331 pub by_name: bool,
2332 #[serde(default, skip_serializing_if = "Option::is_none")]
2334 pub conflict_action: Option<String>,
2335 #[serde(default)]
2337 pub is_replace: bool,
2338 #[serde(default, skip_serializing_if = "Option::is_none")]
2340 pub hint: Option<Hint>,
2341 #[serde(default)]
2343 pub replace_where: Option<Box<Expression>>,
2344 #[serde(default)]
2346 pub source: Option<Box<Expression>>,
2347 #[serde(default, skip_serializing_if = "Option::is_none")]
2349 pub function_target: Option<Box<Expression>>,
2350 #[serde(default, skip_serializing_if = "Option::is_none")]
2352 pub partition_by: Option<Box<Expression>>,
2353 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2355 pub settings: Vec<Expression>,
2356}
2357
2358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2360#[cfg_attr(feature = "bindings", derive(TS))]
2361pub struct OutputClause {
2362 pub columns: Vec<Expression>,
2364 #[serde(default)]
2366 pub into_table: Option<Expression>,
2367}
2368
2369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2371#[cfg_attr(feature = "bindings", derive(TS))]
2372pub struct Update {
2373 pub table: TableRef,
2374 #[serde(default)]
2376 pub extra_tables: Vec<TableRef>,
2377 #[serde(default)]
2379 pub table_joins: Vec<Join>,
2380 pub set: Vec<(Identifier, Expression)>,
2381 pub from_clause: Option<From>,
2382 #[serde(default)]
2384 pub from_joins: Vec<Join>,
2385 pub where_clause: Option<Where>,
2386 #[serde(default)]
2388 pub returning: Vec<Expression>,
2389 #[serde(default)]
2391 pub output: Option<OutputClause>,
2392 #[serde(default)]
2394 pub with: Option<With>,
2395 #[serde(default)]
2397 pub leading_comments: Vec<String>,
2398 #[serde(default)]
2400 pub limit: Option<Expression>,
2401 #[serde(default)]
2403 pub order_by: Option<OrderBy>,
2404 #[serde(default)]
2406 pub from_before_set: bool,
2407}
2408
2409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2411#[cfg_attr(feature = "bindings", derive(TS))]
2412pub struct Delete {
2413 pub table: TableRef,
2414 #[serde(default, skip_serializing_if = "Option::is_none")]
2416 pub on_cluster: Option<OnCluster>,
2417 pub alias: Option<Identifier>,
2419 #[serde(default)]
2421 pub alias_explicit_as: bool,
2422 pub using: Vec<TableRef>,
2424 pub where_clause: Option<Where>,
2425 #[serde(default)]
2427 pub output: Option<OutputClause>,
2428 #[serde(default)]
2430 pub leading_comments: Vec<String>,
2431 #[serde(default)]
2433 pub with: Option<With>,
2434 #[serde(default)]
2436 pub limit: Option<Expression>,
2437 #[serde(default)]
2439 pub order_by: Option<OrderBy>,
2440 #[serde(default)]
2442 pub returning: Vec<Expression>,
2443 #[serde(default)]
2446 pub tables: Vec<TableRef>,
2447 #[serde(default)]
2450 pub tables_from_using: bool,
2451 #[serde(default)]
2453 pub joins: Vec<Join>,
2454 #[serde(default)]
2456 pub force_index: Option<String>,
2457 #[serde(default)]
2459 pub no_from: bool,
2460}
2461
2462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2464#[cfg_attr(feature = "bindings", derive(TS))]
2465pub struct CopyStmt {
2466 pub this: Expression,
2468 pub kind: bool,
2470 pub files: Vec<Expression>,
2472 #[serde(default)]
2474 pub params: Vec<CopyParameter>,
2475 #[serde(default)]
2477 pub credentials: Option<Box<Credentials>>,
2478 #[serde(default)]
2480 pub is_into: bool,
2481 #[serde(default)]
2483 pub with_wrapped: bool,
2484}
2485
2486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2488#[cfg_attr(feature = "bindings", derive(TS))]
2489pub struct CopyParameter {
2490 pub name: String,
2491 pub value: Option<Expression>,
2492 pub values: Vec<Expression>,
2493 #[serde(default)]
2495 pub eq: bool,
2496}
2497
2498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2500#[cfg_attr(feature = "bindings", derive(TS))]
2501pub struct Credentials {
2502 pub credentials: Vec<(String, String)>,
2503 pub encryption: Option<String>,
2504 pub storage: Option<String>,
2505}
2506
2507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2509#[cfg_attr(feature = "bindings", derive(TS))]
2510pub struct PutStmt {
2511 pub source: String,
2513 #[serde(default)]
2515 pub source_quoted: bool,
2516 pub target: Expression,
2518 #[serde(default)]
2520 pub params: Vec<CopyParameter>,
2521}
2522
2523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2525#[cfg_attr(feature = "bindings", derive(TS))]
2526pub struct StageReference {
2527 pub name: String,
2529 #[serde(default)]
2531 pub path: Option<String>,
2532 #[serde(default)]
2534 pub file_format: Option<Expression>,
2535 #[serde(default)]
2537 pub pattern: Option<String>,
2538 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2540 pub quoted: bool,
2541}
2542
2543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2545#[cfg_attr(feature = "bindings", derive(TS))]
2546pub struct HistoricalData {
2547 pub this: Box<Expression>,
2549 pub kind: String,
2551 pub expression: Box<Expression>,
2553}
2554
2555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2560#[cfg_attr(feature = "bindings", derive(TS))]
2561pub struct Alias {
2562 pub this: Expression,
2564 pub alias: Identifier,
2566 #[serde(default)]
2568 pub column_aliases: Vec<Identifier>,
2569 #[serde(default)]
2571 pub pre_alias_comments: Vec<String>,
2572 #[serde(default)]
2574 pub trailing_comments: Vec<String>,
2575}
2576
2577impl Alias {
2578 pub fn new(this: Expression, alias: Identifier) -> Self {
2580 Self {
2581 this,
2582 alias,
2583 column_aliases: Vec::new(),
2584 pre_alias_comments: Vec::new(),
2585 trailing_comments: Vec::new(),
2586 }
2587 }
2588
2589 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
2591 Self {
2592 this,
2593 alias: Identifier::empty(),
2594 column_aliases,
2595 pre_alias_comments: Vec::new(),
2596 trailing_comments: Vec::new(),
2597 }
2598 }
2599}
2600
2601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2608#[cfg_attr(feature = "bindings", derive(TS))]
2609pub struct Cast {
2610 pub this: Expression,
2612 pub to: DataType,
2614 #[serde(default)]
2615 pub trailing_comments: Vec<String>,
2616 #[serde(default)]
2618 pub double_colon_syntax: bool,
2619 #[serde(skip_serializing_if = "Option::is_none", default)]
2621 pub format: Option<Box<Expression>>,
2622 #[serde(skip_serializing_if = "Option::is_none", default)]
2624 pub default: Option<Box<Expression>>,
2625}
2626
2627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2629#[cfg_attr(feature = "bindings", derive(TS))]
2630pub struct CollationExpr {
2631 pub this: Expression,
2632 pub collation: String,
2633 #[serde(default)]
2635 pub quoted: bool,
2636 #[serde(default)]
2638 pub double_quoted: bool,
2639}
2640
2641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2647#[cfg_attr(feature = "bindings", derive(TS))]
2648pub struct Case {
2649 pub operand: Option<Expression>,
2651 pub whens: Vec<(Expression, Expression)>,
2653 pub else_: Option<Expression>,
2655 #[serde(default)]
2657 #[serde(skip_serializing_if = "Vec::is_empty")]
2658 pub comments: Vec<String>,
2659}
2660
2661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2669#[cfg_attr(feature = "bindings", derive(TS))]
2670pub struct BinaryOp {
2671 pub left: Expression,
2672 pub right: Expression,
2673 #[serde(default)]
2675 pub left_comments: Vec<String>,
2676 #[serde(default)]
2678 pub operator_comments: Vec<String>,
2679 #[serde(default)]
2681 pub trailing_comments: Vec<String>,
2682}
2683
2684impl BinaryOp {
2685 pub fn new(left: Expression, right: Expression) -> Self {
2686 Self {
2687 left,
2688 right,
2689 left_comments: Vec::new(),
2690 operator_comments: Vec::new(),
2691 trailing_comments: Vec::new(),
2692 }
2693 }
2694}
2695
2696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2698#[cfg_attr(feature = "bindings", derive(TS))]
2699pub struct LikeOp {
2700 pub left: Expression,
2701 pub right: Expression,
2702 #[serde(default)]
2704 pub escape: Option<Expression>,
2705 #[serde(default)]
2707 pub quantifier: Option<String>,
2708}
2709
2710impl LikeOp {
2711 pub fn new(left: Expression, right: Expression) -> Self {
2712 Self {
2713 left,
2714 right,
2715 escape: None,
2716 quantifier: None,
2717 }
2718 }
2719
2720 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
2721 Self {
2722 left,
2723 right,
2724 escape: Some(escape),
2725 quantifier: None,
2726 }
2727 }
2728}
2729
2730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2734#[cfg_attr(feature = "bindings", derive(TS))]
2735pub struct UnaryOp {
2736 pub this: Expression,
2738}
2739
2740impl UnaryOp {
2741 pub fn new(this: Expression) -> Self {
2742 Self { this }
2743 }
2744}
2745
2746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2751#[cfg_attr(feature = "bindings", derive(TS))]
2752pub struct In {
2753 pub this: Expression,
2755 pub expressions: Vec<Expression>,
2757 pub query: Option<Expression>,
2759 pub not: bool,
2761 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2762 pub global: bool,
2763 #[serde(default, skip_serializing_if = "Option::is_none")]
2765 pub unnest: Option<Box<Expression>>,
2766 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
2770 pub is_field: bool,
2771}
2772
2773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2775#[cfg_attr(feature = "bindings", derive(TS))]
2776pub struct Between {
2777 pub this: Expression,
2779 pub low: Expression,
2781 pub high: Expression,
2783 pub not: bool,
2785 #[serde(default)]
2787 pub symmetric: Option<bool>,
2788}
2789
2790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2792#[cfg_attr(feature = "bindings", derive(TS))]
2793pub struct IsNull {
2794 pub this: Expression,
2795 pub not: bool,
2796 #[serde(default)]
2798 pub postfix_form: bool,
2799}
2800
2801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2803#[cfg_attr(feature = "bindings", derive(TS))]
2804pub struct IsTrueFalse {
2805 pub this: Expression,
2806 pub not: bool,
2807}
2808
2809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2812#[cfg_attr(feature = "bindings", derive(TS))]
2813pub struct IsJson {
2814 pub this: Expression,
2815 pub json_type: Option<String>,
2817 pub unique_keys: Option<JsonUniqueKeys>,
2819 pub negated: bool,
2821}
2822
2823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2825#[cfg_attr(feature = "bindings", derive(TS))]
2826pub enum JsonUniqueKeys {
2827 With,
2829 Without,
2831 Shorthand,
2833}
2834
2835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2837#[cfg_attr(feature = "bindings", derive(TS))]
2838pub struct Exists {
2839 pub this: Expression,
2841 pub not: bool,
2843}
2844
2845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2852#[cfg_attr(feature = "bindings", derive(TS))]
2853pub struct Function {
2854 pub name: String,
2856 pub args: Vec<Expression>,
2858 pub distinct: bool,
2860 #[serde(default)]
2861 pub trailing_comments: Vec<String>,
2862 #[serde(default)]
2864 pub use_bracket_syntax: bool,
2865 #[serde(default)]
2867 pub no_parens: bool,
2868 #[serde(default)]
2870 pub quoted: bool,
2871 #[serde(default, skip_serializing_if = "Option::is_none")]
2873 pub span: Option<Span>,
2874}
2875
2876impl Default for Function {
2877 fn default() -> Self {
2878 Self {
2879 name: String::new(),
2880 args: Vec::new(),
2881 distinct: false,
2882 trailing_comments: Vec::new(),
2883 use_bracket_syntax: false,
2884 no_parens: false,
2885 quoted: false,
2886 span: None,
2887 }
2888 }
2889}
2890
2891impl Function {
2892 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
2893 Self {
2894 name: name.into(),
2895 args,
2896 distinct: false,
2897 trailing_comments: Vec::new(),
2898 use_bracket_syntax: false,
2899 no_parens: false,
2900 quoted: false,
2901 span: None,
2902 }
2903 }
2904}
2905
2906#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
2913#[cfg_attr(feature = "bindings", derive(TS))]
2914pub struct AggregateFunction {
2915 pub name: String,
2917 pub args: Vec<Expression>,
2919 pub distinct: bool,
2921 pub filter: Option<Expression>,
2923 #[serde(default, skip_serializing_if = "Vec::is_empty")]
2925 pub order_by: Vec<Ordered>,
2926 #[serde(default, skip_serializing_if = "Option::is_none")]
2928 pub limit: Option<Box<Expression>>,
2929 #[serde(default, skip_serializing_if = "Option::is_none")]
2931 pub ignore_nulls: Option<bool>,
2932}
2933
2934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2941#[cfg_attr(feature = "bindings", derive(TS))]
2942pub struct WindowFunction {
2943 pub this: Expression,
2945 pub over: Over,
2947 #[serde(default, skip_serializing_if = "Option::is_none")]
2949 pub keep: Option<Keep>,
2950}
2951
2952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2955#[cfg_attr(feature = "bindings", derive(TS))]
2956pub struct Keep {
2957 pub first: bool,
2959 pub order_by: Vec<Ordered>,
2961}
2962
2963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2965#[cfg_attr(feature = "bindings", derive(TS))]
2966pub struct WithinGroup {
2967 pub this: Expression,
2969 pub order_by: Vec<Ordered>,
2971}
2972
2973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2978#[cfg_attr(feature = "bindings", derive(TS))]
2979pub struct From {
2980 pub expressions: Vec<Expression>,
2982}
2983
2984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2990#[cfg_attr(feature = "bindings", derive(TS))]
2991pub struct Join {
2992 pub this: Expression,
2994 pub on: Option<Expression>,
2996 pub using: Vec<Identifier>,
2998 pub kind: JoinKind,
3000 pub use_inner_keyword: bool,
3002 pub use_outer_keyword: bool,
3004 pub deferred_condition: bool,
3006 #[serde(default, skip_serializing_if = "Option::is_none")]
3008 pub join_hint: Option<String>,
3009 #[serde(default, skip_serializing_if = "Option::is_none")]
3011 pub match_condition: Option<Expression>,
3012 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3014 pub pivots: Vec<Expression>,
3015 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3017 pub comments: Vec<String>,
3018 #[serde(default)]
3022 pub nesting_group: usize,
3023 #[serde(default)]
3025 pub directed: bool,
3026}
3027
3028#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3035#[cfg_attr(feature = "bindings", derive(TS))]
3036pub enum JoinKind {
3037 Inner,
3038 Left,
3039 Right,
3040 Full,
3041 Outer, Cross,
3043 Natural,
3044 NaturalLeft,
3045 NaturalRight,
3046 NaturalFull,
3047 Semi,
3048 Anti,
3049 LeftSemi,
3051 LeftAnti,
3052 RightSemi,
3053 RightAnti,
3054 CrossApply,
3056 OuterApply,
3057 AsOf,
3059 AsOfLeft,
3060 AsOfRight,
3061 Lateral,
3063 LeftLateral,
3064 Straight,
3066 Implicit,
3068 Array,
3070 LeftArray,
3071 Paste,
3073}
3074
3075impl Default for JoinKind {
3076 fn default() -> Self {
3077 JoinKind::Inner
3078 }
3079}
3080
3081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3084#[cfg_attr(feature = "bindings", derive(TS))]
3085pub struct JoinedTable {
3086 pub left: Expression,
3088 pub joins: Vec<Join>,
3090 pub lateral_views: Vec<LateralView>,
3092 pub alias: Option<Identifier>,
3094}
3095
3096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3098#[cfg_attr(feature = "bindings", derive(TS))]
3099pub struct Where {
3100 pub this: Expression,
3102}
3103
3104#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3109#[cfg_attr(feature = "bindings", derive(TS))]
3110pub struct GroupBy {
3111 pub expressions: Vec<Expression>,
3113 #[serde(default)]
3115 pub all: Option<bool>,
3116 #[serde(default)]
3118 pub totals: bool,
3119 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3121 pub comments: Vec<String>,
3122}
3123
3124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3126#[cfg_attr(feature = "bindings", derive(TS))]
3127pub struct Having {
3128 pub this: Expression,
3130 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3132 pub comments: Vec<String>,
3133}
3134
3135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3137#[cfg_attr(feature = "bindings", derive(TS))]
3138pub struct OrderBy {
3139 pub expressions: Vec<Ordered>,
3141 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3143 pub siblings: bool,
3144 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3146 pub comments: Vec<String>,
3147}
3148
3149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3156#[cfg_attr(feature = "bindings", derive(TS))]
3157pub struct Ordered {
3158 pub this: Expression,
3160 pub desc: bool,
3162 pub nulls_first: Option<bool>,
3164 #[serde(default)]
3166 pub explicit_asc: bool,
3167 #[serde(default, skip_serializing_if = "Option::is_none")]
3169 pub with_fill: Option<Box<WithFill>>,
3170}
3171
3172impl Ordered {
3173 pub fn asc(expr: Expression) -> Self {
3174 Self {
3175 this: expr,
3176 desc: false,
3177 nulls_first: None,
3178 explicit_asc: false,
3179 with_fill: None,
3180 }
3181 }
3182
3183 pub fn desc(expr: Expression) -> Self {
3184 Self {
3185 this: expr,
3186 desc: true,
3187 nulls_first: None,
3188 explicit_asc: false,
3189 with_fill: None,
3190 }
3191 }
3192}
3193
3194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3197#[cfg_attr(feature = "bindings", derive(TS))]
3198#[cfg_attr(feature = "bindings", ts(export))]
3199pub struct DistributeBy {
3200 pub expressions: Vec<Expression>,
3201}
3202
3203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3206#[cfg_attr(feature = "bindings", derive(TS))]
3207#[cfg_attr(feature = "bindings", ts(export))]
3208pub struct ClusterBy {
3209 pub expressions: Vec<Ordered>,
3210}
3211
3212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3215#[cfg_attr(feature = "bindings", derive(TS))]
3216#[cfg_attr(feature = "bindings", ts(export))]
3217pub struct SortBy {
3218 pub expressions: Vec<Ordered>,
3219}
3220
3221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3224#[cfg_attr(feature = "bindings", derive(TS))]
3225#[cfg_attr(feature = "bindings", ts(export))]
3226pub struct LateralView {
3227 pub this: Expression,
3229 pub table_alias: Option<Identifier>,
3231 pub column_aliases: Vec<Identifier>,
3233 pub outer: bool,
3235}
3236
3237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3239#[cfg_attr(feature = "bindings", derive(TS))]
3240#[cfg_attr(feature = "bindings", ts(export))]
3241pub struct Hint {
3242 pub expressions: Vec<HintExpression>,
3243}
3244
3245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3247#[cfg_attr(feature = "bindings", derive(TS))]
3248#[cfg_attr(feature = "bindings", ts(export))]
3249pub enum HintExpression {
3250 Function { name: String, args: Vec<Expression> },
3252 Identifier(String),
3254 Raw(String),
3256}
3257
3258#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3260#[cfg_attr(feature = "bindings", derive(TS))]
3261#[cfg_attr(feature = "bindings", ts(export))]
3262pub enum PseudocolumnType {
3263 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
3270
3271impl PseudocolumnType {
3272 pub fn as_str(&self) -> &'static str {
3273 match self {
3274 PseudocolumnType::Rownum => "ROWNUM",
3275 PseudocolumnType::Rowid => "ROWID",
3276 PseudocolumnType::Level => "LEVEL",
3277 PseudocolumnType::Sysdate => "SYSDATE",
3278 PseudocolumnType::ObjectId => "OBJECT_ID",
3279 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
3280 }
3281 }
3282
3283 pub fn from_str(s: &str) -> Option<Self> {
3284 match s.to_uppercase().as_str() {
3285 "ROWNUM" => Some(PseudocolumnType::Rownum),
3286 "ROWID" => Some(PseudocolumnType::Rowid),
3287 "LEVEL" => Some(PseudocolumnType::Level),
3288 "SYSDATE" => Some(PseudocolumnType::Sysdate),
3289 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
3290 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
3291 _ => None,
3292 }
3293 }
3294}
3295
3296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3299#[cfg_attr(feature = "bindings", derive(TS))]
3300#[cfg_attr(feature = "bindings", ts(export))]
3301pub struct Pseudocolumn {
3302 pub kind: PseudocolumnType,
3303}
3304
3305impl Pseudocolumn {
3306 pub fn rownum() -> Self {
3307 Self {
3308 kind: PseudocolumnType::Rownum,
3309 }
3310 }
3311
3312 pub fn rowid() -> Self {
3313 Self {
3314 kind: PseudocolumnType::Rowid,
3315 }
3316 }
3317
3318 pub fn level() -> Self {
3319 Self {
3320 kind: PseudocolumnType::Level,
3321 }
3322 }
3323}
3324
3325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3327#[cfg_attr(feature = "bindings", derive(TS))]
3328#[cfg_attr(feature = "bindings", ts(export))]
3329pub struct Connect {
3330 pub start: Option<Expression>,
3332 pub connect: Expression,
3334 pub nocycle: bool,
3336}
3337
3338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3340#[cfg_attr(feature = "bindings", derive(TS))]
3341#[cfg_attr(feature = "bindings", ts(export))]
3342pub struct Prior {
3343 pub this: Expression,
3344}
3345
3346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3348#[cfg_attr(feature = "bindings", derive(TS))]
3349#[cfg_attr(feature = "bindings", ts(export))]
3350pub struct ConnectByRoot {
3351 pub this: Expression,
3352}
3353
3354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3356#[cfg_attr(feature = "bindings", derive(TS))]
3357#[cfg_attr(feature = "bindings", ts(export))]
3358pub struct MatchRecognize {
3359 pub this: Option<Box<Expression>>,
3361 pub partition_by: Option<Vec<Expression>>,
3363 pub order_by: Option<Vec<Ordered>>,
3365 pub measures: Option<Vec<MatchRecognizeMeasure>>,
3367 pub rows: Option<MatchRecognizeRows>,
3369 pub after: Option<MatchRecognizeAfter>,
3371 pub pattern: Option<String>,
3373 pub define: Option<Vec<(Identifier, Expression)>>,
3375 pub alias: Option<Identifier>,
3377 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3379 pub alias_explicit_as: bool,
3380}
3381
3382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3384#[cfg_attr(feature = "bindings", derive(TS))]
3385#[cfg_attr(feature = "bindings", ts(export))]
3386pub struct MatchRecognizeMeasure {
3387 pub this: Expression,
3389 pub window_frame: Option<MatchRecognizeSemantics>,
3391}
3392
3393#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3395#[cfg_attr(feature = "bindings", derive(TS))]
3396#[cfg_attr(feature = "bindings", ts(export))]
3397pub enum MatchRecognizeSemantics {
3398 Running,
3399 Final,
3400}
3401
3402#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
3404#[cfg_attr(feature = "bindings", derive(TS))]
3405#[cfg_attr(feature = "bindings", ts(export))]
3406pub enum MatchRecognizeRows {
3407 OneRowPerMatch,
3408 AllRowsPerMatch,
3409 AllRowsPerMatchShowEmptyMatches,
3410 AllRowsPerMatchOmitEmptyMatches,
3411 AllRowsPerMatchWithUnmatchedRows,
3412}
3413
3414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3416#[cfg_attr(feature = "bindings", derive(TS))]
3417#[cfg_attr(feature = "bindings", ts(export))]
3418pub enum MatchRecognizeAfter {
3419 PastLastRow,
3420 ToNextRow,
3421 ToFirst(Identifier),
3422 ToLast(Identifier),
3423}
3424
3425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3427#[cfg_attr(feature = "bindings", derive(TS))]
3428pub struct Limit {
3429 pub this: Expression,
3431 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3433 pub percent: bool,
3434 #[serde(default)]
3436 #[serde(skip_serializing_if = "Vec::is_empty")]
3437 pub comments: Vec<String>,
3438}
3439
3440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3442#[cfg_attr(feature = "bindings", derive(TS))]
3443pub struct Offset {
3444 pub this: Expression,
3445 #[serde(skip_serializing_if = "Option::is_none", default)]
3447 pub rows: Option<bool>,
3448}
3449
3450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3452#[cfg_attr(feature = "bindings", derive(TS))]
3453pub struct Top {
3454 pub this: Expression,
3455 pub percent: bool,
3456 pub with_ties: bool,
3457 #[serde(default)]
3459 pub parenthesized: bool,
3460}
3461
3462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3464#[cfg_attr(feature = "bindings", derive(TS))]
3465pub struct Fetch {
3466 pub direction: String,
3468 pub count: Option<Expression>,
3470 pub percent: bool,
3472 pub rows: bool,
3474 pub with_ties: bool,
3476}
3477
3478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3484#[cfg_attr(feature = "bindings", derive(TS))]
3485pub struct Qualify {
3486 pub this: Expression,
3488}
3489
3490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3492#[cfg_attr(feature = "bindings", derive(TS))]
3493pub struct Sample {
3494 pub method: SampleMethod,
3495 pub size: Expression,
3496 pub seed: Option<Expression>,
3497 #[serde(default)]
3499 pub offset: Option<Expression>,
3500 pub unit_after_size: bool,
3502 #[serde(default)]
3504 pub use_sample_keyword: bool,
3505 #[serde(default)]
3507 pub explicit_method: bool,
3508 #[serde(default)]
3510 pub method_before_size: bool,
3511 #[serde(default)]
3513 pub use_seed_keyword: bool,
3514 pub bucket_numerator: Option<Box<Expression>>,
3516 pub bucket_denominator: Option<Box<Expression>>,
3518 pub bucket_field: Option<Box<Expression>>,
3520 #[serde(default)]
3522 pub is_using_sample: bool,
3523 #[serde(default)]
3525 pub is_percent: bool,
3526 #[serde(default)]
3528 pub suppress_method_output: bool,
3529}
3530
3531#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3533#[cfg_attr(feature = "bindings", derive(TS))]
3534pub enum SampleMethod {
3535 Bernoulli,
3536 System,
3537 Block,
3538 Row,
3539 Percent,
3540 Bucket,
3542 Reservoir,
3544}
3545
3546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3548#[cfg_attr(feature = "bindings", derive(TS))]
3549pub struct NamedWindow {
3550 pub name: Identifier,
3551 pub spec: Over,
3552}
3553
3554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3560#[cfg_attr(feature = "bindings", derive(TS))]
3561pub struct With {
3562 pub ctes: Vec<Cte>,
3564 pub recursive: bool,
3566 #[serde(default)]
3568 pub leading_comments: Vec<String>,
3569 #[serde(default, skip_serializing_if = "Option::is_none")]
3571 pub search: Option<Box<Expression>>,
3572}
3573
3574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3581#[cfg_attr(feature = "bindings", derive(TS))]
3582pub struct Cte {
3583 pub alias: Identifier,
3585 pub this: Expression,
3587 pub columns: Vec<Identifier>,
3589 pub materialized: Option<bool>,
3591 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3593 pub key_expressions: Vec<Identifier>,
3594 #[serde(default)]
3596 pub alias_first: bool,
3597 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3599 pub comments: Vec<String>,
3600}
3601
3602#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3604#[cfg_attr(feature = "bindings", derive(TS))]
3605pub struct WindowSpec {
3606 pub partition_by: Vec<Expression>,
3607 pub order_by: Vec<Ordered>,
3608 pub frame: Option<WindowFrame>,
3609}
3610
3611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3613#[cfg_attr(feature = "bindings", derive(TS))]
3614pub struct Over {
3615 pub window_name: Option<Identifier>,
3617 pub partition_by: Vec<Expression>,
3618 pub order_by: Vec<Ordered>,
3619 pub frame: Option<WindowFrame>,
3620 pub alias: Option<Identifier>,
3621}
3622
3623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3625#[cfg_attr(feature = "bindings", derive(TS))]
3626pub struct WindowFrame {
3627 pub kind: WindowFrameKind,
3628 pub start: WindowFrameBound,
3629 pub end: Option<WindowFrameBound>,
3630 pub exclude: Option<WindowFrameExclude>,
3631 #[serde(default, skip_serializing_if = "Option::is_none")]
3633 pub kind_text: Option<String>,
3634 #[serde(default, skip_serializing_if = "Option::is_none")]
3636 pub start_side_text: Option<String>,
3637 #[serde(default, skip_serializing_if = "Option::is_none")]
3639 pub end_side_text: Option<String>,
3640}
3641
3642#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3643#[cfg_attr(feature = "bindings", derive(TS))]
3644pub enum WindowFrameKind {
3645 Rows,
3646 Range,
3647 Groups,
3648}
3649
3650#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
3652#[cfg_attr(feature = "bindings", derive(TS))]
3653pub enum WindowFrameExclude {
3654 CurrentRow,
3655 Group,
3656 Ties,
3657 NoOthers,
3658}
3659
3660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3661#[cfg_attr(feature = "bindings", derive(TS))]
3662pub enum WindowFrameBound {
3663 CurrentRow,
3664 UnboundedPreceding,
3665 UnboundedFollowing,
3666 Preceding(Box<Expression>),
3667 Following(Box<Expression>),
3668 BarePreceding,
3670 BareFollowing,
3672 Value(Box<Expression>),
3674}
3675
3676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3678#[cfg_attr(feature = "bindings", derive(TS))]
3679pub struct StructField {
3680 pub name: String,
3681 pub data_type: DataType,
3682 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3683 pub options: Vec<Expression>,
3684 #[serde(default, skip_serializing_if = "Option::is_none")]
3685 pub comment: Option<String>,
3686}
3687
3688impl StructField {
3689 pub fn new(name: String, data_type: DataType) -> Self {
3691 Self {
3692 name,
3693 data_type,
3694 options: Vec::new(),
3695 comment: None,
3696 }
3697 }
3698
3699 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
3701 Self {
3702 name,
3703 data_type,
3704 options,
3705 comment: None,
3706 }
3707 }
3708
3709 pub fn with_options_and_comment(
3711 name: String,
3712 data_type: DataType,
3713 options: Vec<Expression>,
3714 comment: Option<String>,
3715 ) -> Self {
3716 Self {
3717 name,
3718 data_type,
3719 options,
3720 comment,
3721 }
3722 }
3723}
3724
3725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3737#[cfg_attr(feature = "bindings", derive(TS))]
3738#[serde(tag = "data_type", rename_all = "snake_case")]
3739pub enum DataType {
3740 Boolean,
3742 TinyInt {
3743 length: Option<u32>,
3744 },
3745 SmallInt {
3746 length: Option<u32>,
3747 },
3748 Int {
3752 length: Option<u32>,
3753 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3754 integer_spelling: bool,
3755 },
3756 BigInt {
3757 length: Option<u32>,
3758 },
3759 Float {
3763 precision: Option<u32>,
3764 scale: Option<u32>,
3765 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3766 real_spelling: bool,
3767 },
3768 Double {
3769 precision: Option<u32>,
3770 scale: Option<u32>,
3771 },
3772 Decimal {
3773 precision: Option<u32>,
3774 scale: Option<u32>,
3775 },
3776
3777 Char {
3779 length: Option<u32>,
3780 },
3781 VarChar {
3784 length: Option<u32>,
3785 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3786 parenthesized_length: bool,
3787 },
3788 String {
3790 length: Option<u32>,
3791 },
3792 Text,
3793 TextWithLength {
3795 length: u32,
3796 },
3797
3798 Binary {
3800 length: Option<u32>,
3801 },
3802 VarBinary {
3803 length: Option<u32>,
3804 },
3805 Blob,
3806
3807 Bit {
3809 length: Option<u32>,
3810 },
3811 VarBit {
3812 length: Option<u32>,
3813 },
3814
3815 Date,
3817 Time {
3818 precision: Option<u32>,
3819 #[serde(default)]
3820 timezone: bool,
3821 },
3822 Timestamp {
3823 precision: Option<u32>,
3824 timezone: bool,
3825 },
3826 Interval {
3827 unit: Option<String>,
3828 #[serde(default, skip_serializing_if = "Option::is_none")]
3830 to: Option<String>,
3831 },
3832
3833 Json,
3835 JsonB,
3836
3837 Uuid,
3839
3840 Array {
3842 element_type: Box<DataType>,
3843 #[serde(default, skip_serializing_if = "Option::is_none")]
3845 dimension: Option<u32>,
3846 },
3847
3848 List {
3851 element_type: Box<DataType>,
3852 },
3853
3854 Struct {
3858 fields: Vec<StructField>,
3859 nested: bool,
3860 },
3861 Map {
3862 key_type: Box<DataType>,
3863 value_type: Box<DataType>,
3864 },
3865
3866 Enum {
3868 values: Vec<String>,
3869 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3870 assignments: Vec<Option<String>>,
3871 },
3872
3873 Set {
3875 values: Vec<String>,
3876 },
3877
3878 Union {
3880 fields: Vec<(String, DataType)>,
3881 },
3882
3883 Vector {
3885 #[serde(default)]
3886 element_type: Option<Box<DataType>>,
3887 dimension: Option<u32>,
3888 },
3889
3890 Object {
3893 fields: Vec<(String, DataType, bool)>,
3894 modifier: Option<String>,
3895 },
3896
3897 Nullable {
3899 inner: Box<DataType>,
3900 },
3901
3902 Custom {
3904 name: String,
3905 },
3906
3907 Geometry {
3909 subtype: Option<String>,
3910 srid: Option<u32>,
3911 },
3912 Geography {
3913 subtype: Option<String>,
3914 srid: Option<u32>,
3915 },
3916
3917 CharacterSet {
3920 name: String,
3921 },
3922
3923 Unknown,
3925}
3926
3927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3929#[cfg_attr(feature = "bindings", derive(TS))]
3930#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
3931pub struct Array {
3932 pub expressions: Vec<Expression>,
3933}
3934
3935#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3937#[cfg_attr(feature = "bindings", derive(TS))]
3938pub struct Struct {
3939 pub fields: Vec<(Option<String>, Expression)>,
3940}
3941
3942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3944#[cfg_attr(feature = "bindings", derive(TS))]
3945pub struct Tuple {
3946 pub expressions: Vec<Expression>,
3947}
3948
3949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3951#[cfg_attr(feature = "bindings", derive(TS))]
3952pub struct Interval {
3953 pub this: Option<Expression>,
3955 pub unit: Option<IntervalUnitSpec>,
3957}
3958
3959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3961#[cfg_attr(feature = "bindings", derive(TS))]
3962#[serde(tag = "type", rename_all = "snake_case")]
3963pub enum IntervalUnitSpec {
3964 Simple {
3966 unit: IntervalUnit,
3967 use_plural: bool,
3969 },
3970 Span(IntervalSpan),
3972 ExprSpan(IntervalSpanExpr),
3975 Expr(Box<Expression>),
3977}
3978
3979#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3981#[cfg_attr(feature = "bindings", derive(TS))]
3982pub struct IntervalSpan {
3983 pub this: IntervalUnit,
3985 pub expression: IntervalUnit,
3987}
3988
3989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3992#[cfg_attr(feature = "bindings", derive(TS))]
3993pub struct IntervalSpanExpr {
3994 pub this: Box<Expression>,
3996 pub expression: Box<Expression>,
3998}
3999
4000#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4001#[cfg_attr(feature = "bindings", derive(TS))]
4002pub enum IntervalUnit {
4003 Year,
4004 Quarter,
4005 Month,
4006 Week,
4007 Day,
4008 Hour,
4009 Minute,
4010 Second,
4011 Millisecond,
4012 Microsecond,
4013 Nanosecond,
4014}
4015
4016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4018#[cfg_attr(feature = "bindings", derive(TS))]
4019pub struct Command {
4020 pub this: String,
4022}
4023
4024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4027#[cfg_attr(feature = "bindings", derive(TS))]
4028pub struct ExecuteStatement {
4029 pub this: Expression,
4031 #[serde(default)]
4033 pub parameters: Vec<ExecuteParameter>,
4034}
4035
4036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4038#[cfg_attr(feature = "bindings", derive(TS))]
4039pub struct ExecuteParameter {
4040 pub name: String,
4042 pub value: Expression,
4044}
4045
4046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4049#[cfg_attr(feature = "bindings", derive(TS))]
4050pub struct Kill {
4051 pub this: Expression,
4053 pub kind: Option<String>,
4055}
4056
4057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4059#[cfg_attr(feature = "bindings", derive(TS))]
4060pub struct Raw {
4061 pub sql: String,
4062}
4063
4064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4070#[cfg_attr(feature = "bindings", derive(TS))]
4071pub struct UnaryFunc {
4072 pub this: Expression,
4073 #[serde(skip_serializing_if = "Option::is_none", default)]
4075 pub original_name: Option<String>,
4076}
4077
4078impl UnaryFunc {
4079 pub fn new(this: Expression) -> Self {
4081 Self {
4082 this,
4083 original_name: None,
4084 }
4085 }
4086
4087 pub fn with_name(this: Expression, name: String) -> Self {
4089 Self {
4090 this,
4091 original_name: Some(name),
4092 }
4093 }
4094}
4095
4096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4100#[cfg_attr(feature = "bindings", derive(TS))]
4101pub struct CharFunc {
4102 pub args: Vec<Expression>,
4103 #[serde(skip_serializing_if = "Option::is_none", default)]
4104 pub charset: Option<String>,
4105 #[serde(skip_serializing_if = "Option::is_none", default)]
4107 pub name: Option<String>,
4108}
4109
4110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4112#[cfg_attr(feature = "bindings", derive(TS))]
4113pub struct BinaryFunc {
4114 pub this: Expression,
4115 pub expression: Expression,
4116 #[serde(skip_serializing_if = "Option::is_none", default)]
4118 pub original_name: Option<String>,
4119}
4120
4121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4123#[cfg_attr(feature = "bindings", derive(TS))]
4124pub struct VarArgFunc {
4125 pub expressions: Vec<Expression>,
4126 #[serde(skip_serializing_if = "Option::is_none", default)]
4128 pub original_name: Option<String>,
4129}
4130
4131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4133#[cfg_attr(feature = "bindings", derive(TS))]
4134pub struct ConcatWs {
4135 pub separator: Expression,
4136 pub expressions: Vec<Expression>,
4137}
4138
4139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4141#[cfg_attr(feature = "bindings", derive(TS))]
4142pub struct SubstringFunc {
4143 pub this: Expression,
4144 pub start: Expression,
4145 pub length: Option<Expression>,
4146 #[serde(default)]
4148 pub from_for_syntax: bool,
4149}
4150
4151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4153#[cfg_attr(feature = "bindings", derive(TS))]
4154pub struct OverlayFunc {
4155 pub this: Expression,
4156 pub replacement: Expression,
4157 pub from: Expression,
4158 pub length: Option<Expression>,
4159}
4160
4161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4163#[cfg_attr(feature = "bindings", derive(TS))]
4164pub struct TrimFunc {
4165 pub this: Expression,
4166 pub characters: Option<Expression>,
4167 pub position: TrimPosition,
4168 #[serde(default)]
4170 pub sql_standard_syntax: bool,
4171 #[serde(default)]
4173 pub position_explicit: bool,
4174}
4175
4176#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4177#[cfg_attr(feature = "bindings", derive(TS))]
4178pub enum TrimPosition {
4179 Both,
4180 Leading,
4181 Trailing,
4182}
4183
4184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4186#[cfg_attr(feature = "bindings", derive(TS))]
4187pub struct ReplaceFunc {
4188 pub this: Expression,
4189 pub old: Expression,
4190 pub new: Expression,
4191}
4192
4193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4195#[cfg_attr(feature = "bindings", derive(TS))]
4196pub struct LeftRightFunc {
4197 pub this: Expression,
4198 pub length: Expression,
4199}
4200
4201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4203#[cfg_attr(feature = "bindings", derive(TS))]
4204pub struct RepeatFunc {
4205 pub this: Expression,
4206 pub times: Expression,
4207}
4208
4209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4211#[cfg_attr(feature = "bindings", derive(TS))]
4212pub struct PadFunc {
4213 pub this: Expression,
4214 pub length: Expression,
4215 pub fill: Option<Expression>,
4216}
4217
4218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4220#[cfg_attr(feature = "bindings", derive(TS))]
4221pub struct SplitFunc {
4222 pub this: Expression,
4223 pub delimiter: Expression,
4224}
4225
4226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4228#[cfg_attr(feature = "bindings", derive(TS))]
4229pub struct RegexpFunc {
4230 pub this: Expression,
4231 pub pattern: Expression,
4232 pub flags: Option<Expression>,
4233}
4234
4235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4237#[cfg_attr(feature = "bindings", derive(TS))]
4238pub struct RegexpReplaceFunc {
4239 pub this: Expression,
4240 pub pattern: Expression,
4241 pub replacement: Expression,
4242 pub flags: Option<Expression>,
4243}
4244
4245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4247#[cfg_attr(feature = "bindings", derive(TS))]
4248pub struct RegexpExtractFunc {
4249 pub this: Expression,
4250 pub pattern: Expression,
4251 pub group: Option<Expression>,
4252}
4253
4254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4256#[cfg_attr(feature = "bindings", derive(TS))]
4257pub struct RoundFunc {
4258 pub this: Expression,
4259 pub decimals: Option<Expression>,
4260}
4261
4262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4264#[cfg_attr(feature = "bindings", derive(TS))]
4265pub struct FloorFunc {
4266 pub this: Expression,
4267 pub scale: Option<Expression>,
4268 #[serde(skip_serializing_if = "Option::is_none", default)]
4270 pub to: Option<Expression>,
4271}
4272
4273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4275#[cfg_attr(feature = "bindings", derive(TS))]
4276pub struct CeilFunc {
4277 pub this: Expression,
4278 #[serde(skip_serializing_if = "Option::is_none", default)]
4279 pub decimals: Option<Expression>,
4280 #[serde(skip_serializing_if = "Option::is_none", default)]
4282 pub to: Option<Expression>,
4283}
4284
4285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4287#[cfg_attr(feature = "bindings", derive(TS))]
4288pub struct LogFunc {
4289 pub this: Expression,
4290 pub base: Option<Expression>,
4291}
4292
4293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4295#[cfg_attr(feature = "bindings", derive(TS))]
4296pub struct CurrentDate;
4297
4298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4300#[cfg_attr(feature = "bindings", derive(TS))]
4301pub struct CurrentTime {
4302 pub precision: Option<u32>,
4303}
4304
4305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4307#[cfg_attr(feature = "bindings", derive(TS))]
4308pub struct CurrentTimestamp {
4309 pub precision: Option<u32>,
4310 #[serde(default)]
4312 pub sysdate: bool,
4313}
4314
4315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4317#[cfg_attr(feature = "bindings", derive(TS))]
4318pub struct CurrentTimestampLTZ {
4319 pub precision: Option<u32>,
4320}
4321
4322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4324#[cfg_attr(feature = "bindings", derive(TS))]
4325pub struct AtTimeZone {
4326 pub this: Expression,
4328 pub zone: Expression,
4330}
4331
4332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4334#[cfg_attr(feature = "bindings", derive(TS))]
4335pub struct DateAddFunc {
4336 pub this: Expression,
4337 pub interval: Expression,
4338 pub unit: IntervalUnit,
4339}
4340
4341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4343#[cfg_attr(feature = "bindings", derive(TS))]
4344pub struct DateDiffFunc {
4345 pub this: Expression,
4346 pub expression: Expression,
4347 pub unit: Option<IntervalUnit>,
4348}
4349
4350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4352#[cfg_attr(feature = "bindings", derive(TS))]
4353pub struct DateTruncFunc {
4354 pub this: Expression,
4355 pub unit: DateTimeField,
4356}
4357
4358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4360#[cfg_attr(feature = "bindings", derive(TS))]
4361pub struct ExtractFunc {
4362 pub this: Expression,
4363 pub field: DateTimeField,
4364}
4365
4366#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
4367#[cfg_attr(feature = "bindings", derive(TS))]
4368pub enum DateTimeField {
4369 Year,
4370 Month,
4371 Day,
4372 Hour,
4373 Minute,
4374 Second,
4375 Millisecond,
4376 Microsecond,
4377 DayOfWeek,
4378 DayOfYear,
4379 Week,
4380 WeekWithModifier(String),
4382 Quarter,
4383 Epoch,
4384 Timezone,
4385 TimezoneHour,
4386 TimezoneMinute,
4387 Date,
4388 Time,
4389 Custom(String),
4391}
4392
4393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4395#[cfg_attr(feature = "bindings", derive(TS))]
4396pub struct ToDateFunc {
4397 pub this: Expression,
4398 pub format: Option<Expression>,
4399}
4400
4401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4403#[cfg_attr(feature = "bindings", derive(TS))]
4404pub struct ToTimestampFunc {
4405 pub this: Expression,
4406 pub format: Option<Expression>,
4407}
4408
4409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4411#[cfg_attr(feature = "bindings", derive(TS))]
4412pub struct IfFunc {
4413 pub condition: Expression,
4414 pub true_value: Expression,
4415 pub false_value: Option<Expression>,
4416 #[serde(skip_serializing_if = "Option::is_none", default)]
4418 pub original_name: Option<String>,
4419}
4420
4421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4423#[cfg_attr(feature = "bindings", derive(TS))]
4424pub struct Nvl2Func {
4425 pub this: Expression,
4426 pub true_value: Expression,
4427 pub false_value: Expression,
4428}
4429
4430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4436#[cfg_attr(feature = "bindings", derive(TS))]
4437pub struct AggFunc {
4438 pub this: Expression,
4439 pub distinct: bool,
4440 pub filter: Option<Expression>,
4441 pub order_by: Vec<Ordered>,
4442 #[serde(skip_serializing_if = "Option::is_none", default)]
4444 pub name: Option<String>,
4445 #[serde(skip_serializing_if = "Option::is_none", default)]
4447 pub ignore_nulls: Option<bool>,
4448 #[serde(skip_serializing_if = "Option::is_none", default)]
4451 pub having_max: Option<(Box<Expression>, bool)>,
4452 #[serde(skip_serializing_if = "Option::is_none", default)]
4454 pub limit: Option<Box<Expression>>,
4455}
4456
4457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4459#[cfg_attr(feature = "bindings", derive(TS))]
4460pub struct CountFunc {
4461 pub this: Option<Expression>,
4462 pub star: bool,
4463 pub distinct: bool,
4464 pub filter: Option<Expression>,
4465 #[serde(default, skip_serializing_if = "Option::is_none")]
4467 pub ignore_nulls: Option<bool>,
4468 #[serde(default, skip_serializing_if = "Option::is_none")]
4470 pub original_name: Option<String>,
4471}
4472
4473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4475#[cfg_attr(feature = "bindings", derive(TS))]
4476pub struct GroupConcatFunc {
4477 pub this: Expression,
4478 pub separator: Option<Expression>,
4479 pub order_by: Option<Vec<Ordered>>,
4480 pub distinct: bool,
4481 pub filter: Option<Expression>,
4482}
4483
4484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4486#[cfg_attr(feature = "bindings", derive(TS))]
4487pub struct StringAggFunc {
4488 pub this: Expression,
4489 #[serde(default)]
4490 pub separator: Option<Expression>,
4491 #[serde(default)]
4492 pub order_by: Option<Vec<Ordered>>,
4493 #[serde(default)]
4494 pub distinct: bool,
4495 #[serde(default)]
4496 pub filter: Option<Expression>,
4497 #[serde(default, skip_serializing_if = "Option::is_none")]
4499 pub limit: Option<Box<Expression>>,
4500}
4501
4502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4504#[cfg_attr(feature = "bindings", derive(TS))]
4505pub struct ListAggFunc {
4506 pub this: Expression,
4507 pub separator: Option<Expression>,
4508 pub on_overflow: Option<ListAggOverflow>,
4509 pub order_by: Option<Vec<Ordered>>,
4510 pub distinct: bool,
4511 pub filter: Option<Expression>,
4512}
4513
4514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4516#[cfg_attr(feature = "bindings", derive(TS))]
4517pub enum ListAggOverflow {
4518 Error,
4519 Truncate {
4520 filler: Option<Expression>,
4521 with_count: bool,
4522 },
4523}
4524
4525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4527#[cfg_attr(feature = "bindings", derive(TS))]
4528pub struct SumIfFunc {
4529 pub this: Expression,
4530 pub condition: Expression,
4531 pub filter: Option<Expression>,
4532}
4533
4534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4536#[cfg_attr(feature = "bindings", derive(TS))]
4537pub struct ApproxPercentileFunc {
4538 pub this: Expression,
4539 pub percentile: Expression,
4540 pub accuracy: Option<Expression>,
4541 pub filter: Option<Expression>,
4542}
4543
4544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4546#[cfg_attr(feature = "bindings", derive(TS))]
4547pub struct PercentileFunc {
4548 pub this: Expression,
4549 pub percentile: Expression,
4550 pub order_by: Option<Vec<Ordered>>,
4551 pub filter: Option<Expression>,
4552}
4553
4554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4560#[cfg_attr(feature = "bindings", derive(TS))]
4561pub struct RowNumber;
4562
4563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4565#[cfg_attr(feature = "bindings", derive(TS))]
4566pub struct Rank {
4567 #[serde(default, skip_serializing_if = "Option::is_none")]
4569 pub order_by: Option<Vec<Ordered>>,
4570 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4572 pub args: Vec<Expression>,
4573}
4574
4575#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4577#[cfg_attr(feature = "bindings", derive(TS))]
4578pub struct DenseRank {
4579 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4581 pub args: Vec<Expression>,
4582}
4583
4584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4586#[cfg_attr(feature = "bindings", derive(TS))]
4587pub struct NTileFunc {
4588 #[serde(default, skip_serializing_if = "Option::is_none")]
4590 pub num_buckets: Option<Expression>,
4591 #[serde(default, skip_serializing_if = "Option::is_none")]
4593 pub order_by: Option<Vec<Ordered>>,
4594}
4595
4596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4598#[cfg_attr(feature = "bindings", derive(TS))]
4599pub struct LeadLagFunc {
4600 pub this: Expression,
4601 pub offset: Option<Expression>,
4602 pub default: Option<Expression>,
4603 pub ignore_nulls: bool,
4604}
4605
4606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4608#[cfg_attr(feature = "bindings", derive(TS))]
4609pub struct ValueFunc {
4610 pub this: Expression,
4611 #[serde(default, skip_serializing_if = "Option::is_none")]
4613 pub ignore_nulls: Option<bool>,
4614}
4615
4616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4618#[cfg_attr(feature = "bindings", derive(TS))]
4619pub struct NthValueFunc {
4620 pub this: Expression,
4621 pub offset: Expression,
4622 #[serde(default, skip_serializing_if = "Option::is_none")]
4624 pub ignore_nulls: Option<bool>,
4625 #[serde(default, skip_serializing_if = "Option::is_none")]
4628 pub from_first: Option<bool>,
4629}
4630
4631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4633#[cfg_attr(feature = "bindings", derive(TS))]
4634pub struct PercentRank {
4635 #[serde(default, skip_serializing_if = "Option::is_none")]
4637 pub order_by: Option<Vec<Ordered>>,
4638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4640 pub args: Vec<Expression>,
4641}
4642
4643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4645#[cfg_attr(feature = "bindings", derive(TS))]
4646pub struct CumeDist {
4647 #[serde(default, skip_serializing_if = "Option::is_none")]
4649 pub order_by: Option<Vec<Ordered>>,
4650 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4652 pub args: Vec<Expression>,
4653}
4654
4655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4661#[cfg_attr(feature = "bindings", derive(TS))]
4662pub struct PositionFunc {
4663 pub substring: Expression,
4664 pub string: Expression,
4665 pub start: Option<Expression>,
4666}
4667
4668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4674#[cfg_attr(feature = "bindings", derive(TS))]
4675pub struct Random;
4676
4677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4679#[cfg_attr(feature = "bindings", derive(TS))]
4680pub struct Rand {
4681 pub seed: Option<Box<Expression>>,
4682 #[serde(default)]
4684 pub lower: Option<Box<Expression>>,
4685 #[serde(default)]
4687 pub upper: Option<Box<Expression>>,
4688}
4689
4690#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4692#[cfg_attr(feature = "bindings", derive(TS))]
4693pub struct TruncateFunc {
4694 pub this: Expression,
4695 pub decimals: Option<Expression>,
4696}
4697
4698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4700#[cfg_attr(feature = "bindings", derive(TS))]
4701pub struct Pi;
4702
4703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4709#[cfg_attr(feature = "bindings", derive(TS))]
4710pub struct DecodeFunc {
4711 pub this: Expression,
4712 pub search_results: Vec<(Expression, Expression)>,
4713 pub default: Option<Expression>,
4714}
4715
4716#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4722#[cfg_attr(feature = "bindings", derive(TS))]
4723pub struct DateFormatFunc {
4724 pub this: Expression,
4725 pub format: Expression,
4726}
4727
4728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4730#[cfg_attr(feature = "bindings", derive(TS))]
4731pub struct FromUnixtimeFunc {
4732 pub this: Expression,
4733 pub format: Option<Expression>,
4734}
4735
4736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4738#[cfg_attr(feature = "bindings", derive(TS))]
4739pub struct UnixTimestampFunc {
4740 pub this: Option<Expression>,
4741 pub format: Option<Expression>,
4742}
4743
4744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4746#[cfg_attr(feature = "bindings", derive(TS))]
4747pub struct MakeDateFunc {
4748 pub year: Expression,
4749 pub month: Expression,
4750 pub day: Expression,
4751}
4752
4753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4755#[cfg_attr(feature = "bindings", derive(TS))]
4756pub struct MakeTimestampFunc {
4757 pub year: Expression,
4758 pub month: Expression,
4759 pub day: Expression,
4760 pub hour: Expression,
4761 pub minute: Expression,
4762 pub second: Expression,
4763 pub timezone: Option<Expression>,
4764}
4765
4766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4768#[cfg_attr(feature = "bindings", derive(TS))]
4769pub struct LastDayFunc {
4770 pub this: Expression,
4771 #[serde(skip_serializing_if = "Option::is_none", default)]
4773 pub unit: Option<DateTimeField>,
4774}
4775
4776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4782#[cfg_attr(feature = "bindings", derive(TS))]
4783pub struct ArrayConstructor {
4784 pub expressions: Vec<Expression>,
4785 pub bracket_notation: bool,
4786 pub use_list_keyword: bool,
4788}
4789
4790#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4792#[cfg_attr(feature = "bindings", derive(TS))]
4793pub struct ArraySortFunc {
4794 pub this: Expression,
4795 pub comparator: Option<Expression>,
4796 pub desc: bool,
4797 pub nulls_first: Option<bool>,
4798}
4799
4800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4802#[cfg_attr(feature = "bindings", derive(TS))]
4803pub struct ArrayJoinFunc {
4804 pub this: Expression,
4805 pub separator: Expression,
4806 pub null_replacement: Option<Expression>,
4807}
4808
4809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4811#[cfg_attr(feature = "bindings", derive(TS))]
4812pub struct UnnestFunc {
4813 pub this: Expression,
4814 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4816 pub expressions: Vec<Expression>,
4817 pub with_ordinality: bool,
4818 pub alias: Option<Identifier>,
4819 #[serde(default, skip_serializing_if = "Option::is_none")]
4821 pub offset_alias: Option<Identifier>,
4822}
4823
4824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4826#[cfg_attr(feature = "bindings", derive(TS))]
4827pub struct ArrayFilterFunc {
4828 pub this: Expression,
4829 pub filter: Expression,
4830}
4831
4832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4834#[cfg_attr(feature = "bindings", derive(TS))]
4835pub struct ArrayTransformFunc {
4836 pub this: Expression,
4837 pub transform: Expression,
4838}
4839
4840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4842#[cfg_attr(feature = "bindings", derive(TS))]
4843pub struct SequenceFunc {
4844 pub start: Expression,
4845 pub stop: Expression,
4846 pub step: Option<Expression>,
4847}
4848
4849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4855#[cfg_attr(feature = "bindings", derive(TS))]
4856pub struct StructConstructor {
4857 pub fields: Vec<(Option<Identifier>, Expression)>,
4858}
4859
4860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4862#[cfg_attr(feature = "bindings", derive(TS))]
4863pub struct StructExtractFunc {
4864 pub this: Expression,
4865 pub field: Identifier,
4866}
4867
4868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4870#[cfg_attr(feature = "bindings", derive(TS))]
4871pub struct NamedStructFunc {
4872 pub pairs: Vec<(Expression, Expression)>,
4873}
4874
4875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4881#[cfg_attr(feature = "bindings", derive(TS))]
4882pub struct MapConstructor {
4883 pub keys: Vec<Expression>,
4884 pub values: Vec<Expression>,
4885 #[serde(default)]
4887 pub curly_brace_syntax: bool,
4888 #[serde(default)]
4890 pub with_map_keyword: bool,
4891}
4892
4893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4895#[cfg_attr(feature = "bindings", derive(TS))]
4896pub struct TransformFunc {
4897 pub this: Expression,
4898 pub transform: Expression,
4899}
4900
4901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4907#[cfg_attr(feature = "bindings", derive(TS))]
4908pub struct JsonExtractFunc {
4909 pub this: Expression,
4910 pub path: Expression,
4911 pub returning: Option<DataType>,
4912 #[serde(default)]
4914 pub arrow_syntax: bool,
4915 #[serde(default)]
4917 pub hash_arrow_syntax: bool,
4918 #[serde(default)]
4920 pub wrapper_option: Option<String>,
4921 #[serde(default)]
4923 pub quotes_option: Option<String>,
4924 #[serde(default)]
4926 pub on_scalar_string: bool,
4927 #[serde(default)]
4929 pub on_error: Option<String>,
4930}
4931
4932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4934#[cfg_attr(feature = "bindings", derive(TS))]
4935pub struct JsonPathFunc {
4936 pub this: Expression,
4937 pub paths: Vec<Expression>,
4938}
4939
4940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4942#[cfg_attr(feature = "bindings", derive(TS))]
4943pub struct JsonObjectFunc {
4944 pub pairs: Vec<(Expression, Expression)>,
4945 pub null_handling: Option<JsonNullHandling>,
4946 #[serde(default)]
4947 pub with_unique_keys: bool,
4948 #[serde(default)]
4949 pub returning_type: Option<DataType>,
4950 #[serde(default)]
4951 pub format_json: bool,
4952 #[serde(default)]
4953 pub encoding: Option<String>,
4954 #[serde(default)]
4956 pub star: bool,
4957}
4958
4959#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4961#[cfg_attr(feature = "bindings", derive(TS))]
4962pub enum JsonNullHandling {
4963 NullOnNull,
4964 AbsentOnNull,
4965}
4966
4967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4969#[cfg_attr(feature = "bindings", derive(TS))]
4970pub struct JsonModifyFunc {
4971 pub this: Expression,
4972 pub path_values: Vec<(Expression, Expression)>,
4973}
4974
4975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4977#[cfg_attr(feature = "bindings", derive(TS))]
4978pub struct JsonArrayAggFunc {
4979 pub this: Expression,
4980 pub order_by: Option<Vec<Ordered>>,
4981 pub null_handling: Option<JsonNullHandling>,
4982 pub filter: Option<Expression>,
4983}
4984
4985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4987#[cfg_attr(feature = "bindings", derive(TS))]
4988pub struct JsonObjectAggFunc {
4989 pub key: Expression,
4990 pub value: Expression,
4991 pub null_handling: Option<JsonNullHandling>,
4992 pub filter: Option<Expression>,
4993}
4994
4995#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5001#[cfg_attr(feature = "bindings", derive(TS))]
5002pub struct ConvertFunc {
5003 pub this: Expression,
5004 pub to: DataType,
5005 pub style: Option<Expression>,
5006}
5007
5008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5014#[cfg_attr(feature = "bindings", derive(TS))]
5015pub struct LambdaExpr {
5016 pub parameters: Vec<Identifier>,
5017 pub body: Expression,
5018 #[serde(default)]
5020 pub colon: bool,
5021 #[serde(default)]
5024 pub parameter_types: Vec<Option<DataType>>,
5025}
5026
5027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5029#[cfg_attr(feature = "bindings", derive(TS))]
5030pub struct Parameter {
5031 pub name: Option<String>,
5032 pub index: Option<u32>,
5033 pub style: ParameterStyle,
5034 #[serde(default)]
5036 pub quoted: bool,
5037 #[serde(default)]
5039 pub string_quoted: bool,
5040 #[serde(default)]
5042 pub expression: Option<String>,
5043}
5044
5045#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5047#[cfg_attr(feature = "bindings", derive(TS))]
5048pub enum ParameterStyle {
5049 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
5059
5060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5062#[cfg_attr(feature = "bindings", derive(TS))]
5063pub struct Placeholder {
5064 pub index: Option<u32>,
5065}
5066
5067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5069#[cfg_attr(feature = "bindings", derive(TS))]
5070pub struct NamedArgument {
5071 pub name: Identifier,
5072 pub value: Expression,
5073 pub separator: NamedArgSeparator,
5075}
5076
5077#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5079#[cfg_attr(feature = "bindings", derive(TS))]
5080pub enum NamedArgSeparator {
5081 DArrow,
5083 ColonEq,
5085 Eq,
5087}
5088
5089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5092#[cfg_attr(feature = "bindings", derive(TS))]
5093pub struct TableArgument {
5094 pub prefix: String,
5096 pub this: Expression,
5098}
5099
5100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5102#[cfg_attr(feature = "bindings", derive(TS))]
5103pub struct SqlComment {
5104 pub text: String,
5105 pub is_block: bool,
5106}
5107
5108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5114#[cfg_attr(feature = "bindings", derive(TS))]
5115pub struct SimilarToExpr {
5116 pub this: Expression,
5117 pub pattern: Expression,
5118 pub escape: Option<Expression>,
5119 pub not: bool,
5120}
5121
5122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5124#[cfg_attr(feature = "bindings", derive(TS))]
5125pub struct QuantifiedExpr {
5126 pub this: Expression,
5127 pub subquery: Expression,
5128 pub op: Option<QuantifiedOp>,
5129}
5130
5131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5133#[cfg_attr(feature = "bindings", derive(TS))]
5134pub enum QuantifiedOp {
5135 Eq,
5136 Neq,
5137 Lt,
5138 Lte,
5139 Gt,
5140 Gte,
5141}
5142
5143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5148#[cfg_attr(feature = "bindings", derive(TS))]
5149pub struct OverlapsExpr {
5150 #[serde(skip_serializing_if = "Option::is_none")]
5152 pub this: Option<Expression>,
5153 #[serde(skip_serializing_if = "Option::is_none")]
5155 pub expression: Option<Expression>,
5156 #[serde(skip_serializing_if = "Option::is_none")]
5158 pub left_start: Option<Expression>,
5159 #[serde(skip_serializing_if = "Option::is_none")]
5161 pub left_end: Option<Expression>,
5162 #[serde(skip_serializing_if = "Option::is_none")]
5164 pub right_start: Option<Expression>,
5165 #[serde(skip_serializing_if = "Option::is_none")]
5167 pub right_end: Option<Expression>,
5168}
5169
5170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5176#[cfg_attr(feature = "bindings", derive(TS))]
5177pub struct Subscript {
5178 pub this: Expression,
5179 pub index: Expression,
5180}
5181
5182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5184#[cfg_attr(feature = "bindings", derive(TS))]
5185pub struct DotAccess {
5186 pub this: Expression,
5187 pub field: Identifier,
5188}
5189
5190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5192#[cfg_attr(feature = "bindings", derive(TS))]
5193pub struct MethodCall {
5194 pub this: Expression,
5195 pub method: Identifier,
5196 pub args: Vec<Expression>,
5197}
5198
5199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5201#[cfg_attr(feature = "bindings", derive(TS))]
5202pub struct ArraySlice {
5203 pub this: Expression,
5204 pub start: Option<Expression>,
5205 pub end: Option<Expression>,
5206}
5207
5208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5214#[cfg_attr(feature = "bindings", derive(TS))]
5215pub enum OnCommit {
5216 PreserveRows,
5218 DeleteRows,
5220}
5221
5222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5224#[cfg_attr(feature = "bindings", derive(TS))]
5225pub struct CreateTable {
5226 pub name: TableRef,
5227 #[serde(default, skip_serializing_if = "Option::is_none")]
5229 pub on_cluster: Option<OnCluster>,
5230 pub columns: Vec<ColumnDef>,
5231 pub constraints: Vec<TableConstraint>,
5232 pub if_not_exists: bool,
5233 pub temporary: bool,
5234 pub or_replace: bool,
5235 #[serde(default, skip_serializing_if = "Option::is_none")]
5237 pub table_modifier: Option<String>,
5238 pub as_select: Option<Expression>,
5239 #[serde(default)]
5241 pub as_select_parenthesized: bool,
5242 #[serde(default)]
5244 pub on_commit: Option<OnCommit>,
5245 #[serde(default)]
5247 pub clone_source: Option<TableRef>,
5248 #[serde(default, skip_serializing_if = "Option::is_none")]
5250 pub clone_at_clause: Option<Expression>,
5251 #[serde(default)]
5253 pub is_copy: bool,
5254 #[serde(default)]
5256 pub shallow_clone: bool,
5257 #[serde(default)]
5259 pub leading_comments: Vec<String>,
5260 #[serde(default)]
5262 pub with_properties: Vec<(String, String)>,
5263 #[serde(default)]
5265 pub teradata_post_name_options: Vec<String>,
5266 #[serde(default)]
5268 pub with_data: Option<bool>,
5269 #[serde(default)]
5271 pub with_statistics: Option<bool>,
5272 #[serde(default)]
5274 pub teradata_indexes: Vec<TeradataIndex>,
5275 #[serde(default)]
5277 pub with_cte: Option<With>,
5278 #[serde(default)]
5280 pub properties: Vec<Expression>,
5281 #[serde(default, skip_serializing_if = "Option::is_none")]
5283 pub partition_of: Option<Expression>,
5284 #[serde(default)]
5286 pub post_table_properties: Vec<Expression>,
5287 #[serde(default)]
5289 pub mysql_table_options: Vec<(String, String)>,
5290 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5292 pub inherits: Vec<TableRef>,
5293 #[serde(default, skip_serializing_if = "Option::is_none")]
5295 pub on_property: Option<OnProperty>,
5296 #[serde(default)]
5298 pub copy_grants: bool,
5299 #[serde(default, skip_serializing_if = "Option::is_none")]
5301 pub using_template: Option<Box<Expression>>,
5302 #[serde(default, skip_serializing_if = "Option::is_none")]
5304 pub rollup: Option<RollupProperty>,
5305}
5306
5307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5309#[cfg_attr(feature = "bindings", derive(TS))]
5310pub struct TeradataIndex {
5311 pub kind: TeradataIndexKind,
5313 pub name: Option<String>,
5315 pub columns: Vec<String>,
5317}
5318
5319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5321#[cfg_attr(feature = "bindings", derive(TS))]
5322pub enum TeradataIndexKind {
5323 NoPrimary,
5325 Primary,
5327 PrimaryAmp,
5329 Unique,
5331 UniquePrimary,
5333 Secondary,
5335}
5336
5337impl CreateTable {
5338 pub fn new(name: impl Into<String>) -> Self {
5339 Self {
5340 name: TableRef::new(name),
5341 on_cluster: None,
5342 columns: Vec::new(),
5343 constraints: Vec::new(),
5344 if_not_exists: false,
5345 temporary: false,
5346 or_replace: false,
5347 table_modifier: None,
5348 as_select: None,
5349 as_select_parenthesized: false,
5350 on_commit: None,
5351 clone_source: None,
5352 clone_at_clause: None,
5353 shallow_clone: false,
5354 is_copy: false,
5355 leading_comments: Vec::new(),
5356 with_properties: Vec::new(),
5357 teradata_post_name_options: Vec::new(),
5358 with_data: None,
5359 with_statistics: None,
5360 teradata_indexes: Vec::new(),
5361 with_cte: None,
5362 properties: Vec::new(),
5363 partition_of: None,
5364 post_table_properties: Vec::new(),
5365 mysql_table_options: Vec::new(),
5366 inherits: Vec::new(),
5367 on_property: None,
5368 copy_grants: false,
5369 using_template: None,
5370 rollup: None,
5371 }
5372 }
5373}
5374
5375#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
5377#[cfg_attr(feature = "bindings", derive(TS))]
5378pub enum SortOrder {
5379 Asc,
5380 Desc,
5381}
5382
5383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5385#[cfg_attr(feature = "bindings", derive(TS))]
5386pub enum ConstraintType {
5387 NotNull,
5388 Null,
5389 PrimaryKey,
5390 Unique,
5391 Default,
5392 AutoIncrement,
5393 Collate,
5394 Comment,
5395 References,
5396 Check,
5397 GeneratedAsIdentity,
5398 Tags,
5400 ComputedColumn,
5402 GeneratedAsRow,
5404 OnUpdate,
5406 Path,
5408 Encode,
5410}
5411
5412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5414#[cfg_attr(feature = "bindings", derive(TS))]
5415pub struct ColumnDef {
5416 pub name: Identifier,
5417 pub data_type: DataType,
5418 pub nullable: Option<bool>,
5419 pub default: Option<Expression>,
5420 pub primary_key: bool,
5421 #[serde(default)]
5423 pub primary_key_order: Option<SortOrder>,
5424 pub unique: bool,
5425 #[serde(default)]
5427 pub unique_nulls_not_distinct: bool,
5428 pub auto_increment: bool,
5429 pub comment: Option<String>,
5430 pub constraints: Vec<ColumnConstraint>,
5431 #[serde(default)]
5433 pub constraint_order: Vec<ConstraintType>,
5434 #[serde(default)]
5436 pub format: Option<String>,
5437 #[serde(default)]
5439 pub title: Option<String>,
5440 #[serde(default)]
5442 pub inline_length: Option<u64>,
5443 #[serde(default)]
5445 pub compress: Option<Vec<Expression>>,
5446 #[serde(default)]
5448 pub character_set: Option<String>,
5449 #[serde(default)]
5451 pub uppercase: bool,
5452 #[serde(default)]
5454 pub casespecific: Option<bool>,
5455 #[serde(default)]
5457 pub auto_increment_start: Option<Box<Expression>>,
5458 #[serde(default)]
5460 pub auto_increment_increment: Option<Box<Expression>>,
5461 #[serde(default)]
5463 pub auto_increment_order: Option<bool>,
5464 #[serde(default)]
5466 pub unsigned: bool,
5467 #[serde(default)]
5469 pub zerofill: bool,
5470 #[serde(default, skip_serializing_if = "Option::is_none")]
5472 pub on_update: Option<Expression>,
5473 #[serde(default, skip_serializing_if = "Option::is_none")]
5475 pub unique_constraint_name: Option<String>,
5476 #[serde(default, skip_serializing_if = "Option::is_none")]
5478 pub not_null_constraint_name: Option<String>,
5479 #[serde(default, skip_serializing_if = "Option::is_none")]
5481 pub primary_key_constraint_name: Option<String>,
5482 #[serde(default, skip_serializing_if = "Option::is_none")]
5484 pub check_constraint_name: Option<String>,
5485 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5487 pub options: Vec<Expression>,
5488 #[serde(default)]
5490 pub no_type: bool,
5491 #[serde(default, skip_serializing_if = "Option::is_none")]
5493 pub encoding: Option<String>,
5494 #[serde(default, skip_serializing_if = "Option::is_none")]
5496 pub codec: Option<String>,
5497 #[serde(default, skip_serializing_if = "Option::is_none")]
5499 pub ephemeral: Option<Option<Box<Expression>>>,
5500 #[serde(default, skip_serializing_if = "Option::is_none")]
5502 pub materialized_expr: Option<Box<Expression>>,
5503 #[serde(default, skip_serializing_if = "Option::is_none")]
5505 pub alias_expr: Option<Box<Expression>>,
5506 #[serde(default, skip_serializing_if = "Option::is_none")]
5508 pub ttl_expr: Option<Box<Expression>>,
5509 #[serde(default)]
5511 pub not_for_replication: bool,
5512}
5513
5514impl ColumnDef {
5515 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
5516 Self {
5517 name: Identifier::new(name),
5518 data_type,
5519 nullable: None,
5520 default: None,
5521 primary_key: false,
5522 primary_key_order: None,
5523 unique: false,
5524 unique_nulls_not_distinct: false,
5525 auto_increment: false,
5526 comment: None,
5527 constraints: Vec::new(),
5528 constraint_order: Vec::new(),
5529 format: None,
5530 title: None,
5531 inline_length: None,
5532 compress: None,
5533 character_set: None,
5534 uppercase: false,
5535 casespecific: None,
5536 auto_increment_start: None,
5537 auto_increment_increment: None,
5538 auto_increment_order: None,
5539 unsigned: false,
5540 zerofill: false,
5541 on_update: None,
5542 unique_constraint_name: None,
5543 not_null_constraint_name: None,
5544 primary_key_constraint_name: None,
5545 check_constraint_name: None,
5546 options: Vec::new(),
5547 no_type: false,
5548 encoding: None,
5549 codec: None,
5550 ephemeral: None,
5551 materialized_expr: None,
5552 alias_expr: None,
5553 ttl_expr: None,
5554 not_for_replication: false,
5555 }
5556 }
5557}
5558
5559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5561#[cfg_attr(feature = "bindings", derive(TS))]
5562pub enum ColumnConstraint {
5563 NotNull,
5564 Null,
5565 Unique,
5566 PrimaryKey,
5567 Default(Expression),
5568 Check(Expression),
5569 References(ForeignKeyRef),
5570 GeneratedAsIdentity(GeneratedAsIdentity),
5571 Collate(Identifier),
5572 Comment(String),
5573 Tags(Tags),
5575 ComputedColumn(ComputedColumn),
5578 GeneratedAsRow(GeneratedAsRow),
5580 Path(Expression),
5582}
5583
5584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5586#[cfg_attr(feature = "bindings", derive(TS))]
5587pub struct ComputedColumn {
5588 pub expression: Box<Expression>,
5590 #[serde(default)]
5592 pub persisted: bool,
5593 #[serde(default)]
5595 pub not_null: bool,
5596 #[serde(default)]
5599 pub persistence_kind: Option<String>,
5600 #[serde(default, skip_serializing_if = "Option::is_none")]
5602 pub data_type: Option<DataType>,
5603}
5604
5605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5607#[cfg_attr(feature = "bindings", derive(TS))]
5608pub struct GeneratedAsRow {
5609 pub start: bool,
5611 #[serde(default)]
5613 pub hidden: bool,
5614}
5615
5616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5618#[cfg_attr(feature = "bindings", derive(TS))]
5619pub struct GeneratedAsIdentity {
5620 pub always: bool,
5622 pub on_null: bool,
5624 pub start: Option<Box<Expression>>,
5626 pub increment: Option<Box<Expression>>,
5628 pub minvalue: Option<Box<Expression>>,
5630 pub maxvalue: Option<Box<Expression>>,
5632 pub cycle: Option<bool>,
5634}
5635
5636#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
5638#[cfg_attr(feature = "bindings", derive(TS))]
5639pub struct ConstraintModifiers {
5640 pub enforced: Option<bool>,
5642 pub deferrable: Option<bool>,
5644 pub initially_deferred: Option<bool>,
5646 pub norely: bool,
5648 pub rely: bool,
5650 #[serde(default)]
5652 pub using: Option<String>,
5653 #[serde(default)]
5655 pub using_before_columns: bool,
5656 #[serde(default, skip_serializing_if = "Option::is_none")]
5658 pub comment: Option<String>,
5659 #[serde(default, skip_serializing_if = "Option::is_none")]
5661 pub visible: Option<bool>,
5662 #[serde(default, skip_serializing_if = "Option::is_none")]
5664 pub engine_attribute: Option<String>,
5665 #[serde(default, skip_serializing_if = "Option::is_none")]
5667 pub with_parser: Option<String>,
5668 #[serde(default)]
5670 pub not_valid: bool,
5671 #[serde(default, skip_serializing_if = "Option::is_none")]
5673 pub clustered: Option<String>,
5674 #[serde(default, skip_serializing_if = "Option::is_none")]
5676 pub on_conflict: Option<String>,
5677 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5679 pub with_options: Vec<(String, String)>,
5680 #[serde(default, skip_serializing_if = "Option::is_none")]
5682 pub on_filegroup: Option<Identifier>,
5683}
5684
5685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5687#[cfg_attr(feature = "bindings", derive(TS))]
5688pub enum TableConstraint {
5689 PrimaryKey {
5690 name: Option<Identifier>,
5691 columns: Vec<Identifier>,
5692 #[serde(default)]
5694 include_columns: Vec<Identifier>,
5695 #[serde(default)]
5696 modifiers: ConstraintModifiers,
5697 #[serde(default)]
5699 has_constraint_keyword: bool,
5700 },
5701 Unique {
5702 name: Option<Identifier>,
5703 columns: Vec<Identifier>,
5704 #[serde(default)]
5706 columns_parenthesized: bool,
5707 #[serde(default)]
5708 modifiers: ConstraintModifiers,
5709 #[serde(default)]
5711 has_constraint_keyword: bool,
5712 #[serde(default)]
5714 nulls_not_distinct: bool,
5715 },
5716 ForeignKey {
5717 name: Option<Identifier>,
5718 columns: Vec<Identifier>,
5719 #[serde(default)]
5720 references: Option<ForeignKeyRef>,
5721 #[serde(default)]
5723 on_delete: Option<ReferentialAction>,
5724 #[serde(default)]
5726 on_update: Option<ReferentialAction>,
5727 #[serde(default)]
5728 modifiers: ConstraintModifiers,
5729 },
5730 Check {
5731 name: Option<Identifier>,
5732 expression: Expression,
5733 #[serde(default)]
5734 modifiers: ConstraintModifiers,
5735 },
5736 Index {
5738 name: Option<Identifier>,
5739 columns: Vec<Identifier>,
5740 #[serde(default)]
5742 kind: Option<String>,
5743 #[serde(default)]
5744 modifiers: ConstraintModifiers,
5745 #[serde(default)]
5747 use_key_keyword: bool,
5748 #[serde(default, skip_serializing_if = "Option::is_none")]
5750 expression: Option<Box<Expression>>,
5751 #[serde(default, skip_serializing_if = "Option::is_none")]
5753 index_type: Option<Box<Expression>>,
5754 #[serde(default, skip_serializing_if = "Option::is_none")]
5756 granularity: Option<Box<Expression>>,
5757 },
5758 Projection {
5760 name: Identifier,
5761 expression: Expression,
5762 },
5763 Like {
5765 source: TableRef,
5766 options: Vec<(LikeOptionAction, String)>,
5768 },
5769 PeriodForSystemTime {
5771 start_col: Identifier,
5772 end_col: Identifier,
5773 },
5774 Exclude {
5777 name: Option<Identifier>,
5778 #[serde(default)]
5780 using: Option<String>,
5781 elements: Vec<ExcludeElement>,
5783 #[serde(default)]
5785 include_columns: Vec<Identifier>,
5786 #[serde(default)]
5788 where_clause: Option<Box<Expression>>,
5789 #[serde(default)]
5791 with_params: Vec<(String, String)>,
5792 #[serde(default)]
5794 using_index_tablespace: Option<String>,
5795 #[serde(default)]
5796 modifiers: ConstraintModifiers,
5797 },
5798 Tags(Tags),
5800 InitiallyDeferred {
5804 deferred: bool,
5806 },
5807}
5808
5809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5811#[cfg_attr(feature = "bindings", derive(TS))]
5812pub struct ExcludeElement {
5813 pub expression: String,
5815 pub operator: String,
5817}
5818
5819#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5821#[cfg_attr(feature = "bindings", derive(TS))]
5822pub enum LikeOptionAction {
5823 Including,
5824 Excluding,
5825}
5826
5827#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5829#[cfg_attr(feature = "bindings", derive(TS))]
5830pub enum MatchType {
5831 Full,
5832 Partial,
5833 Simple,
5834}
5835
5836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5838#[cfg_attr(feature = "bindings", derive(TS))]
5839pub struct ForeignKeyRef {
5840 pub table: TableRef,
5841 pub columns: Vec<Identifier>,
5842 pub on_delete: Option<ReferentialAction>,
5843 pub on_update: Option<ReferentialAction>,
5844 #[serde(default)]
5846 pub on_update_first: bool,
5847 #[serde(default)]
5849 pub match_type: Option<MatchType>,
5850 #[serde(default)]
5852 pub match_after_actions: bool,
5853 #[serde(default)]
5855 pub constraint_name: Option<String>,
5856 #[serde(default)]
5858 pub deferrable: Option<bool>,
5859 #[serde(default)]
5861 pub has_foreign_key_keywords: bool,
5862}
5863
5864#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5866#[cfg_attr(feature = "bindings", derive(TS))]
5867pub enum ReferentialAction {
5868 Cascade,
5869 SetNull,
5870 SetDefault,
5871 Restrict,
5872 NoAction,
5873}
5874
5875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5877#[cfg_attr(feature = "bindings", derive(TS))]
5878pub struct DropTable {
5879 pub names: Vec<TableRef>,
5880 pub if_exists: bool,
5881 pub cascade: bool,
5882 #[serde(default)]
5884 pub cascade_constraints: bool,
5885 #[serde(default)]
5887 pub purge: bool,
5888 #[serde(default)]
5890 pub leading_comments: Vec<String>,
5891}
5892
5893impl DropTable {
5894 pub fn new(name: impl Into<String>) -> Self {
5895 Self {
5896 names: vec![TableRef::new(name)],
5897 if_exists: false,
5898 cascade: false,
5899 cascade_constraints: false,
5900 purge: false,
5901 leading_comments: Vec::new(),
5902 }
5903 }
5904}
5905
5906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5908#[cfg_attr(feature = "bindings", derive(TS))]
5909pub struct AlterTable {
5910 pub name: TableRef,
5911 pub actions: Vec<AlterTableAction>,
5912 #[serde(default)]
5914 pub if_exists: bool,
5915 #[serde(default, skip_serializing_if = "Option::is_none")]
5917 pub algorithm: Option<String>,
5918 #[serde(default, skip_serializing_if = "Option::is_none")]
5920 pub lock: Option<String>,
5921 #[serde(default, skip_serializing_if = "Option::is_none")]
5923 pub with_check: Option<String>,
5924 #[serde(default, skip_serializing_if = "Option::is_none")]
5926 pub partition: Option<Vec<(Identifier, Expression)>>,
5927 #[serde(default, skip_serializing_if = "Option::is_none")]
5929 pub on_cluster: Option<OnCluster>,
5930}
5931
5932impl AlterTable {
5933 pub fn new(name: impl Into<String>) -> Self {
5934 Self {
5935 name: TableRef::new(name),
5936 actions: Vec::new(),
5937 if_exists: false,
5938 algorithm: None,
5939 lock: None,
5940 with_check: None,
5941 partition: None,
5942 on_cluster: None,
5943 }
5944 }
5945}
5946
5947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5949#[cfg_attr(feature = "bindings", derive(TS))]
5950pub enum ColumnPosition {
5951 First,
5952 After(Identifier),
5953}
5954
5955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5957#[cfg_attr(feature = "bindings", derive(TS))]
5958pub enum AlterTableAction {
5959 AddColumn {
5960 column: ColumnDef,
5961 if_not_exists: bool,
5962 position: Option<ColumnPosition>,
5963 },
5964 DropColumn {
5965 name: Identifier,
5966 if_exists: bool,
5967 cascade: bool,
5968 },
5969 RenameColumn {
5970 old_name: Identifier,
5971 new_name: Identifier,
5972 if_exists: bool,
5973 },
5974 AlterColumn {
5975 name: Identifier,
5976 action: AlterColumnAction,
5977 #[serde(default)]
5979 use_modify_keyword: bool,
5980 },
5981 RenameTable(TableRef),
5982 AddConstraint(TableConstraint),
5983 DropConstraint {
5984 name: Identifier,
5985 if_exists: bool,
5986 },
5987 DropForeignKey {
5989 name: Identifier,
5990 },
5991 DropPartition {
5993 partitions: Vec<Vec<(Identifier, Expression)>>,
5995 if_exists: bool,
5996 },
5997 AddPartition {
5999 partition: Expression,
6001 if_not_exists: bool,
6002 location: Option<Expression>,
6003 },
6004 Delete {
6006 where_clause: Expression,
6007 },
6008 SwapWith(TableRef),
6010 SetProperty {
6012 properties: Vec<(String, Expression)>,
6013 },
6014 UnsetProperty {
6016 properties: Vec<String>,
6017 },
6018 ClusterBy {
6020 expressions: Vec<Expression>,
6021 },
6022 SetTag {
6024 expressions: Vec<(String, Expression)>,
6025 },
6026 UnsetTag {
6028 names: Vec<String>,
6029 },
6030 SetOptions {
6032 expressions: Vec<Expression>,
6033 },
6034 AlterIndex {
6036 name: Identifier,
6037 visible: bool,
6038 },
6039 SetAttribute {
6041 attribute: String,
6042 },
6043 SetStageFileFormat {
6045 options: Option<Expression>,
6046 },
6047 SetStageCopyOptions {
6049 options: Option<Expression>,
6050 },
6051 AddColumns {
6053 columns: Vec<ColumnDef>,
6054 cascade: bool,
6055 },
6056 DropColumns {
6058 names: Vec<Identifier>,
6059 },
6060 ChangeColumn {
6063 old_name: Identifier,
6064 new_name: Identifier,
6065 #[serde(default, skip_serializing_if = "Option::is_none")]
6066 data_type: Option<DataType>,
6067 comment: Option<String>,
6068 #[serde(default)]
6069 cascade: bool,
6070 },
6071 AlterSortKey {
6074 this: Option<String>,
6076 expressions: Vec<Expression>,
6078 compound: bool,
6080 },
6081 AlterDistStyle {
6085 style: String,
6087 distkey: Option<Identifier>,
6089 },
6090 SetTableProperties {
6092 properties: Vec<(Expression, Expression)>,
6093 },
6094 SetLocation {
6096 location: String,
6097 },
6098 SetFileFormat {
6100 format: String,
6101 },
6102 ReplacePartition {
6104 partition: Expression,
6105 source: Option<Box<Expression>>,
6106 },
6107 Raw {
6109 sql: String,
6110 },
6111}
6112
6113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6115#[cfg_attr(feature = "bindings", derive(TS))]
6116pub enum AlterColumnAction {
6117 SetDataType {
6118 data_type: DataType,
6119 using: Option<Expression>,
6121 #[serde(default, skip_serializing_if = "Option::is_none")]
6123 collate: Option<String>,
6124 },
6125 SetDefault(Expression),
6126 DropDefault,
6127 SetNotNull,
6128 DropNotNull,
6129 Comment(String),
6131 SetVisible,
6133 SetInvisible,
6135}
6136
6137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6139#[cfg_attr(feature = "bindings", derive(TS))]
6140pub struct CreateIndex {
6141 pub name: Identifier,
6142 pub table: TableRef,
6143 pub columns: Vec<IndexColumn>,
6144 pub unique: bool,
6145 pub if_not_exists: bool,
6146 pub using: Option<String>,
6147 #[serde(default)]
6149 pub clustered: Option<String>,
6150 #[serde(default)]
6152 pub concurrently: bool,
6153 #[serde(default)]
6155 pub where_clause: Option<Box<Expression>>,
6156 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6158 pub include_columns: Vec<Identifier>,
6159 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6161 pub with_options: Vec<(String, String)>,
6162 #[serde(default)]
6164 pub on_filegroup: Option<String>,
6165}
6166
6167impl CreateIndex {
6168 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
6169 Self {
6170 name: Identifier::new(name),
6171 table: TableRef::new(table),
6172 columns: Vec::new(),
6173 unique: false,
6174 if_not_exists: false,
6175 using: None,
6176 clustered: None,
6177 concurrently: false,
6178 where_clause: None,
6179 include_columns: Vec::new(),
6180 with_options: Vec::new(),
6181 on_filegroup: None,
6182 }
6183 }
6184}
6185
6186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6188#[cfg_attr(feature = "bindings", derive(TS))]
6189pub struct IndexColumn {
6190 pub column: Identifier,
6191 pub desc: bool,
6192 #[serde(default)]
6194 pub asc: bool,
6195 pub nulls_first: Option<bool>,
6196 #[serde(default, skip_serializing_if = "Option::is_none")]
6198 pub opclass: Option<String>,
6199}
6200
6201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6203#[cfg_attr(feature = "bindings", derive(TS))]
6204pub struct DropIndex {
6205 pub name: Identifier,
6206 pub table: Option<TableRef>,
6207 pub if_exists: bool,
6208 #[serde(default)]
6210 pub concurrently: bool,
6211}
6212
6213impl DropIndex {
6214 pub fn new(name: impl Into<String>) -> Self {
6215 Self {
6216 name: Identifier::new(name),
6217 table: None,
6218 if_exists: false,
6219 concurrently: false,
6220 }
6221 }
6222}
6223
6224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6226#[cfg_attr(feature = "bindings", derive(TS))]
6227pub struct ViewColumn {
6228 pub name: Identifier,
6229 pub comment: Option<String>,
6230 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6232 pub options: Vec<Expression>,
6233}
6234
6235impl ViewColumn {
6236 pub fn new(name: impl Into<String>) -> Self {
6237 Self {
6238 name: Identifier::new(name),
6239 comment: None,
6240 options: Vec::new(),
6241 }
6242 }
6243
6244 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
6245 Self {
6246 name: Identifier::new(name),
6247 comment: Some(comment.into()),
6248 options: Vec::new(),
6249 }
6250 }
6251}
6252
6253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6255#[cfg_attr(feature = "bindings", derive(TS))]
6256pub struct CreateView {
6257 pub name: TableRef,
6258 pub columns: Vec<ViewColumn>,
6259 pub query: Expression,
6260 pub or_replace: bool,
6261 pub if_not_exists: bool,
6262 pub materialized: bool,
6263 pub temporary: bool,
6264 #[serde(default)]
6266 pub secure: bool,
6267 #[serde(skip_serializing_if = "Option::is_none")]
6269 pub algorithm: Option<String>,
6270 #[serde(skip_serializing_if = "Option::is_none")]
6272 pub definer: Option<String>,
6273 #[serde(skip_serializing_if = "Option::is_none")]
6275 pub security: Option<FunctionSecurity>,
6276 #[serde(default = "default_true")]
6278 pub security_sql_style: bool,
6279 #[serde(default)]
6281 pub query_parenthesized: bool,
6282 #[serde(skip_serializing_if = "Option::is_none")]
6284 pub locking_mode: Option<String>,
6285 #[serde(skip_serializing_if = "Option::is_none")]
6287 pub locking_access: Option<String>,
6288 #[serde(default)]
6290 pub copy_grants: bool,
6291 #[serde(skip_serializing_if = "Option::is_none", default)]
6293 pub comment: Option<String>,
6294 #[serde(default)]
6296 pub tags: Vec<(String, String)>,
6297 #[serde(default)]
6299 pub options: Vec<Expression>,
6300 #[serde(skip_serializing_if = "Option::is_none", default)]
6302 pub build: Option<String>,
6303 #[serde(skip_serializing_if = "Option::is_none", default)]
6305 pub refresh: Option<Box<RefreshTriggerProperty>>,
6306 #[serde(skip_serializing_if = "Option::is_none", default)]
6309 pub schema: Option<Box<Schema>>,
6310 #[serde(skip_serializing_if = "Option::is_none", default)]
6312 pub unique_key: Option<Box<UniqueKeyProperty>>,
6313 #[serde(default)]
6315 pub no_schema_binding: bool,
6316 #[serde(skip_serializing_if = "Option::is_none", default)]
6318 pub auto_refresh: Option<bool>,
6319 #[serde(default, skip_serializing_if = "Option::is_none")]
6321 pub on_cluster: Option<OnCluster>,
6322 #[serde(default, skip_serializing_if = "Option::is_none")]
6324 pub to_table: Option<TableRef>,
6325 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6327 pub table_properties: Vec<Expression>,
6328}
6329
6330impl CreateView {
6331 pub fn new(name: impl Into<String>, query: Expression) -> Self {
6332 Self {
6333 name: TableRef::new(name),
6334 columns: Vec::new(),
6335 query,
6336 or_replace: false,
6337 if_not_exists: false,
6338 materialized: false,
6339 temporary: false,
6340 secure: false,
6341 algorithm: None,
6342 definer: None,
6343 security: None,
6344 security_sql_style: true,
6345 query_parenthesized: false,
6346 locking_mode: None,
6347 locking_access: None,
6348 copy_grants: false,
6349 comment: None,
6350 tags: Vec::new(),
6351 options: Vec::new(),
6352 build: None,
6353 refresh: None,
6354 schema: None,
6355 unique_key: None,
6356 no_schema_binding: false,
6357 auto_refresh: None,
6358 on_cluster: None,
6359 to_table: None,
6360 table_properties: Vec::new(),
6361 }
6362 }
6363}
6364
6365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6367#[cfg_attr(feature = "bindings", derive(TS))]
6368pub struct DropView {
6369 pub name: TableRef,
6370 pub if_exists: bool,
6371 pub materialized: bool,
6372}
6373
6374impl DropView {
6375 pub fn new(name: impl Into<String>) -> Self {
6376 Self {
6377 name: TableRef::new(name),
6378 if_exists: false,
6379 materialized: false,
6380 }
6381 }
6382}
6383
6384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6386#[cfg_attr(feature = "bindings", derive(TS))]
6387pub struct Truncate {
6388 #[serde(default)]
6390 pub target: TruncateTarget,
6391 #[serde(default)]
6393 pub if_exists: bool,
6394 pub table: TableRef,
6395 #[serde(default, skip_serializing_if = "Option::is_none")]
6397 pub on_cluster: Option<OnCluster>,
6398 pub cascade: bool,
6399 #[serde(default)]
6401 pub extra_tables: Vec<TruncateTableEntry>,
6402 #[serde(default)]
6404 pub identity: Option<TruncateIdentity>,
6405 #[serde(default)]
6407 pub restrict: bool,
6408 #[serde(default, skip_serializing_if = "Option::is_none")]
6410 pub partition: Option<Box<Expression>>,
6411}
6412
6413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6415#[cfg_attr(feature = "bindings", derive(TS))]
6416pub struct TruncateTableEntry {
6417 pub table: TableRef,
6418 #[serde(default)]
6420 pub star: bool,
6421}
6422
6423#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6425#[cfg_attr(feature = "bindings", derive(TS))]
6426pub enum TruncateTarget {
6427 Table,
6428 Database,
6429}
6430
6431impl Default for TruncateTarget {
6432 fn default() -> Self {
6433 TruncateTarget::Table
6434 }
6435}
6436
6437#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6439#[cfg_attr(feature = "bindings", derive(TS))]
6440pub enum TruncateIdentity {
6441 Restart,
6442 Continue,
6443}
6444
6445impl Truncate {
6446 pub fn new(table: impl Into<String>) -> Self {
6447 Self {
6448 target: TruncateTarget::Table,
6449 if_exists: false,
6450 table: TableRef::new(table),
6451 on_cluster: None,
6452 cascade: false,
6453 extra_tables: Vec::new(),
6454 identity: None,
6455 restrict: false,
6456 partition: None,
6457 }
6458 }
6459}
6460
6461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6463#[cfg_attr(feature = "bindings", derive(TS))]
6464pub struct Use {
6465 pub kind: Option<UseKind>,
6467 pub this: Identifier,
6469}
6470
6471#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6473#[cfg_attr(feature = "bindings", derive(TS))]
6474pub enum UseKind {
6475 Database,
6476 Schema,
6477 Role,
6478 Warehouse,
6479 Catalog,
6480 SecondaryRoles,
6482}
6483
6484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6486#[cfg_attr(feature = "bindings", derive(TS))]
6487pub struct SetStatement {
6488 pub items: Vec<SetItem>,
6490}
6491
6492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6494#[cfg_attr(feature = "bindings", derive(TS))]
6495pub struct SetItem {
6496 pub name: Expression,
6498 pub value: Expression,
6500 pub kind: Option<String>,
6502 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6504 pub no_equals: bool,
6505}
6506
6507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6509#[cfg_attr(feature = "bindings", derive(TS))]
6510pub struct Cache {
6511 pub table: Identifier,
6513 pub lazy: bool,
6515 pub options: Vec<(Expression, Expression)>,
6517 pub query: Option<Expression>,
6519}
6520
6521#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6523#[cfg_attr(feature = "bindings", derive(TS))]
6524pub struct Uncache {
6525 pub table: Identifier,
6527 pub if_exists: bool,
6529}
6530
6531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6533#[cfg_attr(feature = "bindings", derive(TS))]
6534pub struct LoadData {
6535 pub local: bool,
6537 pub inpath: String,
6539 pub overwrite: bool,
6541 pub table: Expression,
6543 pub partition: Vec<(Identifier, Expression)>,
6545 pub input_format: Option<String>,
6547 pub serde: Option<String>,
6549}
6550
6551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6553#[cfg_attr(feature = "bindings", derive(TS))]
6554pub struct Pragma {
6555 pub schema: Option<Identifier>,
6557 pub name: Identifier,
6559 pub value: Option<Expression>,
6561 pub args: Vec<Expression>,
6563}
6564
6565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6568#[cfg_attr(feature = "bindings", derive(TS))]
6569pub struct Privilege {
6570 pub name: String,
6572 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6574 pub columns: Vec<String>,
6575}
6576
6577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6579#[cfg_attr(feature = "bindings", derive(TS))]
6580pub struct GrantPrincipal {
6581 pub name: Identifier,
6583 pub is_role: bool,
6585 #[serde(default)]
6587 pub is_group: bool,
6588}
6589
6590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6592#[cfg_attr(feature = "bindings", derive(TS))]
6593pub struct Grant {
6594 pub privileges: Vec<Privilege>,
6596 pub kind: Option<String>,
6598 pub securable: Identifier,
6600 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6602 pub function_params: Vec<String>,
6603 pub principals: Vec<GrantPrincipal>,
6605 pub grant_option: bool,
6607 #[serde(default, skip_serializing_if = "Option::is_none")]
6609 pub as_principal: Option<Identifier>,
6610}
6611
6612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6614#[cfg_attr(feature = "bindings", derive(TS))]
6615pub struct Revoke {
6616 pub privileges: Vec<Privilege>,
6618 pub kind: Option<String>,
6620 pub securable: Identifier,
6622 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6624 pub function_params: Vec<String>,
6625 pub principals: Vec<GrantPrincipal>,
6627 pub grant_option: bool,
6629 pub cascade: bool,
6631 #[serde(default)]
6633 pub restrict: bool,
6634}
6635
6636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6638#[cfg_attr(feature = "bindings", derive(TS))]
6639pub struct Comment {
6640 pub this: Expression,
6642 pub kind: String,
6644 pub expression: Expression,
6646 pub exists: bool,
6648 pub materialized: bool,
6650}
6651
6652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6658#[cfg_attr(feature = "bindings", derive(TS))]
6659pub struct AlterView {
6660 pub name: TableRef,
6661 pub actions: Vec<AlterViewAction>,
6662 #[serde(default, skip_serializing_if = "Option::is_none")]
6664 pub algorithm: Option<String>,
6665 #[serde(default, skip_serializing_if = "Option::is_none")]
6667 pub definer: Option<String>,
6668 #[serde(default, skip_serializing_if = "Option::is_none")]
6670 pub sql_security: Option<String>,
6671 #[serde(default, skip_serializing_if = "Option::is_none")]
6673 pub with_option: Option<String>,
6674 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6676 pub columns: Vec<ViewColumn>,
6677}
6678
6679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6681#[cfg_attr(feature = "bindings", derive(TS))]
6682pub enum AlterViewAction {
6683 Rename(TableRef),
6685 OwnerTo(Identifier),
6687 SetSchema(Identifier),
6689 SetAuthorization(String),
6691 AlterColumn {
6693 name: Identifier,
6694 action: AlterColumnAction,
6695 },
6696 AsSelect(Box<Expression>),
6698 SetTblproperties(Vec<(String, String)>),
6700 UnsetTblproperties(Vec<String>),
6702}
6703
6704impl AlterView {
6705 pub fn new(name: impl Into<String>) -> Self {
6706 Self {
6707 name: TableRef::new(name),
6708 actions: Vec::new(),
6709 algorithm: None,
6710 definer: None,
6711 sql_security: None,
6712 with_option: None,
6713 columns: Vec::new(),
6714 }
6715 }
6716}
6717
6718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6720#[cfg_attr(feature = "bindings", derive(TS))]
6721pub struct AlterIndex {
6722 pub name: Identifier,
6723 pub table: Option<TableRef>,
6724 pub actions: Vec<AlterIndexAction>,
6725}
6726
6727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6729#[cfg_attr(feature = "bindings", derive(TS))]
6730pub enum AlterIndexAction {
6731 Rename(Identifier),
6733 SetTablespace(Identifier),
6735 Visible(bool),
6737}
6738
6739impl AlterIndex {
6740 pub fn new(name: impl Into<String>) -> Self {
6741 Self {
6742 name: Identifier::new(name),
6743 table: None,
6744 actions: Vec::new(),
6745 }
6746 }
6747}
6748
6749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6751#[cfg_attr(feature = "bindings", derive(TS))]
6752pub struct CreateSchema {
6753 pub name: Identifier,
6754 pub if_not_exists: bool,
6755 pub authorization: Option<Identifier>,
6756 #[serde(default)]
6757 pub clone_from: Option<Identifier>,
6758 #[serde(default)]
6760 pub at_clause: Option<Expression>,
6761 #[serde(default)]
6763 pub properties: Vec<Expression>,
6764 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6766 pub leading_comments: Vec<String>,
6767}
6768
6769impl CreateSchema {
6770 pub fn new(name: impl Into<String>) -> Self {
6771 Self {
6772 name: Identifier::new(name),
6773 if_not_exists: false,
6774 authorization: None,
6775 clone_from: None,
6776 at_clause: None,
6777 properties: Vec::new(),
6778 leading_comments: Vec::new(),
6779 }
6780 }
6781}
6782
6783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6785#[cfg_attr(feature = "bindings", derive(TS))]
6786pub struct DropSchema {
6787 pub name: Identifier,
6788 pub if_exists: bool,
6789 pub cascade: bool,
6790}
6791
6792impl DropSchema {
6793 pub fn new(name: impl Into<String>) -> Self {
6794 Self {
6795 name: Identifier::new(name),
6796 if_exists: false,
6797 cascade: false,
6798 }
6799 }
6800}
6801
6802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6804#[cfg_attr(feature = "bindings", derive(TS))]
6805pub struct DropNamespace {
6806 pub name: Identifier,
6807 pub if_exists: bool,
6808 pub cascade: bool,
6809}
6810
6811impl DropNamespace {
6812 pub fn new(name: impl Into<String>) -> Self {
6813 Self {
6814 name: Identifier::new(name),
6815 if_exists: false,
6816 cascade: false,
6817 }
6818 }
6819}
6820
6821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6823#[cfg_attr(feature = "bindings", derive(TS))]
6824pub struct CreateDatabase {
6825 pub name: Identifier,
6826 pub if_not_exists: bool,
6827 pub options: Vec<DatabaseOption>,
6828 #[serde(default)]
6830 pub clone_from: Option<Identifier>,
6831 #[serde(default)]
6833 pub at_clause: Option<Expression>,
6834}
6835
6836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6838#[cfg_attr(feature = "bindings", derive(TS))]
6839pub enum DatabaseOption {
6840 CharacterSet(String),
6841 Collate(String),
6842 Owner(Identifier),
6843 Template(Identifier),
6844 Encoding(String),
6845 Location(String),
6846}
6847
6848impl CreateDatabase {
6849 pub fn new(name: impl Into<String>) -> Self {
6850 Self {
6851 name: Identifier::new(name),
6852 if_not_exists: false,
6853 options: Vec::new(),
6854 clone_from: None,
6855 at_clause: None,
6856 }
6857 }
6858}
6859
6860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6862#[cfg_attr(feature = "bindings", derive(TS))]
6863pub struct DropDatabase {
6864 pub name: Identifier,
6865 pub if_exists: bool,
6866}
6867
6868impl DropDatabase {
6869 pub fn new(name: impl Into<String>) -> Self {
6870 Self {
6871 name: Identifier::new(name),
6872 if_exists: false,
6873 }
6874 }
6875}
6876
6877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6879#[cfg_attr(feature = "bindings", derive(TS))]
6880pub struct CreateFunction {
6881 pub name: TableRef,
6882 pub parameters: Vec<FunctionParameter>,
6883 pub return_type: Option<DataType>,
6884 pub body: Option<FunctionBody>,
6885 pub or_replace: bool,
6886 pub if_not_exists: bool,
6887 pub temporary: bool,
6888 pub language: Option<String>,
6889 pub deterministic: Option<bool>,
6890 pub returns_null_on_null_input: Option<bool>,
6891 pub security: Option<FunctionSecurity>,
6892 #[serde(default = "default_true")]
6894 pub has_parens: bool,
6895 #[serde(default)]
6897 pub sql_data_access: Option<SqlDataAccess>,
6898 #[serde(default, skip_serializing_if = "Option::is_none")]
6900 pub returns_table_body: Option<String>,
6901 #[serde(default)]
6903 pub language_first: bool,
6904 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6906 pub set_options: Vec<FunctionSetOption>,
6907 #[serde(default)]
6909 pub strict: bool,
6910 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6912 pub options: Vec<Expression>,
6913 #[serde(default)]
6915 pub is_table_function: bool,
6916 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6918 pub property_order: Vec<FunctionPropertyKind>,
6919 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6921 pub environment: Vec<Expression>,
6922}
6923
6924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6926#[cfg_attr(feature = "bindings", derive(TS))]
6927pub struct FunctionSetOption {
6928 pub name: String,
6929 pub value: FunctionSetValue,
6930}
6931
6932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6934#[cfg_attr(feature = "bindings", derive(TS))]
6935pub enum FunctionSetValue {
6936 Value { value: String, use_to: bool },
6938 FromCurrent,
6940}
6941
6942#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6944#[cfg_attr(feature = "bindings", derive(TS))]
6945pub enum SqlDataAccess {
6946 NoSql,
6948 ContainsSql,
6950 ReadsSqlData,
6952 ModifiesSqlData,
6954}
6955
6956#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6958#[cfg_attr(feature = "bindings", derive(TS))]
6959pub enum FunctionPropertyKind {
6960 Set,
6962 As,
6964 Language,
6966 Determinism,
6968 NullInput,
6970 Security,
6972 SqlDataAccess,
6974 Options,
6976 Environment,
6978}
6979
6980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6982#[cfg_attr(feature = "bindings", derive(TS))]
6983pub struct FunctionParameter {
6984 pub name: Option<Identifier>,
6985 pub data_type: DataType,
6986 pub mode: Option<ParameterMode>,
6987 pub default: Option<Expression>,
6988 #[serde(default, skip_serializing_if = "Option::is_none")]
6990 pub mode_text: Option<String>,
6991}
6992
6993#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6995#[cfg_attr(feature = "bindings", derive(TS))]
6996pub enum ParameterMode {
6997 In,
6998 Out,
6999 InOut,
7000 Variadic,
7001}
7002
7003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7005#[cfg_attr(feature = "bindings", derive(TS))]
7006pub enum FunctionBody {
7007 Block(String),
7009 StringLiteral(String),
7011 Expression(Expression),
7013 External(String),
7015 Return(Expression),
7017 Statements(Vec<Expression>),
7019 DollarQuoted {
7022 content: String,
7023 tag: Option<String>,
7024 },
7025}
7026
7027#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7029#[cfg_attr(feature = "bindings", derive(TS))]
7030pub enum FunctionSecurity {
7031 Definer,
7032 Invoker,
7033 None,
7035}
7036
7037impl CreateFunction {
7038 pub fn new(name: impl Into<String>) -> Self {
7039 Self {
7040 name: TableRef::new(name),
7041 parameters: Vec::new(),
7042 return_type: None,
7043 body: None,
7044 or_replace: false,
7045 if_not_exists: false,
7046 temporary: false,
7047 language: None,
7048 deterministic: None,
7049 returns_null_on_null_input: None,
7050 security: None,
7051 has_parens: true,
7052 sql_data_access: None,
7053 returns_table_body: None,
7054 language_first: false,
7055 set_options: Vec::new(),
7056 strict: false,
7057 options: Vec::new(),
7058 is_table_function: false,
7059 property_order: Vec::new(),
7060 environment: Vec::new(),
7061 }
7062 }
7063}
7064
7065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7067#[cfg_attr(feature = "bindings", derive(TS))]
7068pub struct DropFunction {
7069 pub name: TableRef,
7070 pub parameters: Option<Vec<DataType>>,
7071 pub if_exists: bool,
7072 pub cascade: bool,
7073}
7074
7075impl DropFunction {
7076 pub fn new(name: impl Into<String>) -> Self {
7077 Self {
7078 name: TableRef::new(name),
7079 parameters: None,
7080 if_exists: false,
7081 cascade: false,
7082 }
7083 }
7084}
7085
7086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7088#[cfg_attr(feature = "bindings", derive(TS))]
7089pub struct CreateProcedure {
7090 pub name: TableRef,
7091 pub parameters: Vec<FunctionParameter>,
7092 pub body: Option<FunctionBody>,
7093 pub or_replace: bool,
7094 pub if_not_exists: bool,
7095 pub language: Option<String>,
7096 pub security: Option<FunctionSecurity>,
7097 #[serde(default)]
7099 pub return_type: Option<DataType>,
7100 #[serde(default)]
7102 pub execute_as: Option<String>,
7103 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7105 pub with_options: Vec<String>,
7106 #[serde(default = "default_true", skip_serializing_if = "is_true")]
7108 pub has_parens: bool,
7109 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
7111 pub use_proc_keyword: bool,
7112}
7113
7114impl CreateProcedure {
7115 pub fn new(name: impl Into<String>) -> Self {
7116 Self {
7117 name: TableRef::new(name),
7118 parameters: Vec::new(),
7119 body: None,
7120 or_replace: false,
7121 if_not_exists: false,
7122 language: None,
7123 security: None,
7124 return_type: None,
7125 execute_as: None,
7126 with_options: Vec::new(),
7127 has_parens: true,
7128 use_proc_keyword: false,
7129 }
7130 }
7131}
7132
7133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7135#[cfg_attr(feature = "bindings", derive(TS))]
7136pub struct DropProcedure {
7137 pub name: TableRef,
7138 pub parameters: Option<Vec<DataType>>,
7139 pub if_exists: bool,
7140 pub cascade: bool,
7141}
7142
7143impl DropProcedure {
7144 pub fn new(name: impl Into<String>) -> Self {
7145 Self {
7146 name: TableRef::new(name),
7147 parameters: None,
7148 if_exists: false,
7149 cascade: false,
7150 }
7151 }
7152}
7153
7154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7156#[cfg_attr(feature = "bindings", derive(TS))]
7157pub enum SeqPropKind {
7158 Start,
7159 Increment,
7160 Minvalue,
7161 Maxvalue,
7162 Cache,
7163 NoCache,
7164 Cycle,
7165 NoCycle,
7166 OwnedBy,
7167 Order,
7168 NoOrder,
7169 Comment,
7170 Sharing,
7172 Keep,
7174 NoKeep,
7176 Scale,
7178 NoScale,
7180 Shard,
7182 NoShard,
7184 Session,
7186 Global,
7188 NoCacheWord,
7190 NoCycleWord,
7192 NoMinvalueWord,
7194 NoMaxvalueWord,
7196}
7197
7198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7200#[cfg_attr(feature = "bindings", derive(TS))]
7201pub struct CreateSequence {
7202 pub name: TableRef,
7203 pub if_not_exists: bool,
7204 pub temporary: bool,
7205 #[serde(default)]
7206 pub or_replace: bool,
7207 #[serde(default, skip_serializing_if = "Option::is_none")]
7209 pub as_type: Option<DataType>,
7210 pub increment: Option<i64>,
7211 pub minvalue: Option<SequenceBound>,
7212 pub maxvalue: Option<SequenceBound>,
7213 pub start: Option<i64>,
7214 pub cache: Option<i64>,
7215 pub cycle: bool,
7216 pub owned_by: Option<TableRef>,
7217 #[serde(default)]
7219 pub owned_by_none: bool,
7220 #[serde(default)]
7222 pub order: Option<bool>,
7223 #[serde(default)]
7225 pub comment: Option<String>,
7226 #[serde(default, skip_serializing_if = "Option::is_none")]
7228 pub sharing: Option<String>,
7229 #[serde(default, skip_serializing_if = "Option::is_none")]
7231 pub scale_modifier: Option<String>,
7232 #[serde(default, skip_serializing_if = "Option::is_none")]
7234 pub shard_modifier: Option<String>,
7235 #[serde(default)]
7237 pub property_order: Vec<SeqPropKind>,
7238}
7239
7240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7242#[cfg_attr(feature = "bindings", derive(TS))]
7243pub enum SequenceBound {
7244 Value(i64),
7245 None,
7246}
7247
7248impl CreateSequence {
7249 pub fn new(name: impl Into<String>) -> Self {
7250 Self {
7251 name: TableRef::new(name),
7252 if_not_exists: false,
7253 temporary: false,
7254 or_replace: false,
7255 as_type: None,
7256 increment: None,
7257 minvalue: None,
7258 maxvalue: None,
7259 start: None,
7260 cache: None,
7261 cycle: false,
7262 owned_by: None,
7263 owned_by_none: false,
7264 order: None,
7265 comment: None,
7266 sharing: None,
7267 scale_modifier: None,
7268 shard_modifier: None,
7269 property_order: Vec::new(),
7270 }
7271 }
7272}
7273
7274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7276#[cfg_attr(feature = "bindings", derive(TS))]
7277pub struct DropSequence {
7278 pub name: TableRef,
7279 pub if_exists: bool,
7280 pub cascade: bool,
7281}
7282
7283impl DropSequence {
7284 pub fn new(name: impl Into<String>) -> Self {
7285 Self {
7286 name: TableRef::new(name),
7287 if_exists: false,
7288 cascade: false,
7289 }
7290 }
7291}
7292
7293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7295#[cfg_attr(feature = "bindings", derive(TS))]
7296pub struct AlterSequence {
7297 pub name: TableRef,
7298 pub if_exists: bool,
7299 pub increment: Option<i64>,
7300 pub minvalue: Option<SequenceBound>,
7301 pub maxvalue: Option<SequenceBound>,
7302 pub start: Option<i64>,
7303 pub restart: Option<Option<i64>>,
7304 pub cache: Option<i64>,
7305 pub cycle: Option<bool>,
7306 pub owned_by: Option<Option<TableRef>>,
7307}
7308
7309impl AlterSequence {
7310 pub fn new(name: impl Into<String>) -> Self {
7311 Self {
7312 name: TableRef::new(name),
7313 if_exists: false,
7314 increment: None,
7315 minvalue: None,
7316 maxvalue: None,
7317 start: None,
7318 restart: None,
7319 cache: None,
7320 cycle: None,
7321 owned_by: None,
7322 }
7323 }
7324}
7325
7326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7328#[cfg_attr(feature = "bindings", derive(TS))]
7329pub struct CreateTrigger {
7330 pub name: Identifier,
7331 pub table: TableRef,
7332 pub timing: TriggerTiming,
7333 pub events: Vec<TriggerEvent>,
7334 pub for_each: TriggerForEach,
7335 pub when: Option<Expression>,
7336 pub body: TriggerBody,
7337 pub or_replace: bool,
7338 pub constraint: bool,
7339 pub deferrable: Option<bool>,
7340 pub initially_deferred: Option<bool>,
7341 pub referencing: Option<TriggerReferencing>,
7342}
7343
7344#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7346#[cfg_attr(feature = "bindings", derive(TS))]
7347pub enum TriggerTiming {
7348 Before,
7349 After,
7350 InsteadOf,
7351}
7352
7353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7355#[cfg_attr(feature = "bindings", derive(TS))]
7356pub enum TriggerEvent {
7357 Insert,
7358 Update(Option<Vec<Identifier>>),
7359 Delete,
7360 Truncate,
7361}
7362
7363#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7365#[cfg_attr(feature = "bindings", derive(TS))]
7366pub enum TriggerForEach {
7367 Row,
7368 Statement,
7369}
7370
7371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7373#[cfg_attr(feature = "bindings", derive(TS))]
7374pub enum TriggerBody {
7375 Execute {
7377 function: TableRef,
7378 args: Vec<Expression>,
7379 },
7380 Block(String),
7382}
7383
7384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7386#[cfg_attr(feature = "bindings", derive(TS))]
7387pub struct TriggerReferencing {
7388 pub old_table: Option<Identifier>,
7389 pub new_table: Option<Identifier>,
7390 pub old_row: Option<Identifier>,
7391 pub new_row: Option<Identifier>,
7392}
7393
7394impl CreateTrigger {
7395 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
7396 Self {
7397 name: Identifier::new(name),
7398 table: TableRef::new(table),
7399 timing: TriggerTiming::Before,
7400 events: Vec::new(),
7401 for_each: TriggerForEach::Row,
7402 when: None,
7403 body: TriggerBody::Execute {
7404 function: TableRef::new(""),
7405 args: Vec::new(),
7406 },
7407 or_replace: false,
7408 constraint: false,
7409 deferrable: None,
7410 initially_deferred: None,
7411 referencing: None,
7412 }
7413 }
7414}
7415
7416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7418#[cfg_attr(feature = "bindings", derive(TS))]
7419pub struct DropTrigger {
7420 pub name: Identifier,
7421 pub table: Option<TableRef>,
7422 pub if_exists: bool,
7423 pub cascade: bool,
7424}
7425
7426impl DropTrigger {
7427 pub fn new(name: impl Into<String>) -> Self {
7428 Self {
7429 name: Identifier::new(name),
7430 table: None,
7431 if_exists: false,
7432 cascade: false,
7433 }
7434 }
7435}
7436
7437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7439#[cfg_attr(feature = "bindings", derive(TS))]
7440pub struct CreateType {
7441 pub name: TableRef,
7442 pub definition: TypeDefinition,
7443 pub if_not_exists: bool,
7444}
7445
7446#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7448#[cfg_attr(feature = "bindings", derive(TS))]
7449pub enum TypeDefinition {
7450 Enum(Vec<String>),
7452 Composite(Vec<TypeAttribute>),
7454 Range {
7456 subtype: DataType,
7457 subtype_diff: Option<String>,
7458 canonical: Option<String>,
7459 },
7460 Base {
7462 input: String,
7463 output: String,
7464 internallength: Option<i32>,
7465 },
7466 Domain {
7468 base_type: DataType,
7469 default: Option<Expression>,
7470 constraints: Vec<DomainConstraint>,
7471 },
7472}
7473
7474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7476#[cfg_attr(feature = "bindings", derive(TS))]
7477pub struct TypeAttribute {
7478 pub name: Identifier,
7479 pub data_type: DataType,
7480 pub collate: Option<Identifier>,
7481}
7482
7483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7485#[cfg_attr(feature = "bindings", derive(TS))]
7486pub struct DomainConstraint {
7487 pub name: Option<Identifier>,
7488 pub check: Expression,
7489}
7490
7491impl CreateType {
7492 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
7493 Self {
7494 name: TableRef::new(name),
7495 definition: TypeDefinition::Enum(values),
7496 if_not_exists: false,
7497 }
7498 }
7499
7500 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
7501 Self {
7502 name: TableRef::new(name),
7503 definition: TypeDefinition::Composite(attributes),
7504 if_not_exists: false,
7505 }
7506 }
7507}
7508
7509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7511#[cfg_attr(feature = "bindings", derive(TS))]
7512pub struct DropType {
7513 pub name: TableRef,
7514 pub if_exists: bool,
7515 pub cascade: bool,
7516}
7517
7518impl DropType {
7519 pub fn new(name: impl Into<String>) -> Self {
7520 Self {
7521 name: TableRef::new(name),
7522 if_exists: false,
7523 cascade: false,
7524 }
7525 }
7526}
7527
7528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7530#[cfg_attr(feature = "bindings", derive(TS))]
7531pub struct Describe {
7532 pub target: Expression,
7534 pub extended: bool,
7536 pub formatted: bool,
7538 #[serde(default)]
7540 pub kind: Option<String>,
7541 #[serde(default)]
7543 pub properties: Vec<(String, String)>,
7544 #[serde(default, skip_serializing_if = "Option::is_none")]
7546 pub style: Option<String>,
7547 #[serde(default)]
7549 pub partition: Option<Box<Expression>>,
7550 #[serde(default)]
7552 pub leading_comments: Vec<String>,
7553 #[serde(default)]
7555 pub as_json: bool,
7556}
7557
7558impl Describe {
7559 pub fn new(target: Expression) -> Self {
7560 Self {
7561 target,
7562 extended: false,
7563 formatted: false,
7564 kind: None,
7565 properties: Vec::new(),
7566 style: None,
7567 partition: None,
7568 leading_comments: Vec::new(),
7569 as_json: false,
7570 }
7571 }
7572}
7573
7574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7576#[cfg_attr(feature = "bindings", derive(TS))]
7577pub struct Show {
7578 pub this: String,
7580 #[serde(default)]
7582 pub terse: bool,
7583 #[serde(default)]
7585 pub history: bool,
7586 pub like: Option<Expression>,
7588 pub scope_kind: Option<String>,
7590 pub scope: Option<Expression>,
7592 pub starts_with: Option<Expression>,
7594 pub limit: Option<Box<Limit>>,
7596 pub from: Option<Expression>,
7598 #[serde(default, skip_serializing_if = "Option::is_none")]
7600 pub where_clause: Option<Expression>,
7601 #[serde(default, skip_serializing_if = "Option::is_none")]
7603 pub for_target: Option<Expression>,
7604 #[serde(default, skip_serializing_if = "Option::is_none")]
7606 pub db: Option<Expression>,
7607 #[serde(default, skip_serializing_if = "Option::is_none")]
7609 pub target: Option<Expression>,
7610 #[serde(default, skip_serializing_if = "Option::is_none")]
7612 pub mutex: Option<bool>,
7613 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7615 pub privileges: Vec<String>,
7616}
7617
7618impl Show {
7619 pub fn new(this: impl Into<String>) -> Self {
7620 Self {
7621 this: this.into(),
7622 terse: false,
7623 history: false,
7624 like: None,
7625 scope_kind: None,
7626 scope: None,
7627 starts_with: None,
7628 limit: None,
7629 from: None,
7630 where_clause: None,
7631 for_target: None,
7632 db: None,
7633 target: None,
7634 mutex: None,
7635 privileges: Vec::new(),
7636 }
7637 }
7638}
7639
7640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7645#[cfg_attr(feature = "bindings", derive(TS))]
7646pub struct Paren {
7647 pub this: Expression,
7649 #[serde(default)]
7650 pub trailing_comments: Vec<String>,
7651}
7652
7653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7655#[cfg_attr(feature = "bindings", derive(TS))]
7656pub struct Annotated {
7657 pub this: Expression,
7658 pub trailing_comments: Vec<String>,
7659}
7660
7661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7666#[cfg_attr(feature = "bindings", derive(TS))]
7667pub struct Refresh {
7668 pub this: Box<Expression>,
7669 pub kind: String,
7670}
7671
7672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7674#[cfg_attr(feature = "bindings", derive(TS))]
7675pub struct LockingStatement {
7676 pub this: Box<Expression>,
7677 pub expression: Box<Expression>,
7678}
7679
7680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7682#[cfg_attr(feature = "bindings", derive(TS))]
7683pub struct SequenceProperties {
7684 #[serde(default)]
7685 pub increment: Option<Box<Expression>>,
7686 #[serde(default)]
7687 pub minvalue: Option<Box<Expression>>,
7688 #[serde(default)]
7689 pub maxvalue: Option<Box<Expression>>,
7690 #[serde(default)]
7691 pub cache: Option<Box<Expression>>,
7692 #[serde(default)]
7693 pub start: Option<Box<Expression>>,
7694 #[serde(default)]
7695 pub owned: Option<Box<Expression>>,
7696 #[serde(default)]
7697 pub options: Vec<Expression>,
7698}
7699
7700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7702#[cfg_attr(feature = "bindings", derive(TS))]
7703pub struct TruncateTable {
7704 #[serde(default)]
7705 pub expressions: Vec<Expression>,
7706 #[serde(default)]
7707 pub is_database: Option<Box<Expression>>,
7708 #[serde(default)]
7709 pub exists: bool,
7710 #[serde(default)]
7711 pub only: Option<Box<Expression>>,
7712 #[serde(default)]
7713 pub cluster: Option<Box<Expression>>,
7714 #[serde(default)]
7715 pub identity: Option<Box<Expression>>,
7716 #[serde(default)]
7717 pub option: Option<Box<Expression>>,
7718 #[serde(default)]
7719 pub partition: Option<Box<Expression>>,
7720}
7721
7722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7724#[cfg_attr(feature = "bindings", derive(TS))]
7725pub struct Clone {
7726 pub this: Box<Expression>,
7727 #[serde(default)]
7728 pub shallow: Option<Box<Expression>>,
7729 #[serde(default)]
7730 pub copy: Option<Box<Expression>>,
7731}
7732
7733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7735#[cfg_attr(feature = "bindings", derive(TS))]
7736pub struct Attach {
7737 pub this: Box<Expression>,
7738 #[serde(default)]
7739 pub exists: bool,
7740 #[serde(default)]
7741 pub expressions: Vec<Expression>,
7742}
7743
7744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7746#[cfg_attr(feature = "bindings", derive(TS))]
7747pub struct Detach {
7748 pub this: Box<Expression>,
7749 #[serde(default)]
7750 pub exists: bool,
7751}
7752
7753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7755#[cfg_attr(feature = "bindings", derive(TS))]
7756pub struct Install {
7757 pub this: Box<Expression>,
7758 #[serde(default)]
7759 pub from_: Option<Box<Expression>>,
7760 #[serde(default)]
7761 pub force: Option<Box<Expression>>,
7762}
7763
7764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7766#[cfg_attr(feature = "bindings", derive(TS))]
7767pub struct Summarize {
7768 pub this: Box<Expression>,
7769 #[serde(default)]
7770 pub table: Option<Box<Expression>>,
7771}
7772
7773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7775#[cfg_attr(feature = "bindings", derive(TS))]
7776pub struct Declare {
7777 #[serde(default)]
7778 pub expressions: Vec<Expression>,
7779}
7780
7781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7783#[cfg_attr(feature = "bindings", derive(TS))]
7784pub struct DeclareItem {
7785 pub this: Box<Expression>,
7786 #[serde(default)]
7787 pub kind: Option<String>,
7788 #[serde(default)]
7789 pub default: Option<Box<Expression>>,
7790 #[serde(default)]
7791 pub has_as: bool,
7792 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7794 pub additional_names: Vec<Expression>,
7795}
7796
7797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7799#[cfg_attr(feature = "bindings", derive(TS))]
7800pub struct Set {
7801 #[serde(default)]
7802 pub expressions: Vec<Expression>,
7803 #[serde(default)]
7804 pub unset: Option<Box<Expression>>,
7805 #[serde(default)]
7806 pub tag: Option<Box<Expression>>,
7807}
7808
7809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7811#[cfg_attr(feature = "bindings", derive(TS))]
7812pub struct Heredoc {
7813 pub this: Box<Expression>,
7814 #[serde(default)]
7815 pub tag: Option<Box<Expression>>,
7816}
7817
7818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7820#[cfg_attr(feature = "bindings", derive(TS))]
7821pub struct QueryBand {
7822 pub this: Box<Expression>,
7823 #[serde(default)]
7824 pub scope: Option<Box<Expression>>,
7825 #[serde(default)]
7826 pub update: Option<Box<Expression>>,
7827}
7828
7829#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7831#[cfg_attr(feature = "bindings", derive(TS))]
7832pub struct UserDefinedFunction {
7833 pub this: Box<Expression>,
7834 #[serde(default)]
7835 pub expressions: Vec<Expression>,
7836 #[serde(default)]
7837 pub wrapped: Option<Box<Expression>>,
7838}
7839
7840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7842#[cfg_attr(feature = "bindings", derive(TS))]
7843pub struct RecursiveWithSearch {
7844 pub kind: String,
7845 pub this: Box<Expression>,
7846 pub expression: Box<Expression>,
7847 #[serde(default)]
7848 pub using: Option<Box<Expression>>,
7849}
7850
7851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7853#[cfg_attr(feature = "bindings", derive(TS))]
7854pub struct ProjectionDef {
7855 pub this: Box<Expression>,
7856 pub expression: Box<Expression>,
7857}
7858
7859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7861#[cfg_attr(feature = "bindings", derive(TS))]
7862pub struct TableAlias {
7863 #[serde(default)]
7864 pub this: Option<Box<Expression>>,
7865 #[serde(default)]
7866 pub columns: Vec<Expression>,
7867}
7868
7869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7871#[cfg_attr(feature = "bindings", derive(TS))]
7872pub struct ByteString {
7873 pub this: Box<Expression>,
7874 #[serde(default)]
7875 pub is_bytes: Option<Box<Expression>>,
7876}
7877
7878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7881#[cfg_attr(feature = "bindings", derive(TS))]
7882pub struct HexStringExpr {
7883 pub this: Box<Expression>,
7884 #[serde(default)]
7885 pub is_integer: Option<bool>,
7886}
7887
7888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7890#[cfg_attr(feature = "bindings", derive(TS))]
7891pub struct UnicodeString {
7892 pub this: Box<Expression>,
7893 #[serde(default)]
7894 pub escape: Option<Box<Expression>>,
7895}
7896
7897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7899#[cfg_attr(feature = "bindings", derive(TS))]
7900pub struct AlterColumn {
7901 pub this: Box<Expression>,
7902 #[serde(default)]
7903 pub dtype: Option<Box<Expression>>,
7904 #[serde(default)]
7905 pub collate: Option<Box<Expression>>,
7906 #[serde(default)]
7907 pub using: Option<Box<Expression>>,
7908 #[serde(default)]
7909 pub default: Option<Box<Expression>>,
7910 #[serde(default)]
7911 pub drop: Option<Box<Expression>>,
7912 #[serde(default)]
7913 pub comment: Option<Box<Expression>>,
7914 #[serde(default)]
7915 pub allow_null: Option<Box<Expression>>,
7916 #[serde(default)]
7917 pub visible: Option<Box<Expression>>,
7918 #[serde(default)]
7919 pub rename_to: Option<Box<Expression>>,
7920}
7921
7922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7924#[cfg_attr(feature = "bindings", derive(TS))]
7925pub struct AlterSortKey {
7926 #[serde(default)]
7927 pub this: Option<Box<Expression>>,
7928 #[serde(default)]
7929 pub expressions: Vec<Expression>,
7930 #[serde(default)]
7931 pub compound: Option<Box<Expression>>,
7932}
7933
7934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7936#[cfg_attr(feature = "bindings", derive(TS))]
7937pub struct AlterSet {
7938 #[serde(default)]
7939 pub expressions: Vec<Expression>,
7940 #[serde(default)]
7941 pub option: Option<Box<Expression>>,
7942 #[serde(default)]
7943 pub tablespace: Option<Box<Expression>>,
7944 #[serde(default)]
7945 pub access_method: Option<Box<Expression>>,
7946 #[serde(default)]
7947 pub file_format: Option<Box<Expression>>,
7948 #[serde(default)]
7949 pub copy_options: Option<Box<Expression>>,
7950 #[serde(default)]
7951 pub tag: Option<Box<Expression>>,
7952 #[serde(default)]
7953 pub location: Option<Box<Expression>>,
7954 #[serde(default)]
7955 pub serde: Option<Box<Expression>>,
7956}
7957
7958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7960#[cfg_attr(feature = "bindings", derive(TS))]
7961pub struct RenameColumn {
7962 pub this: Box<Expression>,
7963 #[serde(default)]
7964 pub to: Option<Box<Expression>>,
7965 #[serde(default)]
7966 pub exists: bool,
7967}
7968
7969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7971#[cfg_attr(feature = "bindings", derive(TS))]
7972pub struct Comprehension {
7973 pub this: Box<Expression>,
7974 pub expression: Box<Expression>,
7975 #[serde(default)]
7976 pub position: Option<Box<Expression>>,
7977 #[serde(default)]
7978 pub iterator: Option<Box<Expression>>,
7979 #[serde(default)]
7980 pub condition: Option<Box<Expression>>,
7981}
7982
7983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7985#[cfg_attr(feature = "bindings", derive(TS))]
7986pub struct MergeTreeTTLAction {
7987 pub this: Box<Expression>,
7988 #[serde(default)]
7989 pub delete: Option<Box<Expression>>,
7990 #[serde(default)]
7991 pub recompress: Option<Box<Expression>>,
7992 #[serde(default)]
7993 pub to_disk: Option<Box<Expression>>,
7994 #[serde(default)]
7995 pub to_volume: Option<Box<Expression>>,
7996}
7997
7998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8000#[cfg_attr(feature = "bindings", derive(TS))]
8001pub struct MergeTreeTTL {
8002 #[serde(default)]
8003 pub expressions: Vec<Expression>,
8004 #[serde(default)]
8005 pub where_: Option<Box<Expression>>,
8006 #[serde(default)]
8007 pub group: Option<Box<Expression>>,
8008 #[serde(default)]
8009 pub aggregates: Option<Box<Expression>>,
8010}
8011
8012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8014#[cfg_attr(feature = "bindings", derive(TS))]
8015pub struct IndexConstraintOption {
8016 #[serde(default)]
8017 pub key_block_size: Option<Box<Expression>>,
8018 #[serde(default)]
8019 pub using: Option<Box<Expression>>,
8020 #[serde(default)]
8021 pub parser: Option<Box<Expression>>,
8022 #[serde(default)]
8023 pub comment: Option<Box<Expression>>,
8024 #[serde(default)]
8025 pub visible: Option<Box<Expression>>,
8026 #[serde(default)]
8027 pub engine_attr: Option<Box<Expression>>,
8028 #[serde(default)]
8029 pub secondary_engine_attr: Option<Box<Expression>>,
8030}
8031
8032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8034#[cfg_attr(feature = "bindings", derive(TS))]
8035pub struct PeriodForSystemTimeConstraint {
8036 pub this: Box<Expression>,
8037 pub expression: Box<Expression>,
8038}
8039
8040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8042#[cfg_attr(feature = "bindings", derive(TS))]
8043pub struct CaseSpecificColumnConstraint {
8044 #[serde(default)]
8045 pub not_: Option<Box<Expression>>,
8046}
8047
8048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8050#[cfg_attr(feature = "bindings", derive(TS))]
8051pub struct CharacterSetColumnConstraint {
8052 pub this: Box<Expression>,
8053}
8054
8055#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8057#[cfg_attr(feature = "bindings", derive(TS))]
8058pub struct CheckColumnConstraint {
8059 pub this: Box<Expression>,
8060 #[serde(default)]
8061 pub enforced: Option<Box<Expression>>,
8062}
8063
8064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8066#[cfg_attr(feature = "bindings", derive(TS))]
8067pub struct CompressColumnConstraint {
8068 #[serde(default)]
8069 pub this: Option<Box<Expression>>,
8070}
8071
8072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8074#[cfg_attr(feature = "bindings", derive(TS))]
8075pub struct DateFormatColumnConstraint {
8076 pub this: Box<Expression>,
8077}
8078
8079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8081#[cfg_attr(feature = "bindings", derive(TS))]
8082pub struct EphemeralColumnConstraint {
8083 #[serde(default)]
8084 pub this: Option<Box<Expression>>,
8085}
8086
8087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8089#[cfg_attr(feature = "bindings", derive(TS))]
8090pub struct WithOperator {
8091 pub this: Box<Expression>,
8092 pub op: String,
8093}
8094
8095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8097#[cfg_attr(feature = "bindings", derive(TS))]
8098pub struct GeneratedAsIdentityColumnConstraint {
8099 #[serde(default)]
8100 pub this: Option<Box<Expression>>,
8101 #[serde(default)]
8102 pub expression: Option<Box<Expression>>,
8103 #[serde(default)]
8104 pub on_null: Option<Box<Expression>>,
8105 #[serde(default)]
8106 pub start: Option<Box<Expression>>,
8107 #[serde(default)]
8108 pub increment: Option<Box<Expression>>,
8109 #[serde(default)]
8110 pub minvalue: Option<Box<Expression>>,
8111 #[serde(default)]
8112 pub maxvalue: Option<Box<Expression>>,
8113 #[serde(default)]
8114 pub cycle: Option<Box<Expression>>,
8115 #[serde(default)]
8116 pub order: Option<Box<Expression>>,
8117}
8118
8119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8122#[cfg_attr(feature = "bindings", derive(TS))]
8123pub struct AutoIncrementColumnConstraint;
8124
8125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8127#[cfg_attr(feature = "bindings", derive(TS))]
8128pub struct CommentColumnConstraint;
8129
8130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8132#[cfg_attr(feature = "bindings", derive(TS))]
8133pub struct GeneratedAsRowColumnConstraint {
8134 #[serde(default)]
8135 pub start: Option<Box<Expression>>,
8136 #[serde(default)]
8137 pub hidden: Option<Box<Expression>>,
8138}
8139
8140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8142#[cfg_attr(feature = "bindings", derive(TS))]
8143pub struct IndexColumnConstraint {
8144 #[serde(default)]
8145 pub this: Option<Box<Expression>>,
8146 #[serde(default)]
8147 pub expressions: Vec<Expression>,
8148 #[serde(default)]
8149 pub kind: Option<String>,
8150 #[serde(default)]
8151 pub index_type: Option<Box<Expression>>,
8152 #[serde(default)]
8153 pub options: Vec<Expression>,
8154 #[serde(default)]
8155 pub expression: Option<Box<Expression>>,
8156 #[serde(default)]
8157 pub granularity: Option<Box<Expression>>,
8158}
8159
8160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8162#[cfg_attr(feature = "bindings", derive(TS))]
8163pub struct MaskingPolicyColumnConstraint {
8164 pub this: Box<Expression>,
8165 #[serde(default)]
8166 pub expressions: Vec<Expression>,
8167}
8168
8169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8171#[cfg_attr(feature = "bindings", derive(TS))]
8172pub struct NotNullColumnConstraint {
8173 #[serde(default)]
8174 pub allow_null: Option<Box<Expression>>,
8175}
8176
8177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8179#[cfg_attr(feature = "bindings", derive(TS))]
8180pub struct DefaultColumnConstraint {
8181 pub this: Box<Expression>,
8182}
8183
8184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8186#[cfg_attr(feature = "bindings", derive(TS))]
8187pub struct PrimaryKeyColumnConstraint {
8188 #[serde(default)]
8189 pub desc: Option<Box<Expression>>,
8190 #[serde(default)]
8191 pub options: Vec<Expression>,
8192}
8193
8194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8196#[cfg_attr(feature = "bindings", derive(TS))]
8197pub struct UniqueColumnConstraint {
8198 #[serde(default)]
8199 pub this: Option<Box<Expression>>,
8200 #[serde(default)]
8201 pub index_type: Option<Box<Expression>>,
8202 #[serde(default)]
8203 pub on_conflict: Option<Box<Expression>>,
8204 #[serde(default)]
8205 pub nulls: Option<Box<Expression>>,
8206 #[serde(default)]
8207 pub options: Vec<Expression>,
8208}
8209
8210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8212#[cfg_attr(feature = "bindings", derive(TS))]
8213pub struct WatermarkColumnConstraint {
8214 pub this: Box<Expression>,
8215 pub expression: Box<Expression>,
8216}
8217
8218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8220#[cfg_attr(feature = "bindings", derive(TS))]
8221pub struct ComputedColumnConstraint {
8222 pub this: Box<Expression>,
8223 #[serde(default)]
8224 pub persisted: Option<Box<Expression>>,
8225 #[serde(default)]
8226 pub not_null: Option<Box<Expression>>,
8227 #[serde(default)]
8228 pub data_type: Option<Box<Expression>>,
8229}
8230
8231#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8233#[cfg_attr(feature = "bindings", derive(TS))]
8234pub struct InOutColumnConstraint {
8235 #[serde(default)]
8236 pub input_: Option<Box<Expression>>,
8237 #[serde(default)]
8238 pub output: Option<Box<Expression>>,
8239}
8240
8241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8243#[cfg_attr(feature = "bindings", derive(TS))]
8244pub struct PathColumnConstraint {
8245 pub this: Box<Expression>,
8246}
8247
8248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8250#[cfg_attr(feature = "bindings", derive(TS))]
8251pub struct Constraint {
8252 pub this: Box<Expression>,
8253 #[serde(default)]
8254 pub expressions: Vec<Expression>,
8255}
8256
8257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8259#[cfg_attr(feature = "bindings", derive(TS))]
8260pub struct Export {
8261 pub this: Box<Expression>,
8262 #[serde(default)]
8263 pub connection: Option<Box<Expression>>,
8264 #[serde(default)]
8265 pub options: Vec<Expression>,
8266}
8267
8268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8270#[cfg_attr(feature = "bindings", derive(TS))]
8271pub struct Filter {
8272 pub this: Box<Expression>,
8273 pub expression: Box<Expression>,
8274}
8275
8276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8278#[cfg_attr(feature = "bindings", derive(TS))]
8279pub struct Changes {
8280 #[serde(default)]
8281 pub information: Option<Box<Expression>>,
8282 #[serde(default)]
8283 pub at_before: Option<Box<Expression>>,
8284 #[serde(default)]
8285 pub end: Option<Box<Expression>>,
8286}
8287
8288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8290#[cfg_attr(feature = "bindings", derive(TS))]
8291pub struct Directory {
8292 pub this: Box<Expression>,
8293 #[serde(default)]
8294 pub local: Option<Box<Expression>>,
8295 #[serde(default)]
8296 pub row_format: Option<Box<Expression>>,
8297}
8298
8299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8301#[cfg_attr(feature = "bindings", derive(TS))]
8302pub struct ForeignKey {
8303 #[serde(default)]
8304 pub expressions: Vec<Expression>,
8305 #[serde(default)]
8306 pub reference: Option<Box<Expression>>,
8307 #[serde(default)]
8308 pub delete: Option<Box<Expression>>,
8309 #[serde(default)]
8310 pub update: Option<Box<Expression>>,
8311 #[serde(default)]
8312 pub options: Vec<Expression>,
8313}
8314
8315#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8317#[cfg_attr(feature = "bindings", derive(TS))]
8318pub struct ColumnPrefix {
8319 pub this: Box<Expression>,
8320 pub expression: Box<Expression>,
8321}
8322
8323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8325#[cfg_attr(feature = "bindings", derive(TS))]
8326pub struct PrimaryKey {
8327 #[serde(default)]
8328 pub this: Option<Box<Expression>>,
8329 #[serde(default)]
8330 pub expressions: Vec<Expression>,
8331 #[serde(default)]
8332 pub options: Vec<Expression>,
8333 #[serde(default)]
8334 pub include: Option<Box<Expression>>,
8335}
8336
8337#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8339#[cfg_attr(feature = "bindings", derive(TS))]
8340pub struct IntoClause {
8341 #[serde(default)]
8342 pub this: Option<Box<Expression>>,
8343 #[serde(default)]
8344 pub temporary: bool,
8345 #[serde(default)]
8346 pub unlogged: Option<Box<Expression>>,
8347 #[serde(default)]
8348 pub bulk_collect: Option<Box<Expression>>,
8349 #[serde(default)]
8350 pub expressions: Vec<Expression>,
8351}
8352
8353#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8355#[cfg_attr(feature = "bindings", derive(TS))]
8356pub struct JoinHint {
8357 pub this: Box<Expression>,
8358 #[serde(default)]
8359 pub expressions: Vec<Expression>,
8360}
8361
8362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8364#[cfg_attr(feature = "bindings", derive(TS))]
8365pub struct Opclass {
8366 pub this: Box<Expression>,
8367 pub expression: Box<Expression>,
8368}
8369
8370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8372#[cfg_attr(feature = "bindings", derive(TS))]
8373pub struct Index {
8374 #[serde(default)]
8375 pub this: Option<Box<Expression>>,
8376 #[serde(default)]
8377 pub table: Option<Box<Expression>>,
8378 #[serde(default)]
8379 pub unique: bool,
8380 #[serde(default)]
8381 pub primary: Option<Box<Expression>>,
8382 #[serde(default)]
8383 pub amp: Option<Box<Expression>>,
8384 #[serde(default)]
8385 pub params: Vec<Expression>,
8386}
8387
8388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8390#[cfg_attr(feature = "bindings", derive(TS))]
8391pub struct IndexParameters {
8392 #[serde(default)]
8393 pub using: Option<Box<Expression>>,
8394 #[serde(default)]
8395 pub include: Option<Box<Expression>>,
8396 #[serde(default)]
8397 pub columns: Vec<Expression>,
8398 #[serde(default)]
8399 pub with_storage: Option<Box<Expression>>,
8400 #[serde(default)]
8401 pub partition_by: Option<Box<Expression>>,
8402 #[serde(default)]
8403 pub tablespace: Option<Box<Expression>>,
8404 #[serde(default)]
8405 pub where_: Option<Box<Expression>>,
8406 #[serde(default)]
8407 pub on: Option<Box<Expression>>,
8408}
8409
8410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8412#[cfg_attr(feature = "bindings", derive(TS))]
8413pub struct ConditionalInsert {
8414 pub this: Box<Expression>,
8415 #[serde(default)]
8416 pub expression: Option<Box<Expression>>,
8417 #[serde(default)]
8418 pub else_: Option<Box<Expression>>,
8419}
8420
8421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8423#[cfg_attr(feature = "bindings", derive(TS))]
8424pub struct MultitableInserts {
8425 #[serde(default)]
8426 pub expressions: Vec<Expression>,
8427 pub kind: String,
8428 #[serde(default)]
8429 pub source: Option<Box<Expression>>,
8430 #[serde(default)]
8432 pub leading_comments: Vec<String>,
8433}
8434
8435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8437#[cfg_attr(feature = "bindings", derive(TS))]
8438pub struct OnConflict {
8439 #[serde(default)]
8440 pub duplicate: Option<Box<Expression>>,
8441 #[serde(default)]
8442 pub expressions: Vec<Expression>,
8443 #[serde(default)]
8444 pub action: Option<Box<Expression>>,
8445 #[serde(default)]
8446 pub conflict_keys: Option<Box<Expression>>,
8447 #[serde(default)]
8448 pub index_predicate: Option<Box<Expression>>,
8449 #[serde(default)]
8450 pub constraint: Option<Box<Expression>>,
8451 #[serde(default)]
8452 pub where_: Option<Box<Expression>>,
8453}
8454
8455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8457#[cfg_attr(feature = "bindings", derive(TS))]
8458pub struct OnCondition {
8459 #[serde(default)]
8460 pub error: Option<Box<Expression>>,
8461 #[serde(default)]
8462 pub empty: Option<Box<Expression>>,
8463 #[serde(default)]
8464 pub null: Option<Box<Expression>>,
8465}
8466
8467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8469#[cfg_attr(feature = "bindings", derive(TS))]
8470pub struct Returning {
8471 #[serde(default)]
8472 pub expressions: Vec<Expression>,
8473 #[serde(default)]
8474 pub into: Option<Box<Expression>>,
8475}
8476
8477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8479#[cfg_attr(feature = "bindings", derive(TS))]
8480pub struct Introducer {
8481 pub this: Box<Expression>,
8482 pub expression: Box<Expression>,
8483}
8484
8485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8487#[cfg_attr(feature = "bindings", derive(TS))]
8488pub struct PartitionRange {
8489 pub this: Box<Expression>,
8490 #[serde(default)]
8491 pub expression: Option<Box<Expression>>,
8492 #[serde(default)]
8493 pub expressions: Vec<Expression>,
8494}
8495
8496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8498#[cfg_attr(feature = "bindings", derive(TS))]
8499pub struct Group {
8500 #[serde(default)]
8501 pub expressions: Vec<Expression>,
8502 #[serde(default)]
8503 pub grouping_sets: Option<Box<Expression>>,
8504 #[serde(default)]
8505 pub cube: Option<Box<Expression>>,
8506 #[serde(default)]
8507 pub rollup: Option<Box<Expression>>,
8508 #[serde(default)]
8509 pub totals: Option<Box<Expression>>,
8510 #[serde(default)]
8512 pub all: Option<bool>,
8513}
8514
8515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8517#[cfg_attr(feature = "bindings", derive(TS))]
8518pub struct Cube {
8519 #[serde(default)]
8520 pub expressions: Vec<Expression>,
8521}
8522
8523#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8525#[cfg_attr(feature = "bindings", derive(TS))]
8526pub struct Rollup {
8527 #[serde(default)]
8528 pub expressions: Vec<Expression>,
8529}
8530
8531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8533#[cfg_attr(feature = "bindings", derive(TS))]
8534pub struct GroupingSets {
8535 #[serde(default)]
8536 pub expressions: Vec<Expression>,
8537}
8538
8539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8541#[cfg_attr(feature = "bindings", derive(TS))]
8542pub struct LimitOptions {
8543 #[serde(default)]
8544 pub percent: Option<Box<Expression>>,
8545 #[serde(default)]
8546 pub rows: Option<Box<Expression>>,
8547 #[serde(default)]
8548 pub with_ties: Option<Box<Expression>>,
8549}
8550
8551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8553#[cfg_attr(feature = "bindings", derive(TS))]
8554pub struct Lateral {
8555 pub this: Box<Expression>,
8556 #[serde(default)]
8557 pub view: Option<Box<Expression>>,
8558 #[serde(default)]
8559 pub outer: Option<Box<Expression>>,
8560 #[serde(default)]
8561 pub alias: Option<String>,
8562 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8564 pub alias_quoted: bool,
8565 #[serde(default)]
8566 pub cross_apply: Option<Box<Expression>>,
8567 #[serde(default)]
8568 pub ordinality: Option<Box<Expression>>,
8569 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8571 pub column_aliases: Vec<String>,
8572}
8573
8574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8576#[cfg_attr(feature = "bindings", derive(TS))]
8577pub struct TableFromRows {
8578 pub this: Box<Expression>,
8579 #[serde(default)]
8580 pub alias: Option<String>,
8581 #[serde(default)]
8582 pub joins: Vec<Expression>,
8583 #[serde(default)]
8584 pub pivots: Option<Box<Expression>>,
8585 #[serde(default)]
8586 pub sample: Option<Box<Expression>>,
8587}
8588
8589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8592#[cfg_attr(feature = "bindings", derive(TS))]
8593pub struct RowsFrom {
8594 pub expressions: Vec<Expression>,
8596 #[serde(default)]
8598 pub ordinality: bool,
8599 #[serde(default)]
8601 pub alias: Option<Box<Expression>>,
8602}
8603
8604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8606#[cfg_attr(feature = "bindings", derive(TS))]
8607pub struct WithFill {
8608 #[serde(default)]
8609 pub from_: Option<Box<Expression>>,
8610 #[serde(default)]
8611 pub to: Option<Box<Expression>>,
8612 #[serde(default)]
8613 pub step: Option<Box<Expression>>,
8614 #[serde(default)]
8615 pub staleness: Option<Box<Expression>>,
8616 #[serde(default)]
8617 pub interpolate: Option<Box<Expression>>,
8618}
8619
8620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8622#[cfg_attr(feature = "bindings", derive(TS))]
8623pub struct Property {
8624 pub this: Box<Expression>,
8625 #[serde(default)]
8626 pub value: Option<Box<Expression>>,
8627}
8628
8629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8631#[cfg_attr(feature = "bindings", derive(TS))]
8632pub struct GrantPrivilege {
8633 pub this: Box<Expression>,
8634 #[serde(default)]
8635 pub expressions: Vec<Expression>,
8636}
8637
8638#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8640#[cfg_attr(feature = "bindings", derive(TS))]
8641pub struct AllowedValuesProperty {
8642 #[serde(default)]
8643 pub expressions: Vec<Expression>,
8644}
8645
8646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8648#[cfg_attr(feature = "bindings", derive(TS))]
8649pub struct AlgorithmProperty {
8650 pub this: Box<Expression>,
8651}
8652
8653#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8655#[cfg_attr(feature = "bindings", derive(TS))]
8656pub struct AutoIncrementProperty {
8657 pub this: Box<Expression>,
8658}
8659
8660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8662#[cfg_attr(feature = "bindings", derive(TS))]
8663pub struct AutoRefreshProperty {
8664 pub this: Box<Expression>,
8665}
8666
8667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8669#[cfg_attr(feature = "bindings", derive(TS))]
8670pub struct BackupProperty {
8671 pub this: Box<Expression>,
8672}
8673
8674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8676#[cfg_attr(feature = "bindings", derive(TS))]
8677pub struct BuildProperty {
8678 pub this: Box<Expression>,
8679}
8680
8681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8683#[cfg_attr(feature = "bindings", derive(TS))]
8684pub struct BlockCompressionProperty {
8685 #[serde(default)]
8686 pub autotemp: Option<Box<Expression>>,
8687 #[serde(default)]
8688 pub always: Option<Box<Expression>>,
8689 #[serde(default)]
8690 pub default: Option<Box<Expression>>,
8691 #[serde(default)]
8692 pub manual: Option<Box<Expression>>,
8693 #[serde(default)]
8694 pub never: Option<Box<Expression>>,
8695}
8696
8697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8699#[cfg_attr(feature = "bindings", derive(TS))]
8700pub struct CharacterSetProperty {
8701 pub this: Box<Expression>,
8702 #[serde(default)]
8703 pub default: Option<Box<Expression>>,
8704}
8705
8706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8708#[cfg_attr(feature = "bindings", derive(TS))]
8709pub struct ChecksumProperty {
8710 #[serde(default)]
8711 pub on: Option<Box<Expression>>,
8712 #[serde(default)]
8713 pub default: Option<Box<Expression>>,
8714}
8715
8716#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8718#[cfg_attr(feature = "bindings", derive(TS))]
8719pub struct CollateProperty {
8720 pub this: Box<Expression>,
8721 #[serde(default)]
8722 pub default: Option<Box<Expression>>,
8723}
8724
8725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8727#[cfg_attr(feature = "bindings", derive(TS))]
8728pub struct DataBlocksizeProperty {
8729 #[serde(default)]
8730 pub size: Option<i64>,
8731 #[serde(default)]
8732 pub units: Option<Box<Expression>>,
8733 #[serde(default)]
8734 pub minimum: Option<Box<Expression>>,
8735 #[serde(default)]
8736 pub maximum: Option<Box<Expression>>,
8737 #[serde(default)]
8738 pub default: Option<Box<Expression>>,
8739}
8740
8741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8743#[cfg_attr(feature = "bindings", derive(TS))]
8744pub struct DataDeletionProperty {
8745 pub on: Box<Expression>,
8746 #[serde(default)]
8747 pub filter_column: Option<Box<Expression>>,
8748 #[serde(default)]
8749 pub retention_period: Option<Box<Expression>>,
8750}
8751
8752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8754#[cfg_attr(feature = "bindings", derive(TS))]
8755pub struct DefinerProperty {
8756 pub this: Box<Expression>,
8757}
8758
8759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8761#[cfg_attr(feature = "bindings", derive(TS))]
8762pub struct DistKeyProperty {
8763 pub this: Box<Expression>,
8764}
8765
8766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8768#[cfg_attr(feature = "bindings", derive(TS))]
8769pub struct DistributedByProperty {
8770 #[serde(default)]
8771 pub expressions: Vec<Expression>,
8772 pub kind: String,
8773 #[serde(default)]
8774 pub buckets: Option<Box<Expression>>,
8775 #[serde(default)]
8776 pub order: Option<Box<Expression>>,
8777}
8778
8779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8781#[cfg_attr(feature = "bindings", derive(TS))]
8782pub struct DistStyleProperty {
8783 pub this: Box<Expression>,
8784}
8785
8786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8788#[cfg_attr(feature = "bindings", derive(TS))]
8789pub struct DuplicateKeyProperty {
8790 #[serde(default)]
8791 pub expressions: Vec<Expression>,
8792}
8793
8794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8796#[cfg_attr(feature = "bindings", derive(TS))]
8797pub struct EngineProperty {
8798 pub this: Box<Expression>,
8799}
8800
8801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8803#[cfg_attr(feature = "bindings", derive(TS))]
8804pub struct ToTableProperty {
8805 pub this: Box<Expression>,
8806}
8807
8808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8810#[cfg_attr(feature = "bindings", derive(TS))]
8811pub struct ExecuteAsProperty {
8812 pub this: Box<Expression>,
8813}
8814
8815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8817#[cfg_attr(feature = "bindings", derive(TS))]
8818pub struct ExternalProperty {
8819 #[serde(default)]
8820 pub this: Option<Box<Expression>>,
8821}
8822
8823#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8825#[cfg_attr(feature = "bindings", derive(TS))]
8826pub struct FallbackProperty {
8827 #[serde(default)]
8828 pub no: Option<Box<Expression>>,
8829 #[serde(default)]
8830 pub protection: Option<Box<Expression>>,
8831}
8832
8833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8835#[cfg_attr(feature = "bindings", derive(TS))]
8836pub struct FileFormatProperty {
8837 #[serde(default)]
8838 pub this: Option<Box<Expression>>,
8839 #[serde(default)]
8840 pub expressions: Vec<Expression>,
8841 #[serde(default)]
8842 pub hive_format: Option<Box<Expression>>,
8843}
8844
8845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8847#[cfg_attr(feature = "bindings", derive(TS))]
8848pub struct CredentialsProperty {
8849 #[serde(default)]
8850 pub expressions: Vec<Expression>,
8851}
8852
8853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8855#[cfg_attr(feature = "bindings", derive(TS))]
8856pub struct FreespaceProperty {
8857 pub this: Box<Expression>,
8858 #[serde(default)]
8859 pub percent: Option<Box<Expression>>,
8860}
8861
8862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8864#[cfg_attr(feature = "bindings", derive(TS))]
8865pub struct InheritsProperty {
8866 #[serde(default)]
8867 pub expressions: Vec<Expression>,
8868}
8869
8870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8872#[cfg_attr(feature = "bindings", derive(TS))]
8873pub struct InputModelProperty {
8874 pub this: Box<Expression>,
8875}
8876
8877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8879#[cfg_attr(feature = "bindings", derive(TS))]
8880pub struct OutputModelProperty {
8881 pub this: Box<Expression>,
8882}
8883
8884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8886#[cfg_attr(feature = "bindings", derive(TS))]
8887pub struct IsolatedLoadingProperty {
8888 #[serde(default)]
8889 pub no: Option<Box<Expression>>,
8890 #[serde(default)]
8891 pub concurrent: Option<Box<Expression>>,
8892 #[serde(default)]
8893 pub target: Option<Box<Expression>>,
8894}
8895
8896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8898#[cfg_attr(feature = "bindings", derive(TS))]
8899pub struct JournalProperty {
8900 #[serde(default)]
8901 pub no: Option<Box<Expression>>,
8902 #[serde(default)]
8903 pub dual: Option<Box<Expression>>,
8904 #[serde(default)]
8905 pub before: Option<Box<Expression>>,
8906 #[serde(default)]
8907 pub local: Option<Box<Expression>>,
8908 #[serde(default)]
8909 pub after: Option<Box<Expression>>,
8910}
8911
8912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8914#[cfg_attr(feature = "bindings", derive(TS))]
8915pub struct LanguageProperty {
8916 pub this: Box<Expression>,
8917}
8918
8919#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8921#[cfg_attr(feature = "bindings", derive(TS))]
8922pub struct EnviromentProperty {
8923 #[serde(default)]
8924 pub expressions: Vec<Expression>,
8925}
8926
8927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8929#[cfg_attr(feature = "bindings", derive(TS))]
8930pub struct ClusteredByProperty {
8931 #[serde(default)]
8932 pub expressions: Vec<Expression>,
8933 #[serde(default)]
8934 pub sorted_by: Option<Box<Expression>>,
8935 #[serde(default)]
8936 pub buckets: Option<Box<Expression>>,
8937}
8938
8939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8941#[cfg_attr(feature = "bindings", derive(TS))]
8942pub struct DictProperty {
8943 pub this: Box<Expression>,
8944 pub kind: String,
8945 #[serde(default)]
8946 pub settings: Option<Box<Expression>>,
8947}
8948
8949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8951#[cfg_attr(feature = "bindings", derive(TS))]
8952pub struct DictRange {
8953 pub this: Box<Expression>,
8954 #[serde(default)]
8955 pub min: Option<Box<Expression>>,
8956 #[serde(default)]
8957 pub max: Option<Box<Expression>>,
8958}
8959
8960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8962#[cfg_attr(feature = "bindings", derive(TS))]
8963pub struct OnCluster {
8964 pub this: Box<Expression>,
8965}
8966
8967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8969#[cfg_attr(feature = "bindings", derive(TS))]
8970pub struct LikeProperty {
8971 pub this: Box<Expression>,
8972 #[serde(default)]
8973 pub expressions: Vec<Expression>,
8974}
8975
8976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8978#[cfg_attr(feature = "bindings", derive(TS))]
8979pub struct LocationProperty {
8980 pub this: Box<Expression>,
8981}
8982
8983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8985#[cfg_attr(feature = "bindings", derive(TS))]
8986pub struct LockProperty {
8987 pub this: Box<Expression>,
8988}
8989
8990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8992#[cfg_attr(feature = "bindings", derive(TS))]
8993pub struct LockingProperty {
8994 #[serde(default)]
8995 pub this: Option<Box<Expression>>,
8996 pub kind: String,
8997 #[serde(default)]
8998 pub for_or_in: Option<Box<Expression>>,
8999 #[serde(default)]
9000 pub lock_type: Option<Box<Expression>>,
9001 #[serde(default)]
9002 pub override_: Option<Box<Expression>>,
9003}
9004
9005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9007#[cfg_attr(feature = "bindings", derive(TS))]
9008pub struct LogProperty {
9009 #[serde(default)]
9010 pub no: Option<Box<Expression>>,
9011}
9012
9013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9015#[cfg_attr(feature = "bindings", derive(TS))]
9016pub struct MaterializedProperty {
9017 #[serde(default)]
9018 pub this: Option<Box<Expression>>,
9019}
9020
9021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9023#[cfg_attr(feature = "bindings", derive(TS))]
9024pub struct MergeBlockRatioProperty {
9025 #[serde(default)]
9026 pub this: Option<Box<Expression>>,
9027 #[serde(default)]
9028 pub no: Option<Box<Expression>>,
9029 #[serde(default)]
9030 pub default: Option<Box<Expression>>,
9031 #[serde(default)]
9032 pub percent: Option<Box<Expression>>,
9033}
9034
9035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9037#[cfg_attr(feature = "bindings", derive(TS))]
9038pub struct OnProperty {
9039 pub this: Box<Expression>,
9040}
9041
9042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9044#[cfg_attr(feature = "bindings", derive(TS))]
9045pub struct OnCommitProperty {
9046 #[serde(default)]
9047 pub delete: Option<Box<Expression>>,
9048}
9049
9050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9052#[cfg_attr(feature = "bindings", derive(TS))]
9053pub struct PartitionedByProperty {
9054 pub this: Box<Expression>,
9055}
9056
9057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9059#[cfg_attr(feature = "bindings", derive(TS))]
9060pub struct PartitionedByBucket {
9061 pub this: Box<Expression>,
9062 pub expression: Box<Expression>,
9063}
9064
9065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9067#[cfg_attr(feature = "bindings", derive(TS))]
9068pub struct PartitionByTruncate {
9069 pub this: Box<Expression>,
9070 pub expression: Box<Expression>,
9071}
9072
9073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9075#[cfg_attr(feature = "bindings", derive(TS))]
9076pub struct PartitionByRangeProperty {
9077 #[serde(default)]
9078 pub partition_expressions: Option<Box<Expression>>,
9079 #[serde(default)]
9080 pub create_expressions: Option<Box<Expression>>,
9081}
9082
9083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9085#[cfg_attr(feature = "bindings", derive(TS))]
9086pub struct PartitionByRangePropertyDynamic {
9087 #[serde(default)]
9088 pub this: Option<Box<Expression>>,
9089 #[serde(default)]
9090 pub start: Option<Box<Expression>>,
9091 #[serde(default)]
9093 pub use_start_end: bool,
9094 #[serde(default)]
9095 pub end: Option<Box<Expression>>,
9096 #[serde(default)]
9097 pub every: Option<Box<Expression>>,
9098}
9099
9100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9102#[cfg_attr(feature = "bindings", derive(TS))]
9103pub struct PartitionByListProperty {
9104 #[serde(default)]
9105 pub partition_expressions: Option<Box<Expression>>,
9106 #[serde(default)]
9107 pub create_expressions: Option<Box<Expression>>,
9108}
9109
9110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9112#[cfg_attr(feature = "bindings", derive(TS))]
9113pub struct PartitionList {
9114 pub this: Box<Expression>,
9115 #[serde(default)]
9116 pub expressions: Vec<Expression>,
9117}
9118
9119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9121#[cfg_attr(feature = "bindings", derive(TS))]
9122pub struct Partition {
9123 pub expressions: Vec<Expression>,
9124 #[serde(default)]
9125 pub subpartition: bool,
9126}
9127
9128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9131#[cfg_attr(feature = "bindings", derive(TS))]
9132pub struct RefreshTriggerProperty {
9133 pub method: String,
9135 #[serde(default)]
9137 pub kind: Option<String>,
9138 #[serde(default)]
9140 pub every: Option<Box<Expression>>,
9141 #[serde(default)]
9143 pub unit: Option<String>,
9144 #[serde(default)]
9146 pub starts: Option<Box<Expression>>,
9147}
9148
9149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9151#[cfg_attr(feature = "bindings", derive(TS))]
9152pub struct UniqueKeyProperty {
9153 #[serde(default)]
9154 pub expressions: Vec<Expression>,
9155}
9156
9157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9159#[cfg_attr(feature = "bindings", derive(TS))]
9160pub struct RollupProperty {
9161 pub expressions: Vec<RollupIndex>,
9162}
9163
9164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9166#[cfg_attr(feature = "bindings", derive(TS))]
9167pub struct RollupIndex {
9168 pub name: Identifier,
9169 pub expressions: Vec<Identifier>,
9170}
9171
9172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9174#[cfg_attr(feature = "bindings", derive(TS))]
9175pub struct PartitionBoundSpec {
9176 #[serde(default)]
9177 pub this: Option<Box<Expression>>,
9178 #[serde(default)]
9179 pub expression: Option<Box<Expression>>,
9180 #[serde(default)]
9181 pub from_expressions: Option<Box<Expression>>,
9182 #[serde(default)]
9183 pub to_expressions: Option<Box<Expression>>,
9184}
9185
9186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9188#[cfg_attr(feature = "bindings", derive(TS))]
9189pub struct PartitionedOfProperty {
9190 pub this: Box<Expression>,
9191 pub expression: Box<Expression>,
9192}
9193
9194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9196#[cfg_attr(feature = "bindings", derive(TS))]
9197pub struct RemoteWithConnectionModelProperty {
9198 pub this: Box<Expression>,
9199}
9200
9201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9203#[cfg_attr(feature = "bindings", derive(TS))]
9204pub struct ReturnsProperty {
9205 #[serde(default)]
9206 pub this: Option<Box<Expression>>,
9207 #[serde(default)]
9208 pub is_table: Option<Box<Expression>>,
9209 #[serde(default)]
9210 pub table: Option<Box<Expression>>,
9211 #[serde(default)]
9212 pub null: Option<Box<Expression>>,
9213}
9214
9215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9217#[cfg_attr(feature = "bindings", derive(TS))]
9218pub struct RowFormatProperty {
9219 pub this: Box<Expression>,
9220}
9221
9222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9224#[cfg_attr(feature = "bindings", derive(TS))]
9225pub struct RowFormatDelimitedProperty {
9226 #[serde(default)]
9227 pub fields: Option<Box<Expression>>,
9228 #[serde(default)]
9229 pub escaped: Option<Box<Expression>>,
9230 #[serde(default)]
9231 pub collection_items: Option<Box<Expression>>,
9232 #[serde(default)]
9233 pub map_keys: Option<Box<Expression>>,
9234 #[serde(default)]
9235 pub lines: Option<Box<Expression>>,
9236 #[serde(default)]
9237 pub null: Option<Box<Expression>>,
9238 #[serde(default)]
9239 pub serde: Option<Box<Expression>>,
9240}
9241
9242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9244#[cfg_attr(feature = "bindings", derive(TS))]
9245pub struct RowFormatSerdeProperty {
9246 pub this: Box<Expression>,
9247 #[serde(default)]
9248 pub serde_properties: Option<Box<Expression>>,
9249}
9250
9251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9253#[cfg_attr(feature = "bindings", derive(TS))]
9254pub struct QueryTransform {
9255 #[serde(default)]
9256 pub expressions: Vec<Expression>,
9257 #[serde(default)]
9258 pub command_script: Option<Box<Expression>>,
9259 #[serde(default)]
9260 pub schema: Option<Box<Expression>>,
9261 #[serde(default)]
9262 pub row_format_before: Option<Box<Expression>>,
9263 #[serde(default)]
9264 pub record_writer: Option<Box<Expression>>,
9265 #[serde(default)]
9266 pub row_format_after: Option<Box<Expression>>,
9267 #[serde(default)]
9268 pub record_reader: Option<Box<Expression>>,
9269}
9270
9271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9273#[cfg_attr(feature = "bindings", derive(TS))]
9274pub struct SampleProperty {
9275 pub this: Box<Expression>,
9276}
9277
9278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9280#[cfg_attr(feature = "bindings", derive(TS))]
9281pub struct SecurityProperty {
9282 pub this: Box<Expression>,
9283}
9284
9285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9287#[cfg_attr(feature = "bindings", derive(TS))]
9288pub struct SchemaCommentProperty {
9289 pub this: Box<Expression>,
9290}
9291
9292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9294#[cfg_attr(feature = "bindings", derive(TS))]
9295pub struct SemanticView {
9296 pub this: Box<Expression>,
9297 #[serde(default)]
9298 pub metrics: Option<Box<Expression>>,
9299 #[serde(default)]
9300 pub dimensions: Option<Box<Expression>>,
9301 #[serde(default)]
9302 pub facts: Option<Box<Expression>>,
9303 #[serde(default)]
9304 pub where_: Option<Box<Expression>>,
9305}
9306
9307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9309#[cfg_attr(feature = "bindings", derive(TS))]
9310pub struct SerdeProperties {
9311 #[serde(default)]
9312 pub expressions: Vec<Expression>,
9313 #[serde(default)]
9314 pub with_: Option<Box<Expression>>,
9315}
9316
9317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9319#[cfg_attr(feature = "bindings", derive(TS))]
9320pub struct SetProperty {
9321 #[serde(default)]
9322 pub multi: Option<Box<Expression>>,
9323}
9324
9325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9327#[cfg_attr(feature = "bindings", derive(TS))]
9328pub struct SharingProperty {
9329 #[serde(default)]
9330 pub this: Option<Box<Expression>>,
9331}
9332
9333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9335#[cfg_attr(feature = "bindings", derive(TS))]
9336pub struct SetConfigProperty {
9337 pub this: Box<Expression>,
9338}
9339
9340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9342#[cfg_attr(feature = "bindings", derive(TS))]
9343pub struct SettingsProperty {
9344 #[serde(default)]
9345 pub expressions: Vec<Expression>,
9346}
9347
9348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9350#[cfg_attr(feature = "bindings", derive(TS))]
9351pub struct SortKeyProperty {
9352 pub this: Box<Expression>,
9353 #[serde(default)]
9354 pub compound: Option<Box<Expression>>,
9355}
9356
9357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9359#[cfg_attr(feature = "bindings", derive(TS))]
9360pub struct SqlReadWriteProperty {
9361 pub this: Box<Expression>,
9362}
9363
9364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9366#[cfg_attr(feature = "bindings", derive(TS))]
9367pub struct SqlSecurityProperty {
9368 pub this: Box<Expression>,
9369}
9370
9371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9373#[cfg_attr(feature = "bindings", derive(TS))]
9374pub struct StabilityProperty {
9375 pub this: Box<Expression>,
9376}
9377
9378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9380#[cfg_attr(feature = "bindings", derive(TS))]
9381pub struct StorageHandlerProperty {
9382 pub this: Box<Expression>,
9383}
9384
9385#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9387#[cfg_attr(feature = "bindings", derive(TS))]
9388pub struct TemporaryProperty {
9389 #[serde(default)]
9390 pub this: Option<Box<Expression>>,
9391}
9392
9393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9395#[cfg_attr(feature = "bindings", derive(TS))]
9396pub struct Tags {
9397 #[serde(default)]
9398 pub expressions: Vec<Expression>,
9399}
9400
9401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9403#[cfg_attr(feature = "bindings", derive(TS))]
9404pub struct TransformModelProperty {
9405 #[serde(default)]
9406 pub expressions: Vec<Expression>,
9407}
9408
9409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9411#[cfg_attr(feature = "bindings", derive(TS))]
9412pub struct TransientProperty {
9413 #[serde(default)]
9414 pub this: Option<Box<Expression>>,
9415}
9416
9417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9419#[cfg_attr(feature = "bindings", derive(TS))]
9420pub struct UsingTemplateProperty {
9421 pub this: Box<Expression>,
9422}
9423
9424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9426#[cfg_attr(feature = "bindings", derive(TS))]
9427pub struct ViewAttributeProperty {
9428 pub this: Box<Expression>,
9429}
9430
9431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9433#[cfg_attr(feature = "bindings", derive(TS))]
9434pub struct VolatileProperty {
9435 #[serde(default)]
9436 pub this: Option<Box<Expression>>,
9437}
9438
9439#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9441#[cfg_attr(feature = "bindings", derive(TS))]
9442pub struct WithDataProperty {
9443 #[serde(default)]
9444 pub no: Option<Box<Expression>>,
9445 #[serde(default)]
9446 pub statistics: Option<Box<Expression>>,
9447}
9448
9449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9451#[cfg_attr(feature = "bindings", derive(TS))]
9452pub struct WithJournalTableProperty {
9453 pub this: Box<Expression>,
9454}
9455
9456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9458#[cfg_attr(feature = "bindings", derive(TS))]
9459pub struct WithSchemaBindingProperty {
9460 pub this: Box<Expression>,
9461}
9462
9463#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9465#[cfg_attr(feature = "bindings", derive(TS))]
9466pub struct WithSystemVersioningProperty {
9467 #[serde(default)]
9468 pub on: Option<Box<Expression>>,
9469 #[serde(default)]
9470 pub this: Option<Box<Expression>>,
9471 #[serde(default)]
9472 pub data_consistency: Option<Box<Expression>>,
9473 #[serde(default)]
9474 pub retention_period: Option<Box<Expression>>,
9475 #[serde(default)]
9476 pub with_: Option<Box<Expression>>,
9477}
9478
9479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9481#[cfg_attr(feature = "bindings", derive(TS))]
9482pub struct WithProcedureOptions {
9483 #[serde(default)]
9484 pub expressions: Vec<Expression>,
9485}
9486
9487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9489#[cfg_attr(feature = "bindings", derive(TS))]
9490pub struct EncodeProperty {
9491 pub this: Box<Expression>,
9492 #[serde(default)]
9493 pub properties: Vec<Expression>,
9494 #[serde(default)]
9495 pub key: Option<Box<Expression>>,
9496}
9497
9498#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9500#[cfg_attr(feature = "bindings", derive(TS))]
9501pub struct IncludeProperty {
9502 pub this: Box<Expression>,
9503 #[serde(default)]
9504 pub alias: Option<String>,
9505 #[serde(default)]
9506 pub column_def: Option<Box<Expression>>,
9507}
9508
9509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9511#[cfg_attr(feature = "bindings", derive(TS))]
9512pub struct Properties {
9513 #[serde(default)]
9514 pub expressions: Vec<Expression>,
9515}
9516
9517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9519#[cfg_attr(feature = "bindings", derive(TS))]
9520pub struct InputOutputFormat {
9521 #[serde(default)]
9522 pub input_format: Option<Box<Expression>>,
9523 #[serde(default)]
9524 pub output_format: Option<Box<Expression>>,
9525}
9526
9527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9529#[cfg_attr(feature = "bindings", derive(TS))]
9530pub struct Reference {
9531 pub this: Box<Expression>,
9532 #[serde(default)]
9533 pub expressions: Vec<Expression>,
9534 #[serde(default)]
9535 pub options: Vec<Expression>,
9536}
9537
9538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9540#[cfg_attr(feature = "bindings", derive(TS))]
9541pub struct QueryOption {
9542 pub this: Box<Expression>,
9543 #[serde(default)]
9544 pub expression: Option<Box<Expression>>,
9545}
9546
9547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9549#[cfg_attr(feature = "bindings", derive(TS))]
9550pub struct WithTableHint {
9551 #[serde(default)]
9552 pub expressions: Vec<Expression>,
9553}
9554
9555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9557#[cfg_attr(feature = "bindings", derive(TS))]
9558pub struct IndexTableHint {
9559 pub this: Box<Expression>,
9560 #[serde(default)]
9561 pub expressions: Vec<Expression>,
9562 #[serde(default)]
9563 pub target: Option<Box<Expression>>,
9564}
9565
9566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9568#[cfg_attr(feature = "bindings", derive(TS))]
9569pub struct Get {
9570 pub this: Box<Expression>,
9571 #[serde(default)]
9572 pub target: Option<Box<Expression>>,
9573 #[serde(default)]
9574 pub properties: Vec<Expression>,
9575}
9576
9577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9579#[cfg_attr(feature = "bindings", derive(TS))]
9580pub struct SetOperation {
9581 #[serde(default)]
9582 pub with_: Option<Box<Expression>>,
9583 pub this: Box<Expression>,
9584 pub expression: Box<Expression>,
9585 #[serde(default)]
9586 pub distinct: bool,
9587 #[serde(default)]
9588 pub by_name: Option<Box<Expression>>,
9589 #[serde(default)]
9590 pub side: Option<Box<Expression>>,
9591 #[serde(default)]
9592 pub kind: Option<String>,
9593 #[serde(default)]
9594 pub on: Option<Box<Expression>>,
9595}
9596
9597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9599#[cfg_attr(feature = "bindings", derive(TS))]
9600pub struct Var {
9601 pub this: String,
9602}
9603
9604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9606#[cfg_attr(feature = "bindings", derive(TS))]
9607pub struct Variadic {
9608 pub this: Box<Expression>,
9609}
9610
9611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9613#[cfg_attr(feature = "bindings", derive(TS))]
9614pub struct Version {
9615 pub this: Box<Expression>,
9616 pub kind: String,
9617 #[serde(default)]
9618 pub expression: Option<Box<Expression>>,
9619}
9620
9621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9623#[cfg_attr(feature = "bindings", derive(TS))]
9624pub struct Schema {
9625 #[serde(default)]
9626 pub this: Option<Box<Expression>>,
9627 #[serde(default)]
9628 pub expressions: Vec<Expression>,
9629}
9630
9631#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9633#[cfg_attr(feature = "bindings", derive(TS))]
9634pub struct Lock {
9635 #[serde(default)]
9636 pub update: Option<Box<Expression>>,
9637 #[serde(default)]
9638 pub expressions: Vec<Expression>,
9639 #[serde(default)]
9640 pub wait: Option<Box<Expression>>,
9641 #[serde(default)]
9642 pub key: Option<Box<Expression>>,
9643}
9644
9645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9648#[cfg_attr(feature = "bindings", derive(TS))]
9649pub struct TableSample {
9650 #[serde(default, skip_serializing_if = "Option::is_none")]
9652 pub this: Option<Box<Expression>>,
9653 #[serde(default, skip_serializing_if = "Option::is_none")]
9655 pub sample: Option<Box<Sample>>,
9656 #[serde(default)]
9657 pub expressions: Vec<Expression>,
9658 #[serde(default)]
9659 pub method: Option<String>,
9660 #[serde(default)]
9661 pub bucket_numerator: Option<Box<Expression>>,
9662 #[serde(default)]
9663 pub bucket_denominator: Option<Box<Expression>>,
9664 #[serde(default)]
9665 pub bucket_field: Option<Box<Expression>>,
9666 #[serde(default)]
9667 pub percent: Option<Box<Expression>>,
9668 #[serde(default)]
9669 pub rows: Option<Box<Expression>>,
9670 #[serde(default)]
9671 pub size: Option<i64>,
9672 #[serde(default)]
9673 pub seed: Option<Box<Expression>>,
9674}
9675
9676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9678#[cfg_attr(feature = "bindings", derive(TS))]
9679pub struct Tag {
9680 #[serde(default)]
9681 pub this: Option<Box<Expression>>,
9682 #[serde(default)]
9683 pub prefix: Option<Box<Expression>>,
9684 #[serde(default)]
9685 pub postfix: Option<Box<Expression>>,
9686}
9687
9688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9690#[cfg_attr(feature = "bindings", derive(TS))]
9691pub struct UnpivotColumns {
9692 pub this: Box<Expression>,
9693 #[serde(default)]
9694 pub expressions: Vec<Expression>,
9695}
9696
9697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9699#[cfg_attr(feature = "bindings", derive(TS))]
9700pub struct SessionParameter {
9701 pub this: Box<Expression>,
9702 #[serde(default)]
9703 pub kind: Option<String>,
9704}
9705
9706#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9708#[cfg_attr(feature = "bindings", derive(TS))]
9709pub struct PseudoType {
9710 pub this: Box<Expression>,
9711}
9712
9713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9715#[cfg_attr(feature = "bindings", derive(TS))]
9716pub struct ObjectIdentifier {
9717 pub this: Box<Expression>,
9718}
9719
9720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9722#[cfg_attr(feature = "bindings", derive(TS))]
9723pub struct Transaction {
9724 #[serde(default)]
9725 pub this: Option<Box<Expression>>,
9726 #[serde(default)]
9727 pub modes: Option<Box<Expression>>,
9728 #[serde(default)]
9729 pub mark: Option<Box<Expression>>,
9730}
9731
9732#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9734#[cfg_attr(feature = "bindings", derive(TS))]
9735pub struct Commit {
9736 #[serde(default)]
9737 pub chain: Option<Box<Expression>>,
9738 #[serde(default)]
9739 pub this: Option<Box<Expression>>,
9740 #[serde(default)]
9741 pub durability: Option<Box<Expression>>,
9742}
9743
9744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9746#[cfg_attr(feature = "bindings", derive(TS))]
9747pub struct Rollback {
9748 #[serde(default)]
9749 pub savepoint: Option<Box<Expression>>,
9750 #[serde(default)]
9751 pub this: Option<Box<Expression>>,
9752}
9753
9754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9756#[cfg_attr(feature = "bindings", derive(TS))]
9757pub struct AlterSession {
9758 #[serde(default)]
9759 pub expressions: Vec<Expression>,
9760 #[serde(default)]
9761 pub unset: Option<Box<Expression>>,
9762}
9763
9764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9766#[cfg_attr(feature = "bindings", derive(TS))]
9767pub struct Analyze {
9768 #[serde(default)]
9769 pub kind: Option<String>,
9770 #[serde(default)]
9771 pub this: Option<Box<Expression>>,
9772 #[serde(default)]
9773 pub options: Vec<Expression>,
9774 #[serde(default)]
9775 pub mode: Option<Box<Expression>>,
9776 #[serde(default)]
9777 pub partition: Option<Box<Expression>>,
9778 #[serde(default)]
9779 pub expression: Option<Box<Expression>>,
9780 #[serde(default)]
9781 pub properties: Vec<Expression>,
9782 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9784 pub columns: Vec<String>,
9785}
9786
9787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9789#[cfg_attr(feature = "bindings", derive(TS))]
9790pub struct AnalyzeStatistics {
9791 pub kind: String,
9792 #[serde(default)]
9793 pub option: Option<Box<Expression>>,
9794 #[serde(default)]
9795 pub this: Option<Box<Expression>>,
9796 #[serde(default)]
9797 pub expressions: Vec<Expression>,
9798}
9799
9800#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9802#[cfg_attr(feature = "bindings", derive(TS))]
9803pub struct AnalyzeHistogram {
9804 pub this: Box<Expression>,
9805 #[serde(default)]
9806 pub expressions: Vec<Expression>,
9807 #[serde(default)]
9808 pub expression: Option<Box<Expression>>,
9809 #[serde(default)]
9810 pub update_options: Option<Box<Expression>>,
9811}
9812
9813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9815#[cfg_attr(feature = "bindings", derive(TS))]
9816pub struct AnalyzeSample {
9817 pub kind: String,
9818 #[serde(default)]
9819 pub sample: Option<Box<Expression>>,
9820}
9821
9822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9824#[cfg_attr(feature = "bindings", derive(TS))]
9825pub struct AnalyzeListChainedRows {
9826 #[serde(default)]
9827 pub expression: Option<Box<Expression>>,
9828}
9829
9830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9832#[cfg_attr(feature = "bindings", derive(TS))]
9833pub struct AnalyzeDelete {
9834 #[serde(default)]
9835 pub kind: Option<String>,
9836}
9837
9838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9840#[cfg_attr(feature = "bindings", derive(TS))]
9841pub struct AnalyzeWith {
9842 #[serde(default)]
9843 pub expressions: Vec<Expression>,
9844}
9845
9846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9848#[cfg_attr(feature = "bindings", derive(TS))]
9849pub struct AnalyzeValidate {
9850 pub kind: String,
9851 #[serde(default)]
9852 pub this: Option<Box<Expression>>,
9853 #[serde(default)]
9854 pub expression: Option<Box<Expression>>,
9855}
9856
9857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9859#[cfg_attr(feature = "bindings", derive(TS))]
9860pub struct AddPartition {
9861 pub this: Box<Expression>,
9862 #[serde(default)]
9863 pub exists: bool,
9864 #[serde(default)]
9865 pub location: Option<Box<Expression>>,
9866}
9867
9868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9870#[cfg_attr(feature = "bindings", derive(TS))]
9871pub struct AttachOption {
9872 pub this: Box<Expression>,
9873 #[serde(default)]
9874 pub expression: Option<Box<Expression>>,
9875}
9876
9877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9879#[cfg_attr(feature = "bindings", derive(TS))]
9880pub struct DropPartition {
9881 #[serde(default)]
9882 pub expressions: Vec<Expression>,
9883 #[serde(default)]
9884 pub exists: bool,
9885}
9886
9887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9889#[cfg_attr(feature = "bindings", derive(TS))]
9890pub struct ReplacePartition {
9891 pub expression: Box<Expression>,
9892 #[serde(default)]
9893 pub source: Option<Box<Expression>>,
9894}
9895
9896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9898#[cfg_attr(feature = "bindings", derive(TS))]
9899pub struct DPipe {
9900 pub this: Box<Expression>,
9901 pub expression: Box<Expression>,
9902 #[serde(default)]
9903 pub safe: Option<Box<Expression>>,
9904}
9905
9906#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9908#[cfg_attr(feature = "bindings", derive(TS))]
9909pub struct Operator {
9910 pub this: Box<Expression>,
9911 #[serde(default)]
9912 pub operator: Option<Box<Expression>>,
9913 pub expression: Box<Expression>,
9914 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9916 pub comments: Vec<String>,
9917}
9918
9919#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9921#[cfg_attr(feature = "bindings", derive(TS))]
9922pub struct PivotAny {
9923 #[serde(default)]
9924 pub this: Option<Box<Expression>>,
9925}
9926
9927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9929#[cfg_attr(feature = "bindings", derive(TS))]
9930pub struct Aliases {
9931 pub this: Box<Expression>,
9932 #[serde(default)]
9933 pub expressions: Vec<Expression>,
9934}
9935
9936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9938#[cfg_attr(feature = "bindings", derive(TS))]
9939pub struct AtIndex {
9940 pub this: Box<Expression>,
9941 pub expression: Box<Expression>,
9942}
9943
9944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9946#[cfg_attr(feature = "bindings", derive(TS))]
9947pub struct FromTimeZone {
9948 pub this: Box<Expression>,
9949 #[serde(default)]
9950 pub zone: Option<Box<Expression>>,
9951}
9952
9953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9955#[cfg_attr(feature = "bindings", derive(TS))]
9956pub struct FormatPhrase {
9957 pub this: Box<Expression>,
9958 pub format: String,
9959}
9960
9961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9963#[cfg_attr(feature = "bindings", derive(TS))]
9964pub struct ForIn {
9965 pub this: Box<Expression>,
9966 pub expression: Box<Expression>,
9967}
9968
9969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9971#[cfg_attr(feature = "bindings", derive(TS))]
9972pub struct TimeUnit {
9973 #[serde(default)]
9974 pub unit: Option<String>,
9975}
9976
9977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9979#[cfg_attr(feature = "bindings", derive(TS))]
9980pub struct IntervalOp {
9981 #[serde(default)]
9982 pub unit: Option<String>,
9983 pub expression: Box<Expression>,
9984}
9985
9986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9988#[cfg_attr(feature = "bindings", derive(TS))]
9989pub struct HavingMax {
9990 pub this: Box<Expression>,
9991 pub expression: Box<Expression>,
9992 #[serde(default)]
9993 pub max: Option<Box<Expression>>,
9994}
9995
9996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9998#[cfg_attr(feature = "bindings", derive(TS))]
9999pub struct CosineDistance {
10000 pub this: Box<Expression>,
10001 pub expression: Box<Expression>,
10002}
10003
10004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10006#[cfg_attr(feature = "bindings", derive(TS))]
10007pub struct DotProduct {
10008 pub this: Box<Expression>,
10009 pub expression: Box<Expression>,
10010}
10011
10012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10014#[cfg_attr(feature = "bindings", derive(TS))]
10015pub struct EuclideanDistance {
10016 pub this: Box<Expression>,
10017 pub expression: Box<Expression>,
10018}
10019
10020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10022#[cfg_attr(feature = "bindings", derive(TS))]
10023pub struct ManhattanDistance {
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 JarowinklerSimilarity {
10032 pub this: Box<Expression>,
10033 pub expression: Box<Expression>,
10034}
10035
10036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10038#[cfg_attr(feature = "bindings", derive(TS))]
10039pub struct Booland {
10040 pub this: Box<Expression>,
10041 pub expression: Box<Expression>,
10042}
10043
10044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10046#[cfg_attr(feature = "bindings", derive(TS))]
10047pub struct Boolor {
10048 pub this: Box<Expression>,
10049 pub expression: Box<Expression>,
10050}
10051
10052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10054#[cfg_attr(feature = "bindings", derive(TS))]
10055pub struct ParameterizedAgg {
10056 pub this: Box<Expression>,
10057 #[serde(default)]
10058 pub expressions: Vec<Expression>,
10059 #[serde(default)]
10060 pub params: Vec<Expression>,
10061}
10062
10063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10065#[cfg_attr(feature = "bindings", derive(TS))]
10066pub struct ArgMax {
10067 pub this: Box<Expression>,
10068 pub expression: Box<Expression>,
10069 #[serde(default)]
10070 pub count: Option<Box<Expression>>,
10071}
10072
10073#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10075#[cfg_attr(feature = "bindings", derive(TS))]
10076pub struct ArgMin {
10077 pub this: Box<Expression>,
10078 pub expression: Box<Expression>,
10079 #[serde(default)]
10080 pub count: Option<Box<Expression>>,
10081}
10082
10083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10085#[cfg_attr(feature = "bindings", derive(TS))]
10086pub struct ApproxTopK {
10087 pub this: Box<Expression>,
10088 #[serde(default)]
10089 pub expression: Option<Box<Expression>>,
10090 #[serde(default)]
10091 pub counters: Option<Box<Expression>>,
10092}
10093
10094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10096#[cfg_attr(feature = "bindings", derive(TS))]
10097pub struct ApproxTopKAccumulate {
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 ApproxTopKCombine {
10107 pub this: Box<Expression>,
10108 #[serde(default)]
10109 pub expression: Option<Box<Expression>>,
10110}
10111
10112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10114#[cfg_attr(feature = "bindings", derive(TS))]
10115pub struct ApproxTopKEstimate {
10116 pub this: Box<Expression>,
10117 #[serde(default)]
10118 pub expression: Option<Box<Expression>>,
10119}
10120
10121#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10123#[cfg_attr(feature = "bindings", derive(TS))]
10124pub struct ApproxTopSum {
10125 pub this: Box<Expression>,
10126 pub expression: Box<Expression>,
10127 #[serde(default)]
10128 pub count: Option<Box<Expression>>,
10129}
10130
10131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10133#[cfg_attr(feature = "bindings", derive(TS))]
10134pub struct ApproxQuantiles {
10135 pub this: Box<Expression>,
10136 #[serde(default)]
10137 pub expression: Option<Box<Expression>>,
10138}
10139
10140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10142#[cfg_attr(feature = "bindings", derive(TS))]
10143pub struct Minhash {
10144 pub this: Box<Expression>,
10145 #[serde(default)]
10146 pub expressions: Vec<Expression>,
10147}
10148
10149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10151#[cfg_attr(feature = "bindings", derive(TS))]
10152pub struct FarmFingerprint {
10153 #[serde(default)]
10154 pub expressions: Vec<Expression>,
10155}
10156
10157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10159#[cfg_attr(feature = "bindings", derive(TS))]
10160pub struct Float64 {
10161 pub this: Box<Expression>,
10162 #[serde(default)]
10163 pub expression: Option<Box<Expression>>,
10164}
10165
10166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10168#[cfg_attr(feature = "bindings", derive(TS))]
10169pub struct Transform {
10170 pub this: Box<Expression>,
10171 pub expression: Box<Expression>,
10172}
10173
10174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10176#[cfg_attr(feature = "bindings", derive(TS))]
10177pub struct Translate {
10178 pub this: Box<Expression>,
10179 #[serde(default)]
10180 pub from_: Option<Box<Expression>>,
10181 #[serde(default)]
10182 pub to: Option<Box<Expression>>,
10183}
10184
10185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10187#[cfg_attr(feature = "bindings", derive(TS))]
10188pub struct Grouping {
10189 #[serde(default)]
10190 pub expressions: Vec<Expression>,
10191}
10192
10193#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10195#[cfg_attr(feature = "bindings", derive(TS))]
10196pub struct GroupingId {
10197 #[serde(default)]
10198 pub expressions: Vec<Expression>,
10199}
10200
10201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10203#[cfg_attr(feature = "bindings", derive(TS))]
10204pub struct Anonymous {
10205 pub this: Box<Expression>,
10206 #[serde(default)]
10207 pub expressions: Vec<Expression>,
10208}
10209
10210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10212#[cfg_attr(feature = "bindings", derive(TS))]
10213pub struct AnonymousAggFunc {
10214 pub this: Box<Expression>,
10215 #[serde(default)]
10216 pub expressions: Vec<Expression>,
10217}
10218
10219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10221#[cfg_attr(feature = "bindings", derive(TS))]
10222pub struct CombinedAggFunc {
10223 pub this: Box<Expression>,
10224 #[serde(default)]
10225 pub expressions: Vec<Expression>,
10226}
10227
10228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10230#[cfg_attr(feature = "bindings", derive(TS))]
10231pub struct CombinedParameterizedAgg {
10232 pub this: Box<Expression>,
10233 #[serde(default)]
10234 pub expressions: Vec<Expression>,
10235 #[serde(default)]
10236 pub params: Vec<Expression>,
10237}
10238
10239#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10241#[cfg_attr(feature = "bindings", derive(TS))]
10242pub struct HashAgg {
10243 pub this: Box<Expression>,
10244 #[serde(default)]
10245 pub expressions: Vec<Expression>,
10246}
10247
10248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10250#[cfg_attr(feature = "bindings", derive(TS))]
10251pub struct Hll {
10252 pub this: Box<Expression>,
10253 #[serde(default)]
10254 pub expressions: Vec<Expression>,
10255}
10256
10257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10259#[cfg_attr(feature = "bindings", derive(TS))]
10260pub struct Apply {
10261 pub this: Box<Expression>,
10262 pub expression: Box<Expression>,
10263}
10264
10265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10267#[cfg_attr(feature = "bindings", derive(TS))]
10268pub struct ToBoolean {
10269 pub this: Box<Expression>,
10270 #[serde(default)]
10271 pub safe: Option<Box<Expression>>,
10272}
10273
10274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10276#[cfg_attr(feature = "bindings", derive(TS))]
10277pub struct List {
10278 #[serde(default)]
10279 pub expressions: Vec<Expression>,
10280}
10281
10282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10287#[cfg_attr(feature = "bindings", derive(TS))]
10288pub struct ToMap {
10289 pub this: Box<Expression>,
10291}
10292
10293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10295#[cfg_attr(feature = "bindings", derive(TS))]
10296pub struct Pad {
10297 pub this: Box<Expression>,
10298 pub expression: Box<Expression>,
10299 #[serde(default)]
10300 pub fill_pattern: Option<Box<Expression>>,
10301 #[serde(default)]
10302 pub is_left: Option<Box<Expression>>,
10303}
10304
10305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10307#[cfg_attr(feature = "bindings", derive(TS))]
10308pub struct ToChar {
10309 pub this: Box<Expression>,
10310 #[serde(default)]
10311 pub format: Option<String>,
10312 #[serde(default)]
10313 pub nlsparam: Option<Box<Expression>>,
10314 #[serde(default)]
10315 pub is_numeric: Option<Box<Expression>>,
10316}
10317
10318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10320#[cfg_attr(feature = "bindings", derive(TS))]
10321pub struct StringFunc {
10322 pub this: Box<Expression>,
10323 #[serde(default)]
10324 pub zone: Option<Box<Expression>>,
10325}
10326
10327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10329#[cfg_attr(feature = "bindings", derive(TS))]
10330pub struct ToNumber {
10331 pub this: Box<Expression>,
10332 #[serde(default)]
10333 pub format: Option<Box<Expression>>,
10334 #[serde(default)]
10335 pub nlsparam: Option<Box<Expression>>,
10336 #[serde(default)]
10337 pub precision: Option<Box<Expression>>,
10338 #[serde(default)]
10339 pub scale: Option<Box<Expression>>,
10340 #[serde(default)]
10341 pub safe: Option<Box<Expression>>,
10342 #[serde(default)]
10343 pub safe_name: Option<Box<Expression>>,
10344}
10345
10346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10348#[cfg_attr(feature = "bindings", derive(TS))]
10349pub struct ToDouble {
10350 pub this: Box<Expression>,
10351 #[serde(default)]
10352 pub format: Option<String>,
10353 #[serde(default)]
10354 pub safe: Option<Box<Expression>>,
10355}
10356
10357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10359#[cfg_attr(feature = "bindings", derive(TS))]
10360pub struct ToDecfloat {
10361 pub this: Box<Expression>,
10362 #[serde(default)]
10363 pub format: Option<String>,
10364}
10365
10366#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10368#[cfg_attr(feature = "bindings", derive(TS))]
10369pub struct TryToDecfloat {
10370 pub this: Box<Expression>,
10371 #[serde(default)]
10372 pub format: Option<String>,
10373}
10374
10375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10377#[cfg_attr(feature = "bindings", derive(TS))]
10378pub struct ToFile {
10379 pub this: Box<Expression>,
10380 #[serde(default)]
10381 pub path: Option<Box<Expression>>,
10382 #[serde(default)]
10383 pub safe: Option<Box<Expression>>,
10384}
10385
10386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10388#[cfg_attr(feature = "bindings", derive(TS))]
10389pub struct Columns {
10390 pub this: Box<Expression>,
10391 #[serde(default)]
10392 pub unpack: Option<Box<Expression>>,
10393}
10394
10395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10397#[cfg_attr(feature = "bindings", derive(TS))]
10398pub struct ConvertToCharset {
10399 pub this: Box<Expression>,
10400 #[serde(default)]
10401 pub dest: Option<Box<Expression>>,
10402 #[serde(default)]
10403 pub source: Option<Box<Expression>>,
10404}
10405
10406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10408#[cfg_attr(feature = "bindings", derive(TS))]
10409pub struct ConvertTimezone {
10410 #[serde(default)]
10411 pub source_tz: Option<Box<Expression>>,
10412 #[serde(default)]
10413 pub target_tz: Option<Box<Expression>>,
10414 #[serde(default)]
10415 pub timestamp: Option<Box<Expression>>,
10416 #[serde(default)]
10417 pub options: Vec<Expression>,
10418}
10419
10420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10422#[cfg_attr(feature = "bindings", derive(TS))]
10423pub struct GenerateSeries {
10424 #[serde(default)]
10425 pub start: Option<Box<Expression>>,
10426 #[serde(default)]
10427 pub end: Option<Box<Expression>>,
10428 #[serde(default)]
10429 pub step: Option<Box<Expression>>,
10430 #[serde(default)]
10431 pub is_end_exclusive: Option<Box<Expression>>,
10432}
10433
10434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10436#[cfg_attr(feature = "bindings", derive(TS))]
10437pub struct AIAgg {
10438 pub this: Box<Expression>,
10439 pub expression: Box<Expression>,
10440}
10441
10442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10444#[cfg_attr(feature = "bindings", derive(TS))]
10445pub struct AIClassify {
10446 pub this: Box<Expression>,
10447 #[serde(default)]
10448 pub categories: Option<Box<Expression>>,
10449 #[serde(default)]
10450 pub config: Option<Box<Expression>>,
10451}
10452
10453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10455#[cfg_attr(feature = "bindings", derive(TS))]
10456pub struct ArrayAll {
10457 pub this: Box<Expression>,
10458 pub expression: Box<Expression>,
10459}
10460
10461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10463#[cfg_attr(feature = "bindings", derive(TS))]
10464pub struct ArrayAny {
10465 pub this: Box<Expression>,
10466 pub expression: Box<Expression>,
10467}
10468
10469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10471#[cfg_attr(feature = "bindings", derive(TS))]
10472pub struct ArrayConstructCompact {
10473 #[serde(default)]
10474 pub expressions: Vec<Expression>,
10475}
10476
10477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10479#[cfg_attr(feature = "bindings", derive(TS))]
10480pub struct StPoint {
10481 pub this: Box<Expression>,
10482 pub expression: Box<Expression>,
10483 #[serde(default)]
10484 pub null: Option<Box<Expression>>,
10485}
10486
10487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10489#[cfg_attr(feature = "bindings", derive(TS))]
10490pub struct StDistance {
10491 pub this: Box<Expression>,
10492 pub expression: Box<Expression>,
10493 #[serde(default)]
10494 pub use_spheroid: Option<Box<Expression>>,
10495}
10496
10497#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10499#[cfg_attr(feature = "bindings", derive(TS))]
10500pub struct StringToArray {
10501 pub this: Box<Expression>,
10502 #[serde(default)]
10503 pub expression: Option<Box<Expression>>,
10504 #[serde(default)]
10505 pub null: Option<Box<Expression>>,
10506}
10507
10508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10510#[cfg_attr(feature = "bindings", derive(TS))]
10511pub struct ArraySum {
10512 pub this: Box<Expression>,
10513 #[serde(default)]
10514 pub expression: Option<Box<Expression>>,
10515}
10516
10517#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10519#[cfg_attr(feature = "bindings", derive(TS))]
10520pub struct ObjectAgg {
10521 pub this: Box<Expression>,
10522 pub expression: Box<Expression>,
10523}
10524
10525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10527#[cfg_attr(feature = "bindings", derive(TS))]
10528pub struct CastToStrType {
10529 pub this: Box<Expression>,
10530 #[serde(default)]
10531 pub to: Option<Box<Expression>>,
10532}
10533
10534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10536#[cfg_attr(feature = "bindings", derive(TS))]
10537pub struct CheckJson {
10538 pub this: Box<Expression>,
10539}
10540
10541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10543#[cfg_attr(feature = "bindings", derive(TS))]
10544pub struct CheckXml {
10545 pub this: Box<Expression>,
10546 #[serde(default)]
10547 pub disable_auto_convert: Option<Box<Expression>>,
10548}
10549
10550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10552#[cfg_attr(feature = "bindings", derive(TS))]
10553pub struct TranslateCharacters {
10554 pub this: Box<Expression>,
10555 pub expression: Box<Expression>,
10556 #[serde(default)]
10557 pub with_error: Option<Box<Expression>>,
10558}
10559
10560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10562#[cfg_attr(feature = "bindings", derive(TS))]
10563pub struct CurrentSchemas {
10564 #[serde(default)]
10565 pub this: Option<Box<Expression>>,
10566}
10567
10568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10570#[cfg_attr(feature = "bindings", derive(TS))]
10571pub struct CurrentDatetime {
10572 #[serde(default)]
10573 pub this: Option<Box<Expression>>,
10574}
10575
10576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10578#[cfg_attr(feature = "bindings", derive(TS))]
10579pub struct Localtime {
10580 #[serde(default)]
10581 pub this: Option<Box<Expression>>,
10582}
10583
10584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10586#[cfg_attr(feature = "bindings", derive(TS))]
10587pub struct Localtimestamp {
10588 #[serde(default)]
10589 pub this: Option<Box<Expression>>,
10590}
10591
10592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10594#[cfg_attr(feature = "bindings", derive(TS))]
10595pub struct Systimestamp {
10596 #[serde(default)]
10597 pub this: Option<Box<Expression>>,
10598}
10599
10600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10602#[cfg_attr(feature = "bindings", derive(TS))]
10603pub struct CurrentSchema {
10604 #[serde(default)]
10605 pub this: Option<Box<Expression>>,
10606}
10607
10608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10610#[cfg_attr(feature = "bindings", derive(TS))]
10611pub struct CurrentUser {
10612 #[serde(default)]
10613 pub this: Option<Box<Expression>>,
10614}
10615
10616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10618#[cfg_attr(feature = "bindings", derive(TS))]
10619pub struct SessionUser;
10620
10621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10623#[cfg_attr(feature = "bindings", derive(TS))]
10624pub struct JSONPathRoot;
10625
10626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10628#[cfg_attr(feature = "bindings", derive(TS))]
10629pub struct UtcTime {
10630 #[serde(default)]
10631 pub this: Option<Box<Expression>>,
10632}
10633
10634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10636#[cfg_attr(feature = "bindings", derive(TS))]
10637pub struct UtcTimestamp {
10638 #[serde(default)]
10639 pub this: Option<Box<Expression>>,
10640}
10641
10642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10644#[cfg_attr(feature = "bindings", derive(TS))]
10645pub struct TimestampFunc {
10646 #[serde(default)]
10647 pub this: Option<Box<Expression>>,
10648 #[serde(default)]
10649 pub zone: Option<Box<Expression>>,
10650 #[serde(default)]
10651 pub with_tz: Option<bool>,
10652 #[serde(default)]
10653 pub safe: Option<bool>,
10654}
10655
10656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10658#[cfg_attr(feature = "bindings", derive(TS))]
10659pub struct DateBin {
10660 pub this: Box<Expression>,
10661 pub expression: Box<Expression>,
10662 #[serde(default)]
10663 pub unit: Option<String>,
10664 #[serde(default)]
10665 pub zone: Option<Box<Expression>>,
10666 #[serde(default)]
10667 pub origin: Option<Box<Expression>>,
10668}
10669
10670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10672#[cfg_attr(feature = "bindings", derive(TS))]
10673pub struct Datetime {
10674 pub this: Box<Expression>,
10675 #[serde(default)]
10676 pub expression: Option<Box<Expression>>,
10677}
10678
10679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10681#[cfg_attr(feature = "bindings", derive(TS))]
10682pub struct DatetimeAdd {
10683 pub this: Box<Expression>,
10684 pub expression: Box<Expression>,
10685 #[serde(default)]
10686 pub unit: Option<String>,
10687}
10688
10689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10691#[cfg_attr(feature = "bindings", derive(TS))]
10692pub struct DatetimeSub {
10693 pub this: Box<Expression>,
10694 pub expression: Box<Expression>,
10695 #[serde(default)]
10696 pub unit: Option<String>,
10697}
10698
10699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10701#[cfg_attr(feature = "bindings", derive(TS))]
10702pub struct DatetimeDiff {
10703 pub this: Box<Expression>,
10704 pub expression: Box<Expression>,
10705 #[serde(default)]
10706 pub unit: Option<String>,
10707}
10708
10709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10711#[cfg_attr(feature = "bindings", derive(TS))]
10712pub struct DatetimeTrunc {
10713 pub this: Box<Expression>,
10714 pub unit: String,
10715 #[serde(default)]
10716 pub zone: Option<Box<Expression>>,
10717}
10718
10719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10721#[cfg_attr(feature = "bindings", derive(TS))]
10722pub struct Dayname {
10723 pub this: Box<Expression>,
10724 #[serde(default)]
10725 pub abbreviated: Option<Box<Expression>>,
10726}
10727
10728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10730#[cfg_attr(feature = "bindings", derive(TS))]
10731pub struct MakeInterval {
10732 #[serde(default)]
10733 pub year: Option<Box<Expression>>,
10734 #[serde(default)]
10735 pub month: Option<Box<Expression>>,
10736 #[serde(default)]
10737 pub week: Option<Box<Expression>>,
10738 #[serde(default)]
10739 pub day: Option<Box<Expression>>,
10740 #[serde(default)]
10741 pub hour: Option<Box<Expression>>,
10742 #[serde(default)]
10743 pub minute: Option<Box<Expression>>,
10744 #[serde(default)]
10745 pub second: Option<Box<Expression>>,
10746}
10747
10748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10750#[cfg_attr(feature = "bindings", derive(TS))]
10751pub struct PreviousDay {
10752 pub this: Box<Expression>,
10753 pub expression: Box<Expression>,
10754}
10755
10756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10758#[cfg_attr(feature = "bindings", derive(TS))]
10759pub struct Elt {
10760 pub this: Box<Expression>,
10761 #[serde(default)]
10762 pub expressions: Vec<Expression>,
10763}
10764
10765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10767#[cfg_attr(feature = "bindings", derive(TS))]
10768pub struct TimestampAdd {
10769 pub this: Box<Expression>,
10770 pub expression: Box<Expression>,
10771 #[serde(default)]
10772 pub unit: Option<String>,
10773}
10774
10775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10777#[cfg_attr(feature = "bindings", derive(TS))]
10778pub struct TimestampSub {
10779 pub this: Box<Expression>,
10780 pub expression: Box<Expression>,
10781 #[serde(default)]
10782 pub unit: Option<String>,
10783}
10784
10785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10787#[cfg_attr(feature = "bindings", derive(TS))]
10788pub struct TimestampDiff {
10789 pub this: Box<Expression>,
10790 pub expression: Box<Expression>,
10791 #[serde(default)]
10792 pub unit: Option<String>,
10793}
10794
10795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10797#[cfg_attr(feature = "bindings", derive(TS))]
10798pub struct TimeSlice {
10799 pub this: Box<Expression>,
10800 pub expression: Box<Expression>,
10801 pub unit: String,
10802 #[serde(default)]
10803 pub kind: Option<String>,
10804}
10805
10806#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10808#[cfg_attr(feature = "bindings", derive(TS))]
10809pub struct TimeAdd {
10810 pub this: Box<Expression>,
10811 pub expression: Box<Expression>,
10812 #[serde(default)]
10813 pub unit: Option<String>,
10814}
10815
10816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10818#[cfg_attr(feature = "bindings", derive(TS))]
10819pub struct TimeSub {
10820 pub this: Box<Expression>,
10821 pub expression: Box<Expression>,
10822 #[serde(default)]
10823 pub unit: Option<String>,
10824}
10825
10826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10828#[cfg_attr(feature = "bindings", derive(TS))]
10829pub struct TimeDiff {
10830 pub this: Box<Expression>,
10831 pub expression: Box<Expression>,
10832 #[serde(default)]
10833 pub unit: Option<String>,
10834}
10835
10836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10838#[cfg_attr(feature = "bindings", derive(TS))]
10839pub struct TimeTrunc {
10840 pub this: Box<Expression>,
10841 pub unit: String,
10842 #[serde(default)]
10843 pub zone: Option<Box<Expression>>,
10844}
10845
10846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10848#[cfg_attr(feature = "bindings", derive(TS))]
10849pub struct DateFromParts {
10850 #[serde(default)]
10851 pub year: Option<Box<Expression>>,
10852 #[serde(default)]
10853 pub month: Option<Box<Expression>>,
10854 #[serde(default)]
10855 pub day: Option<Box<Expression>>,
10856 #[serde(default)]
10857 pub allow_overflow: Option<Box<Expression>>,
10858}
10859
10860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10862#[cfg_attr(feature = "bindings", derive(TS))]
10863pub struct TimeFromParts {
10864 #[serde(default)]
10865 pub hour: Option<Box<Expression>>,
10866 #[serde(default)]
10867 pub min: Option<Box<Expression>>,
10868 #[serde(default)]
10869 pub sec: Option<Box<Expression>>,
10870 #[serde(default)]
10871 pub nano: Option<Box<Expression>>,
10872 #[serde(default)]
10873 pub fractions: Option<Box<Expression>>,
10874 #[serde(default)]
10875 pub precision: Option<i64>,
10876}
10877
10878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10880#[cfg_attr(feature = "bindings", derive(TS))]
10881pub struct DecodeCase {
10882 #[serde(default)]
10883 pub expressions: Vec<Expression>,
10884}
10885
10886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10888#[cfg_attr(feature = "bindings", derive(TS))]
10889pub struct Decrypt {
10890 pub this: Box<Expression>,
10891 #[serde(default)]
10892 pub passphrase: Option<Box<Expression>>,
10893 #[serde(default)]
10894 pub aad: Option<Box<Expression>>,
10895 #[serde(default)]
10896 pub encryption_method: Option<Box<Expression>>,
10897 #[serde(default)]
10898 pub safe: Option<Box<Expression>>,
10899}
10900
10901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10903#[cfg_attr(feature = "bindings", derive(TS))]
10904pub struct DecryptRaw {
10905 pub this: Box<Expression>,
10906 #[serde(default)]
10907 pub key: Option<Box<Expression>>,
10908 #[serde(default)]
10909 pub iv: Option<Box<Expression>>,
10910 #[serde(default)]
10911 pub aad: Option<Box<Expression>>,
10912 #[serde(default)]
10913 pub encryption_method: Option<Box<Expression>>,
10914 #[serde(default)]
10915 pub aead: Option<Box<Expression>>,
10916 #[serde(default)]
10917 pub safe: Option<Box<Expression>>,
10918}
10919
10920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10922#[cfg_attr(feature = "bindings", derive(TS))]
10923pub struct Encode {
10924 pub this: Box<Expression>,
10925 #[serde(default)]
10926 pub charset: Option<Box<Expression>>,
10927}
10928
10929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10931#[cfg_attr(feature = "bindings", derive(TS))]
10932pub struct Encrypt {
10933 pub this: Box<Expression>,
10934 #[serde(default)]
10935 pub passphrase: Option<Box<Expression>>,
10936 #[serde(default)]
10937 pub aad: Option<Box<Expression>>,
10938 #[serde(default)]
10939 pub encryption_method: Option<Box<Expression>>,
10940}
10941
10942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10944#[cfg_attr(feature = "bindings", derive(TS))]
10945pub struct EncryptRaw {
10946 pub this: Box<Expression>,
10947 #[serde(default)]
10948 pub key: Option<Box<Expression>>,
10949 #[serde(default)]
10950 pub iv: Option<Box<Expression>>,
10951 #[serde(default)]
10952 pub aad: Option<Box<Expression>>,
10953 #[serde(default)]
10954 pub encryption_method: Option<Box<Expression>>,
10955}
10956
10957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10959#[cfg_attr(feature = "bindings", derive(TS))]
10960pub struct EqualNull {
10961 pub this: Box<Expression>,
10962 pub expression: Box<Expression>,
10963}
10964
10965#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10967#[cfg_attr(feature = "bindings", derive(TS))]
10968pub struct ToBinary {
10969 pub this: Box<Expression>,
10970 #[serde(default)]
10971 pub format: Option<String>,
10972 #[serde(default)]
10973 pub safe: Option<Box<Expression>>,
10974}
10975
10976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10978#[cfg_attr(feature = "bindings", derive(TS))]
10979pub struct Base64DecodeBinary {
10980 pub this: Box<Expression>,
10981 #[serde(default)]
10982 pub alphabet: Option<Box<Expression>>,
10983}
10984
10985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10987#[cfg_attr(feature = "bindings", derive(TS))]
10988pub struct Base64DecodeString {
10989 pub this: Box<Expression>,
10990 #[serde(default)]
10991 pub alphabet: Option<Box<Expression>>,
10992}
10993
10994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10996#[cfg_attr(feature = "bindings", derive(TS))]
10997pub struct Base64Encode {
10998 pub this: Box<Expression>,
10999 #[serde(default)]
11000 pub max_line_length: Option<Box<Expression>>,
11001 #[serde(default)]
11002 pub alphabet: Option<Box<Expression>>,
11003}
11004
11005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11007#[cfg_attr(feature = "bindings", derive(TS))]
11008pub struct TryBase64DecodeBinary {
11009 pub this: Box<Expression>,
11010 #[serde(default)]
11011 pub alphabet: Option<Box<Expression>>,
11012}
11013
11014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11016#[cfg_attr(feature = "bindings", derive(TS))]
11017pub struct TryBase64DecodeString {
11018 pub this: Box<Expression>,
11019 #[serde(default)]
11020 pub alphabet: Option<Box<Expression>>,
11021}
11022
11023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11025#[cfg_attr(feature = "bindings", derive(TS))]
11026pub struct GapFill {
11027 pub this: Box<Expression>,
11028 #[serde(default)]
11029 pub ts_column: Option<Box<Expression>>,
11030 #[serde(default)]
11031 pub bucket_width: Option<Box<Expression>>,
11032 #[serde(default)]
11033 pub partitioning_columns: Option<Box<Expression>>,
11034 #[serde(default)]
11035 pub value_columns: Option<Box<Expression>>,
11036 #[serde(default)]
11037 pub origin: Option<Box<Expression>>,
11038 #[serde(default)]
11039 pub ignore_nulls: Option<Box<Expression>>,
11040}
11041
11042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11044#[cfg_attr(feature = "bindings", derive(TS))]
11045pub struct GenerateDateArray {
11046 #[serde(default)]
11047 pub start: Option<Box<Expression>>,
11048 #[serde(default)]
11049 pub end: Option<Box<Expression>>,
11050 #[serde(default)]
11051 pub step: Option<Box<Expression>>,
11052}
11053
11054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11056#[cfg_attr(feature = "bindings", derive(TS))]
11057pub struct GenerateTimestampArray {
11058 #[serde(default)]
11059 pub start: Option<Box<Expression>>,
11060 #[serde(default)]
11061 pub end: Option<Box<Expression>>,
11062 #[serde(default)]
11063 pub step: Option<Box<Expression>>,
11064}
11065
11066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11068#[cfg_attr(feature = "bindings", derive(TS))]
11069pub struct GetExtract {
11070 pub this: Box<Expression>,
11071 pub expression: Box<Expression>,
11072}
11073
11074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11076#[cfg_attr(feature = "bindings", derive(TS))]
11077pub struct Getbit {
11078 pub this: Box<Expression>,
11079 pub expression: Box<Expression>,
11080 #[serde(default)]
11081 pub zero_is_msb: Option<Box<Expression>>,
11082}
11083
11084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11086#[cfg_attr(feature = "bindings", derive(TS))]
11087pub struct OverflowTruncateBehavior {
11088 #[serde(default)]
11089 pub this: Option<Box<Expression>>,
11090 #[serde(default)]
11091 pub with_count: Option<Box<Expression>>,
11092}
11093
11094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11096#[cfg_attr(feature = "bindings", derive(TS))]
11097pub struct HexEncode {
11098 pub this: Box<Expression>,
11099 #[serde(default)]
11100 pub case: Option<Box<Expression>>,
11101}
11102
11103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11105#[cfg_attr(feature = "bindings", derive(TS))]
11106pub struct Compress {
11107 pub this: Box<Expression>,
11108 #[serde(default)]
11109 pub method: Option<String>,
11110}
11111
11112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11114#[cfg_attr(feature = "bindings", derive(TS))]
11115pub struct DecompressBinary {
11116 pub this: Box<Expression>,
11117 pub method: String,
11118}
11119
11120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11122#[cfg_attr(feature = "bindings", derive(TS))]
11123pub struct DecompressString {
11124 pub this: Box<Expression>,
11125 pub method: String,
11126}
11127
11128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11130#[cfg_attr(feature = "bindings", derive(TS))]
11131pub struct Xor {
11132 #[serde(default)]
11133 pub this: Option<Box<Expression>>,
11134 #[serde(default)]
11135 pub expression: Option<Box<Expression>>,
11136 #[serde(default)]
11137 pub expressions: Vec<Expression>,
11138}
11139
11140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11142#[cfg_attr(feature = "bindings", derive(TS))]
11143pub struct Nullif {
11144 pub this: Box<Expression>,
11145 pub expression: Box<Expression>,
11146}
11147
11148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11150#[cfg_attr(feature = "bindings", derive(TS))]
11151pub struct JSON {
11152 #[serde(default)]
11153 pub this: Option<Box<Expression>>,
11154 #[serde(default)]
11155 pub with_: Option<Box<Expression>>,
11156 #[serde(default)]
11157 pub unique: bool,
11158}
11159
11160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11162#[cfg_attr(feature = "bindings", derive(TS))]
11163pub struct JSONPath {
11164 #[serde(default)]
11165 pub expressions: Vec<Expression>,
11166 #[serde(default)]
11167 pub escape: Option<Box<Expression>>,
11168}
11169
11170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11172#[cfg_attr(feature = "bindings", derive(TS))]
11173pub struct JSONPathFilter {
11174 pub this: Box<Expression>,
11175}
11176
11177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11179#[cfg_attr(feature = "bindings", derive(TS))]
11180pub struct JSONPathKey {
11181 pub this: Box<Expression>,
11182}
11183
11184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11186#[cfg_attr(feature = "bindings", derive(TS))]
11187pub struct JSONPathRecursive {
11188 #[serde(default)]
11189 pub this: Option<Box<Expression>>,
11190}
11191
11192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11194#[cfg_attr(feature = "bindings", derive(TS))]
11195pub struct JSONPathScript {
11196 pub this: Box<Expression>,
11197}
11198
11199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11201#[cfg_attr(feature = "bindings", derive(TS))]
11202pub struct JSONPathSlice {
11203 #[serde(default)]
11204 pub start: Option<Box<Expression>>,
11205 #[serde(default)]
11206 pub end: Option<Box<Expression>>,
11207 #[serde(default)]
11208 pub step: Option<Box<Expression>>,
11209}
11210
11211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11213#[cfg_attr(feature = "bindings", derive(TS))]
11214pub struct JSONPathSelector {
11215 pub this: Box<Expression>,
11216}
11217
11218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11220#[cfg_attr(feature = "bindings", derive(TS))]
11221pub struct JSONPathSubscript {
11222 pub this: Box<Expression>,
11223}
11224
11225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11227#[cfg_attr(feature = "bindings", derive(TS))]
11228pub struct JSONPathUnion {
11229 #[serde(default)]
11230 pub expressions: Vec<Expression>,
11231}
11232
11233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11235#[cfg_attr(feature = "bindings", derive(TS))]
11236pub struct Format {
11237 pub this: Box<Expression>,
11238 #[serde(default)]
11239 pub expressions: Vec<Expression>,
11240}
11241
11242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11244#[cfg_attr(feature = "bindings", derive(TS))]
11245pub struct JSONKeys {
11246 pub this: Box<Expression>,
11247 #[serde(default)]
11248 pub expression: Option<Box<Expression>>,
11249 #[serde(default)]
11250 pub expressions: Vec<Expression>,
11251}
11252
11253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11255#[cfg_attr(feature = "bindings", derive(TS))]
11256pub struct JSONKeyValue {
11257 pub this: Box<Expression>,
11258 pub expression: Box<Expression>,
11259}
11260
11261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11263#[cfg_attr(feature = "bindings", derive(TS))]
11264pub struct JSONKeysAtDepth {
11265 pub this: Box<Expression>,
11266 #[serde(default)]
11267 pub expression: Option<Box<Expression>>,
11268 #[serde(default)]
11269 pub mode: Option<Box<Expression>>,
11270}
11271
11272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11274#[cfg_attr(feature = "bindings", derive(TS))]
11275pub struct JSONObject {
11276 #[serde(default)]
11277 pub expressions: Vec<Expression>,
11278 #[serde(default)]
11279 pub null_handling: Option<Box<Expression>>,
11280 #[serde(default)]
11281 pub unique_keys: Option<Box<Expression>>,
11282 #[serde(default)]
11283 pub return_type: Option<Box<Expression>>,
11284 #[serde(default)]
11285 pub encoding: Option<Box<Expression>>,
11286}
11287
11288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11290#[cfg_attr(feature = "bindings", derive(TS))]
11291pub struct JSONObjectAgg {
11292 #[serde(default)]
11293 pub expressions: Vec<Expression>,
11294 #[serde(default)]
11295 pub null_handling: Option<Box<Expression>>,
11296 #[serde(default)]
11297 pub unique_keys: Option<Box<Expression>>,
11298 #[serde(default)]
11299 pub return_type: Option<Box<Expression>>,
11300 #[serde(default)]
11301 pub encoding: Option<Box<Expression>>,
11302}
11303
11304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11306#[cfg_attr(feature = "bindings", derive(TS))]
11307pub struct JSONBObjectAgg {
11308 pub this: Box<Expression>,
11309 pub expression: Box<Expression>,
11310}
11311
11312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11314#[cfg_attr(feature = "bindings", derive(TS))]
11315pub struct JSONArray {
11316 #[serde(default)]
11317 pub expressions: Vec<Expression>,
11318 #[serde(default)]
11319 pub null_handling: Option<Box<Expression>>,
11320 #[serde(default)]
11321 pub return_type: Option<Box<Expression>>,
11322 #[serde(default)]
11323 pub strict: Option<Box<Expression>>,
11324}
11325
11326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11328#[cfg_attr(feature = "bindings", derive(TS))]
11329pub struct JSONArrayAgg {
11330 pub this: Box<Expression>,
11331 #[serde(default)]
11332 pub order: Option<Box<Expression>>,
11333 #[serde(default)]
11334 pub null_handling: Option<Box<Expression>>,
11335 #[serde(default)]
11336 pub return_type: Option<Box<Expression>>,
11337 #[serde(default)]
11338 pub strict: Option<Box<Expression>>,
11339}
11340
11341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11343#[cfg_attr(feature = "bindings", derive(TS))]
11344pub struct JSONExists {
11345 pub this: Box<Expression>,
11346 #[serde(default)]
11347 pub path: Option<Box<Expression>>,
11348 #[serde(default)]
11349 pub passing: Option<Box<Expression>>,
11350 #[serde(default)]
11351 pub on_condition: Option<Box<Expression>>,
11352 #[serde(default)]
11353 pub from_dcolonqmark: Option<Box<Expression>>,
11354}
11355
11356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11358#[cfg_attr(feature = "bindings", derive(TS))]
11359pub struct JSONColumnDef {
11360 #[serde(default)]
11361 pub this: Option<Box<Expression>>,
11362 #[serde(default)]
11363 pub kind: Option<String>,
11364 #[serde(default)]
11365 pub path: Option<Box<Expression>>,
11366 #[serde(default)]
11367 pub nested_schema: Option<Box<Expression>>,
11368 #[serde(default)]
11369 pub ordinality: Option<Box<Expression>>,
11370}
11371
11372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11374#[cfg_attr(feature = "bindings", derive(TS))]
11375pub struct JSONSchema {
11376 #[serde(default)]
11377 pub expressions: Vec<Expression>,
11378}
11379
11380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11382#[cfg_attr(feature = "bindings", derive(TS))]
11383pub struct JSONSet {
11384 pub this: Box<Expression>,
11385 #[serde(default)]
11386 pub expressions: Vec<Expression>,
11387}
11388
11389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11391#[cfg_attr(feature = "bindings", derive(TS))]
11392pub struct JSONStripNulls {
11393 pub this: Box<Expression>,
11394 #[serde(default)]
11395 pub expression: Option<Box<Expression>>,
11396 #[serde(default)]
11397 pub include_arrays: Option<Box<Expression>>,
11398 #[serde(default)]
11399 pub remove_empty: Option<Box<Expression>>,
11400}
11401
11402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11404#[cfg_attr(feature = "bindings", derive(TS))]
11405pub struct JSONValue {
11406 pub this: Box<Expression>,
11407 #[serde(default)]
11408 pub path: Option<Box<Expression>>,
11409 #[serde(default)]
11410 pub returning: Option<Box<Expression>>,
11411 #[serde(default)]
11412 pub on_condition: Option<Box<Expression>>,
11413}
11414
11415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11417#[cfg_attr(feature = "bindings", derive(TS))]
11418pub struct JSONValueArray {
11419 pub this: Box<Expression>,
11420 #[serde(default)]
11421 pub expression: Option<Box<Expression>>,
11422}
11423
11424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11426#[cfg_attr(feature = "bindings", derive(TS))]
11427pub struct JSONRemove {
11428 pub this: Box<Expression>,
11429 #[serde(default)]
11430 pub expressions: Vec<Expression>,
11431}
11432
11433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11435#[cfg_attr(feature = "bindings", derive(TS))]
11436pub struct JSONTable {
11437 pub this: Box<Expression>,
11438 #[serde(default)]
11439 pub schema: Option<Box<Expression>>,
11440 #[serde(default)]
11441 pub path: Option<Box<Expression>>,
11442 #[serde(default)]
11443 pub error_handling: Option<Box<Expression>>,
11444 #[serde(default)]
11445 pub empty_handling: Option<Box<Expression>>,
11446}
11447
11448#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11450#[cfg_attr(feature = "bindings", derive(TS))]
11451pub struct JSONType {
11452 pub this: Box<Expression>,
11453 #[serde(default)]
11454 pub expression: Option<Box<Expression>>,
11455}
11456
11457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11459#[cfg_attr(feature = "bindings", derive(TS))]
11460pub struct ObjectInsert {
11461 pub this: Box<Expression>,
11462 #[serde(default)]
11463 pub key: Option<Box<Expression>>,
11464 #[serde(default)]
11465 pub value: Option<Box<Expression>>,
11466 #[serde(default)]
11467 pub update_flag: Option<Box<Expression>>,
11468}
11469
11470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11472#[cfg_attr(feature = "bindings", derive(TS))]
11473pub struct OpenJSONColumnDef {
11474 pub this: Box<Expression>,
11475 pub kind: String,
11476 #[serde(default)]
11477 pub path: Option<Box<Expression>>,
11478 #[serde(default)]
11479 pub as_json: Option<Box<Expression>>,
11480 #[serde(default, skip_serializing_if = "Option::is_none")]
11482 pub data_type: Option<DataType>,
11483}
11484
11485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11487#[cfg_attr(feature = "bindings", derive(TS))]
11488pub struct OpenJSON {
11489 pub this: Box<Expression>,
11490 #[serde(default)]
11491 pub path: Option<Box<Expression>>,
11492 #[serde(default)]
11493 pub expressions: Vec<Expression>,
11494}
11495
11496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11498#[cfg_attr(feature = "bindings", derive(TS))]
11499pub struct JSONBExists {
11500 pub this: Box<Expression>,
11501 #[serde(default)]
11502 pub path: Option<Box<Expression>>,
11503}
11504
11505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11507#[cfg_attr(feature = "bindings", derive(TS))]
11508pub struct JSONCast {
11509 pub this: Box<Expression>,
11510 pub to: DataType,
11511}
11512
11513#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11515#[cfg_attr(feature = "bindings", derive(TS))]
11516pub struct JSONExtract {
11517 pub this: Box<Expression>,
11518 pub expression: Box<Expression>,
11519 #[serde(default)]
11520 pub only_json_types: Option<Box<Expression>>,
11521 #[serde(default)]
11522 pub expressions: Vec<Expression>,
11523 #[serde(default)]
11524 pub variant_extract: Option<Box<Expression>>,
11525 #[serde(default)]
11526 pub json_query: Option<Box<Expression>>,
11527 #[serde(default)]
11528 pub option: Option<Box<Expression>>,
11529 #[serde(default)]
11530 pub quote: Option<Box<Expression>>,
11531 #[serde(default)]
11532 pub on_condition: Option<Box<Expression>>,
11533 #[serde(default)]
11534 pub requires_json: Option<Box<Expression>>,
11535}
11536
11537#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11539#[cfg_attr(feature = "bindings", derive(TS))]
11540pub struct JSONExtractQuote {
11541 #[serde(default)]
11542 pub option: Option<Box<Expression>>,
11543 #[serde(default)]
11544 pub scalar: Option<Box<Expression>>,
11545}
11546
11547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11549#[cfg_attr(feature = "bindings", derive(TS))]
11550pub struct JSONExtractArray {
11551 pub this: Box<Expression>,
11552 #[serde(default)]
11553 pub expression: Option<Box<Expression>>,
11554}
11555
11556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11558#[cfg_attr(feature = "bindings", derive(TS))]
11559pub struct JSONExtractScalar {
11560 pub this: Box<Expression>,
11561 pub expression: Box<Expression>,
11562 #[serde(default)]
11563 pub only_json_types: Option<Box<Expression>>,
11564 #[serde(default)]
11565 pub expressions: Vec<Expression>,
11566 #[serde(default)]
11567 pub json_type: Option<Box<Expression>>,
11568 #[serde(default)]
11569 pub scalar_only: Option<Box<Expression>>,
11570}
11571
11572#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11574#[cfg_attr(feature = "bindings", derive(TS))]
11575pub struct JSONBExtractScalar {
11576 pub this: Box<Expression>,
11577 pub expression: Box<Expression>,
11578 #[serde(default)]
11579 pub json_type: Option<Box<Expression>>,
11580}
11581
11582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11584#[cfg_attr(feature = "bindings", derive(TS))]
11585pub struct JSONFormat {
11586 #[serde(default)]
11587 pub this: Option<Box<Expression>>,
11588 #[serde(default)]
11589 pub options: Vec<Expression>,
11590 #[serde(default)]
11591 pub is_json: Option<Box<Expression>>,
11592 #[serde(default)]
11593 pub to_json: Option<Box<Expression>>,
11594}
11595
11596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11598#[cfg_attr(feature = "bindings", derive(TS))]
11599pub struct JSONArrayAppend {
11600 pub this: Box<Expression>,
11601 #[serde(default)]
11602 pub expressions: Vec<Expression>,
11603}
11604
11605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11607#[cfg_attr(feature = "bindings", derive(TS))]
11608pub struct JSONArrayContains {
11609 pub this: Box<Expression>,
11610 pub expression: Box<Expression>,
11611 #[serde(default)]
11612 pub json_type: Option<Box<Expression>>,
11613}
11614
11615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11617#[cfg_attr(feature = "bindings", derive(TS))]
11618pub struct JSONArrayInsert {
11619 pub this: Box<Expression>,
11620 #[serde(default)]
11621 pub expressions: Vec<Expression>,
11622}
11623
11624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11626#[cfg_attr(feature = "bindings", derive(TS))]
11627pub struct ParseJSON {
11628 pub this: Box<Expression>,
11629 #[serde(default)]
11630 pub expression: Option<Box<Expression>>,
11631 #[serde(default)]
11632 pub safe: Option<Box<Expression>>,
11633}
11634
11635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11637#[cfg_attr(feature = "bindings", derive(TS))]
11638pub struct ParseUrl {
11639 pub this: Box<Expression>,
11640 #[serde(default)]
11641 pub part_to_extract: Option<Box<Expression>>,
11642 #[serde(default)]
11643 pub key: Option<Box<Expression>>,
11644 #[serde(default)]
11645 pub permissive: Option<Box<Expression>>,
11646}
11647
11648#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11650#[cfg_attr(feature = "bindings", derive(TS))]
11651pub struct ParseIp {
11652 pub this: Box<Expression>,
11653 #[serde(default)]
11654 pub type_: Option<Box<Expression>>,
11655 #[serde(default)]
11656 pub permissive: Option<Box<Expression>>,
11657}
11658
11659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11661#[cfg_attr(feature = "bindings", derive(TS))]
11662pub struct ParseTime {
11663 pub this: Box<Expression>,
11664 pub format: String,
11665}
11666
11667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11669#[cfg_attr(feature = "bindings", derive(TS))]
11670pub struct ParseDatetime {
11671 pub this: Box<Expression>,
11672 #[serde(default)]
11673 pub format: Option<String>,
11674 #[serde(default)]
11675 pub zone: Option<Box<Expression>>,
11676}
11677
11678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11680#[cfg_attr(feature = "bindings", derive(TS))]
11681pub struct Map {
11682 #[serde(default)]
11683 pub keys: Vec<Expression>,
11684 #[serde(default)]
11685 pub values: Vec<Expression>,
11686}
11687
11688#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11690#[cfg_attr(feature = "bindings", derive(TS))]
11691pub struct MapCat {
11692 pub this: Box<Expression>,
11693 pub expression: Box<Expression>,
11694}
11695
11696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11698#[cfg_attr(feature = "bindings", derive(TS))]
11699pub struct MapDelete {
11700 pub this: Box<Expression>,
11701 #[serde(default)]
11702 pub expressions: Vec<Expression>,
11703}
11704
11705#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11707#[cfg_attr(feature = "bindings", derive(TS))]
11708pub struct MapInsert {
11709 pub this: Box<Expression>,
11710 #[serde(default)]
11711 pub key: Option<Box<Expression>>,
11712 #[serde(default)]
11713 pub value: Option<Box<Expression>>,
11714 #[serde(default)]
11715 pub update_flag: Option<Box<Expression>>,
11716}
11717
11718#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11720#[cfg_attr(feature = "bindings", derive(TS))]
11721pub struct MapPick {
11722 pub this: Box<Expression>,
11723 #[serde(default)]
11724 pub expressions: Vec<Expression>,
11725}
11726
11727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11729#[cfg_attr(feature = "bindings", derive(TS))]
11730pub struct ScopeResolution {
11731 #[serde(default)]
11732 pub this: Option<Box<Expression>>,
11733 pub expression: Box<Expression>,
11734}
11735
11736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11738#[cfg_attr(feature = "bindings", derive(TS))]
11739pub struct Slice {
11740 #[serde(default)]
11741 pub this: Option<Box<Expression>>,
11742 #[serde(default)]
11743 pub expression: Option<Box<Expression>>,
11744 #[serde(default)]
11745 pub step: Option<Box<Expression>>,
11746}
11747
11748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11750#[cfg_attr(feature = "bindings", derive(TS))]
11751pub struct VarMap {
11752 #[serde(default)]
11753 pub keys: Vec<Expression>,
11754 #[serde(default)]
11755 pub values: Vec<Expression>,
11756}
11757
11758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11760#[cfg_attr(feature = "bindings", derive(TS))]
11761pub struct MatchAgainst {
11762 pub this: Box<Expression>,
11763 #[serde(default)]
11764 pub expressions: Vec<Expression>,
11765 #[serde(default)]
11766 pub modifier: Option<Box<Expression>>,
11767}
11768
11769#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11771#[cfg_attr(feature = "bindings", derive(TS))]
11772pub struct MD5Digest {
11773 pub this: Box<Expression>,
11774 #[serde(default)]
11775 pub expressions: Vec<Expression>,
11776}
11777
11778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11780#[cfg_attr(feature = "bindings", derive(TS))]
11781pub struct Monthname {
11782 pub this: Box<Expression>,
11783 #[serde(default)]
11784 pub abbreviated: Option<Box<Expression>>,
11785}
11786
11787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11789#[cfg_attr(feature = "bindings", derive(TS))]
11790pub struct Ntile {
11791 #[serde(default)]
11792 pub this: Option<Box<Expression>>,
11793}
11794
11795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11797#[cfg_attr(feature = "bindings", derive(TS))]
11798pub struct Normalize {
11799 pub this: Box<Expression>,
11800 #[serde(default)]
11801 pub form: Option<Box<Expression>>,
11802 #[serde(default)]
11803 pub is_casefold: Option<Box<Expression>>,
11804}
11805
11806#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11808#[cfg_attr(feature = "bindings", derive(TS))]
11809pub struct Normal {
11810 pub this: Box<Expression>,
11811 #[serde(default)]
11812 pub stddev: Option<Box<Expression>>,
11813 #[serde(default)]
11814 pub gen: Option<Box<Expression>>,
11815}
11816
11817#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11819#[cfg_attr(feature = "bindings", derive(TS))]
11820pub struct Predict {
11821 pub this: Box<Expression>,
11822 pub expression: Box<Expression>,
11823 #[serde(default)]
11824 pub params_struct: Option<Box<Expression>>,
11825}
11826
11827#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11829#[cfg_attr(feature = "bindings", derive(TS))]
11830pub struct MLTranslate {
11831 pub this: Box<Expression>,
11832 pub expression: Box<Expression>,
11833 #[serde(default)]
11834 pub params_struct: Option<Box<Expression>>,
11835}
11836
11837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11839#[cfg_attr(feature = "bindings", derive(TS))]
11840pub struct FeaturesAtTime {
11841 pub this: Box<Expression>,
11842 #[serde(default)]
11843 pub time: Option<Box<Expression>>,
11844 #[serde(default)]
11845 pub num_rows: Option<Box<Expression>>,
11846 #[serde(default)]
11847 pub ignore_feature_nulls: Option<Box<Expression>>,
11848}
11849
11850#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11852#[cfg_attr(feature = "bindings", derive(TS))]
11853pub struct GenerateEmbedding {
11854 pub this: Box<Expression>,
11855 pub expression: Box<Expression>,
11856 #[serde(default)]
11857 pub params_struct: Option<Box<Expression>>,
11858 #[serde(default)]
11859 pub is_text: Option<Box<Expression>>,
11860}
11861
11862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11864#[cfg_attr(feature = "bindings", derive(TS))]
11865pub struct MLForecast {
11866 pub this: Box<Expression>,
11867 #[serde(default)]
11868 pub expression: Option<Box<Expression>>,
11869 #[serde(default)]
11870 pub params_struct: Option<Box<Expression>>,
11871}
11872
11873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11875#[cfg_attr(feature = "bindings", derive(TS))]
11876pub struct ModelAttribute {
11877 pub this: Box<Expression>,
11878 pub expression: Box<Expression>,
11879}
11880
11881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11883#[cfg_attr(feature = "bindings", derive(TS))]
11884pub struct VectorSearch {
11885 pub this: Box<Expression>,
11886 #[serde(default)]
11887 pub column_to_search: Option<Box<Expression>>,
11888 #[serde(default)]
11889 pub query_table: Option<Box<Expression>>,
11890 #[serde(default)]
11891 pub query_column_to_search: Option<Box<Expression>>,
11892 #[serde(default)]
11893 pub top_k: Option<Box<Expression>>,
11894 #[serde(default)]
11895 pub distance_type: Option<Box<Expression>>,
11896 #[serde(default)]
11897 pub options: Vec<Expression>,
11898}
11899
11900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11902#[cfg_attr(feature = "bindings", derive(TS))]
11903pub struct Quantile {
11904 pub this: Box<Expression>,
11905 #[serde(default)]
11906 pub quantile: Option<Box<Expression>>,
11907}
11908
11909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11911#[cfg_attr(feature = "bindings", derive(TS))]
11912pub struct ApproxQuantile {
11913 pub this: Box<Expression>,
11914 #[serde(default)]
11915 pub quantile: Option<Box<Expression>>,
11916 #[serde(default)]
11917 pub accuracy: Option<Box<Expression>>,
11918 #[serde(default)]
11919 pub weight: Option<Box<Expression>>,
11920 #[serde(default)]
11921 pub error_tolerance: Option<Box<Expression>>,
11922}
11923
11924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11926#[cfg_attr(feature = "bindings", derive(TS))]
11927pub struct ApproxPercentileEstimate {
11928 pub this: Box<Expression>,
11929 #[serde(default)]
11930 pub percentile: Option<Box<Expression>>,
11931}
11932
11933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11935#[cfg_attr(feature = "bindings", derive(TS))]
11936pub struct Randn {
11937 #[serde(default)]
11938 pub this: Option<Box<Expression>>,
11939}
11940
11941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11943#[cfg_attr(feature = "bindings", derive(TS))]
11944pub struct Randstr {
11945 pub this: Box<Expression>,
11946 #[serde(default)]
11947 pub generator: Option<Box<Expression>>,
11948}
11949
11950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11952#[cfg_attr(feature = "bindings", derive(TS))]
11953pub struct RangeN {
11954 pub this: Box<Expression>,
11955 #[serde(default)]
11956 pub expressions: Vec<Expression>,
11957 #[serde(default)]
11958 pub each: Option<Box<Expression>>,
11959}
11960
11961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11963#[cfg_attr(feature = "bindings", derive(TS))]
11964pub struct RangeBucket {
11965 pub this: Box<Expression>,
11966 pub expression: Box<Expression>,
11967}
11968
11969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11971#[cfg_attr(feature = "bindings", derive(TS))]
11972pub struct ReadCSV {
11973 pub this: Box<Expression>,
11974 #[serde(default)]
11975 pub expressions: Vec<Expression>,
11976}
11977
11978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11980#[cfg_attr(feature = "bindings", derive(TS))]
11981pub struct ReadParquet {
11982 #[serde(default)]
11983 pub expressions: Vec<Expression>,
11984}
11985
11986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11988#[cfg_attr(feature = "bindings", derive(TS))]
11989pub struct Reduce {
11990 pub this: Box<Expression>,
11991 #[serde(default)]
11992 pub initial: Option<Box<Expression>>,
11993 #[serde(default)]
11994 pub merge: Option<Box<Expression>>,
11995 #[serde(default)]
11996 pub finish: Option<Box<Expression>>,
11997}
11998
11999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12001#[cfg_attr(feature = "bindings", derive(TS))]
12002pub struct RegexpExtractAll {
12003 pub this: Box<Expression>,
12004 pub expression: Box<Expression>,
12005 #[serde(default)]
12006 pub group: Option<Box<Expression>>,
12007 #[serde(default)]
12008 pub parameters: Option<Box<Expression>>,
12009 #[serde(default)]
12010 pub position: Option<Box<Expression>>,
12011 #[serde(default)]
12012 pub occurrence: Option<Box<Expression>>,
12013}
12014
12015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12017#[cfg_attr(feature = "bindings", derive(TS))]
12018pub struct RegexpILike {
12019 pub this: Box<Expression>,
12020 pub expression: Box<Expression>,
12021 #[serde(default)]
12022 pub flag: Option<Box<Expression>>,
12023}
12024
12025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12027#[cfg_attr(feature = "bindings", derive(TS))]
12028pub struct RegexpFullMatch {
12029 pub this: Box<Expression>,
12030 pub expression: Box<Expression>,
12031 #[serde(default)]
12032 pub options: Vec<Expression>,
12033}
12034
12035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12037#[cfg_attr(feature = "bindings", derive(TS))]
12038pub struct RegexpInstr {
12039 pub this: Box<Expression>,
12040 pub expression: Box<Expression>,
12041 #[serde(default)]
12042 pub position: Option<Box<Expression>>,
12043 #[serde(default)]
12044 pub occurrence: Option<Box<Expression>>,
12045 #[serde(default)]
12046 pub option: Option<Box<Expression>>,
12047 #[serde(default)]
12048 pub parameters: Option<Box<Expression>>,
12049 #[serde(default)]
12050 pub group: Option<Box<Expression>>,
12051}
12052
12053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12055#[cfg_attr(feature = "bindings", derive(TS))]
12056pub struct RegexpSplit {
12057 pub this: Box<Expression>,
12058 pub expression: Box<Expression>,
12059 #[serde(default)]
12060 pub limit: Option<Box<Expression>>,
12061}
12062
12063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12065#[cfg_attr(feature = "bindings", derive(TS))]
12066pub struct RegexpCount {
12067 pub this: Box<Expression>,
12068 pub expression: Box<Expression>,
12069 #[serde(default)]
12070 pub position: Option<Box<Expression>>,
12071 #[serde(default)]
12072 pub parameters: Option<Box<Expression>>,
12073}
12074
12075#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12077#[cfg_attr(feature = "bindings", derive(TS))]
12078pub struct RegrValx {
12079 pub this: Box<Expression>,
12080 pub expression: Box<Expression>,
12081}
12082
12083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12085#[cfg_attr(feature = "bindings", derive(TS))]
12086pub struct RegrValy {
12087 pub this: Box<Expression>,
12088 pub expression: Box<Expression>,
12089}
12090
12091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12093#[cfg_attr(feature = "bindings", derive(TS))]
12094pub struct RegrAvgy {
12095 pub this: Box<Expression>,
12096 pub expression: Box<Expression>,
12097}
12098
12099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12101#[cfg_attr(feature = "bindings", derive(TS))]
12102pub struct RegrAvgx {
12103 pub this: Box<Expression>,
12104 pub expression: Box<Expression>,
12105}
12106
12107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12109#[cfg_attr(feature = "bindings", derive(TS))]
12110pub struct RegrCount {
12111 pub this: Box<Expression>,
12112 pub expression: Box<Expression>,
12113}
12114
12115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12117#[cfg_attr(feature = "bindings", derive(TS))]
12118pub struct RegrIntercept {
12119 pub this: Box<Expression>,
12120 pub expression: Box<Expression>,
12121}
12122
12123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12125#[cfg_attr(feature = "bindings", derive(TS))]
12126pub struct RegrR2 {
12127 pub this: Box<Expression>,
12128 pub expression: Box<Expression>,
12129}
12130
12131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12133#[cfg_attr(feature = "bindings", derive(TS))]
12134pub struct RegrSxx {
12135 pub this: Box<Expression>,
12136 pub expression: Box<Expression>,
12137}
12138
12139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12141#[cfg_attr(feature = "bindings", derive(TS))]
12142pub struct RegrSxy {
12143 pub this: Box<Expression>,
12144 pub expression: Box<Expression>,
12145}
12146
12147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12149#[cfg_attr(feature = "bindings", derive(TS))]
12150pub struct RegrSyy {
12151 pub this: Box<Expression>,
12152 pub expression: Box<Expression>,
12153}
12154
12155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12157#[cfg_attr(feature = "bindings", derive(TS))]
12158pub struct RegrSlope {
12159 pub this: Box<Expression>,
12160 pub expression: Box<Expression>,
12161}
12162
12163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12165#[cfg_attr(feature = "bindings", derive(TS))]
12166pub struct SafeAdd {
12167 pub this: Box<Expression>,
12168 pub expression: Box<Expression>,
12169}
12170
12171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12173#[cfg_attr(feature = "bindings", derive(TS))]
12174pub struct SafeDivide {
12175 pub this: Box<Expression>,
12176 pub expression: Box<Expression>,
12177}
12178
12179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12181#[cfg_attr(feature = "bindings", derive(TS))]
12182pub struct SafeMultiply {
12183 pub this: Box<Expression>,
12184 pub expression: Box<Expression>,
12185}
12186
12187#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12189#[cfg_attr(feature = "bindings", derive(TS))]
12190pub struct SafeSubtract {
12191 pub this: Box<Expression>,
12192 pub expression: Box<Expression>,
12193}
12194
12195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12197#[cfg_attr(feature = "bindings", derive(TS))]
12198pub struct SHA2 {
12199 pub this: Box<Expression>,
12200 #[serde(default)]
12201 pub length: Option<i64>,
12202}
12203
12204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12206#[cfg_attr(feature = "bindings", derive(TS))]
12207pub struct SHA2Digest {
12208 pub this: Box<Expression>,
12209 #[serde(default)]
12210 pub length: Option<i64>,
12211}
12212
12213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12215#[cfg_attr(feature = "bindings", derive(TS))]
12216pub struct SortArray {
12217 pub this: Box<Expression>,
12218 #[serde(default)]
12219 pub asc: Option<Box<Expression>>,
12220 #[serde(default)]
12221 pub nulls_first: Option<Box<Expression>>,
12222}
12223
12224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12226#[cfg_attr(feature = "bindings", derive(TS))]
12227pub struct SplitPart {
12228 pub this: Box<Expression>,
12229 #[serde(default)]
12230 pub delimiter: Option<Box<Expression>>,
12231 #[serde(default)]
12232 pub part_index: Option<Box<Expression>>,
12233}
12234
12235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12237#[cfg_attr(feature = "bindings", derive(TS))]
12238pub struct SubstringIndex {
12239 pub this: Box<Expression>,
12240 #[serde(default)]
12241 pub delimiter: Option<Box<Expression>>,
12242 #[serde(default)]
12243 pub count: Option<Box<Expression>>,
12244}
12245
12246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12248#[cfg_attr(feature = "bindings", derive(TS))]
12249pub struct StandardHash {
12250 pub this: Box<Expression>,
12251 #[serde(default)]
12252 pub expression: Option<Box<Expression>>,
12253}
12254
12255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12257#[cfg_attr(feature = "bindings", derive(TS))]
12258pub struct StrPosition {
12259 pub this: Box<Expression>,
12260 #[serde(default)]
12261 pub substr: Option<Box<Expression>>,
12262 #[serde(default)]
12263 pub position: Option<Box<Expression>>,
12264 #[serde(default)]
12265 pub occurrence: Option<Box<Expression>>,
12266}
12267
12268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12270#[cfg_attr(feature = "bindings", derive(TS))]
12271pub struct Search {
12272 pub this: Box<Expression>,
12273 pub expression: Box<Expression>,
12274 #[serde(default)]
12275 pub json_scope: Option<Box<Expression>>,
12276 #[serde(default)]
12277 pub analyzer: Option<Box<Expression>>,
12278 #[serde(default)]
12279 pub analyzer_options: Option<Box<Expression>>,
12280 #[serde(default)]
12281 pub search_mode: Option<Box<Expression>>,
12282}
12283
12284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12286#[cfg_attr(feature = "bindings", derive(TS))]
12287pub struct SearchIp {
12288 pub this: Box<Expression>,
12289 pub expression: Box<Expression>,
12290}
12291
12292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12294#[cfg_attr(feature = "bindings", derive(TS))]
12295pub struct StrToDate {
12296 pub this: Box<Expression>,
12297 #[serde(default)]
12298 pub format: Option<String>,
12299 #[serde(default)]
12300 pub safe: Option<Box<Expression>>,
12301}
12302
12303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12305#[cfg_attr(feature = "bindings", derive(TS))]
12306pub struct StrToTime {
12307 pub this: Box<Expression>,
12308 pub format: String,
12309 #[serde(default)]
12310 pub zone: Option<Box<Expression>>,
12311 #[serde(default)]
12312 pub safe: Option<Box<Expression>>,
12313 #[serde(default)]
12314 pub target_type: Option<Box<Expression>>,
12315}
12316
12317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12319#[cfg_attr(feature = "bindings", derive(TS))]
12320pub struct StrToUnix {
12321 #[serde(default)]
12322 pub this: Option<Box<Expression>>,
12323 #[serde(default)]
12324 pub format: Option<String>,
12325}
12326
12327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12329#[cfg_attr(feature = "bindings", derive(TS))]
12330pub struct StrToMap {
12331 pub this: Box<Expression>,
12332 #[serde(default)]
12333 pub pair_delim: Option<Box<Expression>>,
12334 #[serde(default)]
12335 pub key_value_delim: Option<Box<Expression>>,
12336 #[serde(default)]
12337 pub duplicate_resolution_callback: Option<Box<Expression>>,
12338}
12339
12340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12342#[cfg_attr(feature = "bindings", derive(TS))]
12343pub struct NumberToStr {
12344 pub this: Box<Expression>,
12345 pub format: String,
12346 #[serde(default)]
12347 pub culture: Option<Box<Expression>>,
12348}
12349
12350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12352#[cfg_attr(feature = "bindings", derive(TS))]
12353pub struct FromBase {
12354 pub this: Box<Expression>,
12355 pub expression: Box<Expression>,
12356}
12357
12358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12360#[cfg_attr(feature = "bindings", derive(TS))]
12361pub struct Stuff {
12362 pub this: Box<Expression>,
12363 #[serde(default)]
12364 pub start: Option<Box<Expression>>,
12365 #[serde(default)]
12366 pub length: Option<i64>,
12367 pub expression: Box<Expression>,
12368}
12369
12370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12372#[cfg_attr(feature = "bindings", derive(TS))]
12373pub struct TimeToStr {
12374 pub this: Box<Expression>,
12375 pub format: String,
12376 #[serde(default)]
12377 pub culture: Option<Box<Expression>>,
12378 #[serde(default)]
12379 pub zone: Option<Box<Expression>>,
12380}
12381
12382#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12384#[cfg_attr(feature = "bindings", derive(TS))]
12385pub struct TimeStrToTime {
12386 pub this: Box<Expression>,
12387 #[serde(default)]
12388 pub zone: Option<Box<Expression>>,
12389}
12390
12391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12393#[cfg_attr(feature = "bindings", derive(TS))]
12394pub struct TsOrDsAdd {
12395 pub this: Box<Expression>,
12396 pub expression: Box<Expression>,
12397 #[serde(default)]
12398 pub unit: Option<String>,
12399 #[serde(default)]
12400 pub return_type: Option<Box<Expression>>,
12401}
12402
12403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12405#[cfg_attr(feature = "bindings", derive(TS))]
12406pub struct TsOrDsDiff {
12407 pub this: Box<Expression>,
12408 pub expression: Box<Expression>,
12409 #[serde(default)]
12410 pub unit: Option<String>,
12411}
12412
12413#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12415#[cfg_attr(feature = "bindings", derive(TS))]
12416pub struct TsOrDsToDate {
12417 pub this: Box<Expression>,
12418 #[serde(default)]
12419 pub format: Option<String>,
12420 #[serde(default)]
12421 pub safe: Option<Box<Expression>>,
12422}
12423
12424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12426#[cfg_attr(feature = "bindings", derive(TS))]
12427pub struct TsOrDsToTime {
12428 pub this: Box<Expression>,
12429 #[serde(default)]
12430 pub format: Option<String>,
12431 #[serde(default)]
12432 pub safe: Option<Box<Expression>>,
12433}
12434
12435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12437#[cfg_attr(feature = "bindings", derive(TS))]
12438pub struct Unhex {
12439 pub this: Box<Expression>,
12440 #[serde(default)]
12441 pub expression: Option<Box<Expression>>,
12442}
12443
12444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12446#[cfg_attr(feature = "bindings", derive(TS))]
12447pub struct Uniform {
12448 pub this: Box<Expression>,
12449 pub expression: Box<Expression>,
12450 #[serde(default)]
12451 pub gen: Option<Box<Expression>>,
12452 #[serde(default)]
12453 pub seed: Option<Box<Expression>>,
12454}
12455
12456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12458#[cfg_attr(feature = "bindings", derive(TS))]
12459pub struct UnixToStr {
12460 pub this: Box<Expression>,
12461 #[serde(default)]
12462 pub format: Option<String>,
12463}
12464
12465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12467#[cfg_attr(feature = "bindings", derive(TS))]
12468pub struct UnixToTime {
12469 pub this: Box<Expression>,
12470 #[serde(default)]
12471 pub scale: Option<i64>,
12472 #[serde(default)]
12473 pub zone: Option<Box<Expression>>,
12474 #[serde(default)]
12475 pub hours: Option<Box<Expression>>,
12476 #[serde(default)]
12477 pub minutes: Option<Box<Expression>>,
12478 #[serde(default)]
12479 pub format: Option<String>,
12480 #[serde(default)]
12481 pub target_type: Option<Box<Expression>>,
12482}
12483
12484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12486#[cfg_attr(feature = "bindings", derive(TS))]
12487pub struct Uuid {
12488 #[serde(default)]
12489 pub this: Option<Box<Expression>>,
12490 #[serde(default)]
12491 pub name: Option<String>,
12492 #[serde(default)]
12493 pub is_string: Option<Box<Expression>>,
12494}
12495
12496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12498#[cfg_attr(feature = "bindings", derive(TS))]
12499pub struct TimestampFromParts {
12500 #[serde(default)]
12501 pub zone: Option<Box<Expression>>,
12502 #[serde(default)]
12503 pub milli: Option<Box<Expression>>,
12504 #[serde(default)]
12505 pub this: Option<Box<Expression>>,
12506 #[serde(default)]
12507 pub expression: Option<Box<Expression>>,
12508}
12509
12510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12512#[cfg_attr(feature = "bindings", derive(TS))]
12513pub struct TimestampTzFromParts {
12514 #[serde(default)]
12515 pub zone: Option<Box<Expression>>,
12516}
12517
12518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12520#[cfg_attr(feature = "bindings", derive(TS))]
12521pub struct Corr {
12522 pub this: Box<Expression>,
12523 pub expression: Box<Expression>,
12524 #[serde(default)]
12525 pub null_on_zero_variance: Option<Box<Expression>>,
12526}
12527
12528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12530#[cfg_attr(feature = "bindings", derive(TS))]
12531pub struct WidthBucket {
12532 pub this: Box<Expression>,
12533 #[serde(default)]
12534 pub min_value: Option<Box<Expression>>,
12535 #[serde(default)]
12536 pub max_value: Option<Box<Expression>>,
12537 #[serde(default)]
12538 pub num_buckets: Option<Box<Expression>>,
12539 #[serde(default)]
12540 pub threshold: Option<Box<Expression>>,
12541}
12542
12543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12545#[cfg_attr(feature = "bindings", derive(TS))]
12546pub struct CovarSamp {
12547 pub this: Box<Expression>,
12548 pub expression: Box<Expression>,
12549}
12550
12551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12553#[cfg_attr(feature = "bindings", derive(TS))]
12554pub struct CovarPop {
12555 pub this: Box<Expression>,
12556 pub expression: Box<Expression>,
12557}
12558
12559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12561#[cfg_attr(feature = "bindings", derive(TS))]
12562pub struct Week {
12563 pub this: Box<Expression>,
12564 #[serde(default)]
12565 pub mode: Option<Box<Expression>>,
12566}
12567
12568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12570#[cfg_attr(feature = "bindings", derive(TS))]
12571pub struct XMLElement {
12572 pub this: Box<Expression>,
12573 #[serde(default)]
12574 pub expressions: Vec<Expression>,
12575 #[serde(default)]
12576 pub evalname: Option<Box<Expression>>,
12577}
12578
12579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12581#[cfg_attr(feature = "bindings", derive(TS))]
12582pub struct XMLGet {
12583 pub this: Box<Expression>,
12584 pub expression: Box<Expression>,
12585 #[serde(default)]
12586 pub instance: Option<Box<Expression>>,
12587}
12588
12589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12591#[cfg_attr(feature = "bindings", derive(TS))]
12592pub struct XMLTable {
12593 pub this: Box<Expression>,
12594 #[serde(default)]
12595 pub namespaces: Option<Box<Expression>>,
12596 #[serde(default)]
12597 pub passing: Option<Box<Expression>>,
12598 #[serde(default)]
12599 pub columns: Vec<Expression>,
12600 #[serde(default)]
12601 pub by_ref: Option<Box<Expression>>,
12602}
12603
12604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12606#[cfg_attr(feature = "bindings", derive(TS))]
12607pub struct XMLKeyValueOption {
12608 pub this: Box<Expression>,
12609 #[serde(default)]
12610 pub expression: Option<Box<Expression>>,
12611}
12612
12613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12615#[cfg_attr(feature = "bindings", derive(TS))]
12616pub struct Zipf {
12617 pub this: Box<Expression>,
12618 #[serde(default)]
12619 pub elementcount: Option<Box<Expression>>,
12620 #[serde(default)]
12621 pub gen: Option<Box<Expression>>,
12622}
12623
12624#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12626#[cfg_attr(feature = "bindings", derive(TS))]
12627pub struct Merge {
12628 pub this: Box<Expression>,
12629 pub using: Box<Expression>,
12630 #[serde(default)]
12631 pub on: Option<Box<Expression>>,
12632 #[serde(default)]
12633 pub using_cond: Option<Box<Expression>>,
12634 #[serde(default)]
12635 pub whens: Option<Box<Expression>>,
12636 #[serde(default)]
12637 pub with_: Option<Box<Expression>>,
12638 #[serde(default)]
12639 pub returning: Option<Box<Expression>>,
12640}
12641
12642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12644#[cfg_attr(feature = "bindings", derive(TS))]
12645pub struct When {
12646 #[serde(default)]
12647 pub matched: Option<Box<Expression>>,
12648 #[serde(default)]
12649 pub source: Option<Box<Expression>>,
12650 #[serde(default)]
12651 pub condition: Option<Box<Expression>>,
12652 pub then: Box<Expression>,
12653}
12654
12655#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12657#[cfg_attr(feature = "bindings", derive(TS))]
12658pub struct Whens {
12659 #[serde(default)]
12660 pub expressions: Vec<Expression>,
12661}
12662
12663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12665#[cfg_attr(feature = "bindings", derive(TS))]
12666pub struct NextValueFor {
12667 pub this: Box<Expression>,
12668 #[serde(default)]
12669 pub order: Option<Box<Expression>>,
12670}
12671
12672#[cfg(test)]
12673mod tests {
12674 use super::*;
12675
12676 #[test]
12677 #[cfg(feature = "bindings")]
12678 fn export_typescript_types() {
12679 Expression::export_all(&ts_rs::Config::default())
12682 .expect("Failed to export Expression types");
12683 }
12684
12685 #[test]
12686 fn test_simple_select_builder() {
12687 let select = Select::new()
12688 .column(Expression::star())
12689 .from(Expression::Table(TableRef::new("users")));
12690
12691 assert_eq!(select.expressions.len(), 1);
12692 assert!(select.from.is_some());
12693 }
12694
12695 #[test]
12696 fn test_expression_alias() {
12697 let expr = Expression::column("id").alias("user_id");
12698
12699 match expr {
12700 Expression::Alias(a) => {
12701 assert_eq!(a.alias.name, "user_id");
12702 }
12703 _ => panic!("Expected Alias"),
12704 }
12705 }
12706
12707 #[test]
12708 fn test_literal_creation() {
12709 let num = Expression::number(42);
12710 let str = Expression::string("hello");
12711
12712 match num {
12713 Expression::Literal(Literal::Number(n)) => assert_eq!(n, "42"),
12714 _ => panic!("Expected Number"),
12715 }
12716
12717 match str {
12718 Expression::Literal(Literal::String(s)) => assert_eq!(s, "hello"),
12719 _ => panic!("Expected String"),
12720 }
12721 }
12722
12723 #[test]
12724 fn test_expression_sql() {
12725 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
12726 assert_eq!(expr.sql(), "SELECT 1 + 2");
12727 }
12728
12729 #[test]
12730 fn test_expression_sql_for() {
12731 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
12732 let sql = expr.sql_for(crate::DialectType::Generic);
12733 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
12735 }
12736}