@@ -2971,7 +2971,7 @@ type QueryParam struct {
2971
2971
LBracePos Pos
2972
2972
RBracePos Pos
2973
2973
Name * Ident
2974
- Type Expr
2974
+ Type ColumnType
2975
2975
}
2976
2976
2977
2977
func (q * QueryParam ) Pos () Pos {
@@ -3182,7 +3182,7 @@ type ColumnDef struct {
3182
3182
NamePos Pos
3183
3183
ColumnEnd Pos
3184
3184
Name * NestedIdentifier
3185
- Type Expr
3185
+ Type ColumnType
3186
3186
NotNull * NotNullLiteral
3187
3187
Nullable * NullLiteral
3188
3188
@@ -3298,72 +3298,85 @@ func (c *ColumnDef) Accept(visitor ASTVisitor) error {
3298
3298
return visitor .VisitColumnDef (c )
3299
3299
}
3300
3300
3301
- type ScalarTypeExpr struct {
3301
+ type ColumnType interface {
3302
+ Expr
3303
+ Type () string
3304
+ }
3305
+
3306
+ type ScalarType struct {
3302
3307
Name * Ident
3303
3308
}
3304
3309
3305
- func (s * ScalarTypeExpr ) Pos () Pos {
3310
+ func (s * ScalarType ) Pos () Pos {
3306
3311
return s .Name .NamePos
3307
3312
}
3308
3313
3309
- func (s * ScalarTypeExpr ) End () Pos {
3314
+ func (s * ScalarType ) End () Pos {
3310
3315
return s .Name .NameEnd
3311
3316
}
3312
3317
3313
- func (s * ScalarTypeExpr ) String () string {
3318
+ func (s * ScalarType ) String () string {
3314
3319
return s .Name .String ()
3315
3320
}
3316
3321
3317
- func (s * ScalarTypeExpr ) Accept (visitor ASTVisitor ) error {
3322
+ func (s * ScalarType ) Accept (visitor ASTVisitor ) error {
3318
3323
visitor .enter (s )
3319
3324
defer visitor .leave (s )
3320
3325
if err := s .Name .Accept (visitor ); err != nil {
3321
3326
return err
3322
3327
}
3323
- return visitor .VisitScalarTypeExpr (s )
3328
+ return visitor .VisitScalarType (s )
3324
3329
}
3325
3330
3326
- type PropertyTypeExpr struct {
3331
+ func (s * ScalarType ) Type () string {
3332
+ return s .Name .Name
3333
+ }
3334
+
3335
+ type PropertyType struct {
3327
3336
Name * Ident
3328
3337
}
3329
3338
3330
- func (c * PropertyTypeExpr ) Pos () Pos {
3339
+ func (c * PropertyType ) Pos () Pos {
3331
3340
return c .Name .NamePos
3332
3341
}
3333
3342
3334
- func (c * PropertyTypeExpr ) End () Pos {
3343
+ func (c * PropertyType ) End () Pos {
3335
3344
return c .Name .NameEnd
3336
3345
}
3337
3346
3338
- func (c * PropertyTypeExpr ) String () string {
3347
+ func (c * PropertyType ) String () string {
3339
3348
return c .Name .String ()
3340
3349
}
3341
3350
3342
- func (c * PropertyTypeExpr ) Accept (visitor ASTVisitor ) error {
3351
+ func (c * PropertyType ) Accept (visitor ASTVisitor ) error {
3343
3352
visitor .enter (c )
3344
3353
defer visitor .leave (c )
3345
3354
if err := c .Name .Accept (visitor ); err != nil {
3346
3355
return err
3347
3356
}
3348
- return visitor .VisitPropertyTypeExpr (c )
3357
+ return visitor .VisitPropertyType (c )
3358
+ }
3359
+
3360
+ func (c * PropertyType ) Type () string {
3361
+ return c .Name .Name
3349
3362
}
3350
3363
3351
- type TypeWithParamsExpr struct {
3364
+ type TypeWithParams struct {
3352
3365
LeftParenPos Pos
3353
3366
RightParenPos Pos
3354
3367
Name * Ident
3355
3368
Params []Literal
3356
3369
}
3357
3370
3358
- func (s * TypeWithParamsExpr ) Pos () Pos {
3371
+ func (s * TypeWithParams ) Pos () Pos {
3359
3372
return s .Name .NamePos
3360
3373
}
3361
3374
3362
- func (s * TypeWithParamsExpr ) End () Pos {
3375
+ func (s * TypeWithParams ) End () Pos {
3363
3376
return s .RightParenPos
3364
3377
}
3365
3378
3366
- func (s * TypeWithParamsExpr ) String () string {
3379
+ func (s * TypeWithParams ) String () string {
3367
3380
var builder strings.Builder
3368
3381
builder .WriteString (s .Name .String ())
3369
3382
builder .WriteByte ('(' )
@@ -3377,7 +3390,7 @@ func (s *TypeWithParamsExpr) String() string {
3377
3390
return builder .String ()
3378
3391
}
3379
3392
3380
- func (s * TypeWithParamsExpr ) Accept (visitor ASTVisitor ) error {
3393
+ func (s * TypeWithParams ) Accept (visitor ASTVisitor ) error {
3381
3394
visitor .enter (s )
3382
3395
defer visitor .leave (s )
3383
3396
if err := s .Name .Accept (visitor ); err != nil {
@@ -3388,25 +3401,29 @@ func (s *TypeWithParamsExpr) Accept(visitor ASTVisitor) error {
3388
3401
return err
3389
3402
}
3390
3403
}
3391
- return visitor .VisitTypeWithParamsExpr (s )
3404
+ return visitor .VisitTypeWithParams (s )
3392
3405
}
3393
3406
3394
- type ComplexTypeExpr struct {
3407
+ func (s * TypeWithParams ) Type () string {
3408
+ return s .Name .Name
3409
+ }
3410
+
3411
+ type ComplexType struct {
3395
3412
LeftParenPos Pos
3396
3413
RightParenPos Pos
3397
3414
Name * Ident
3398
- Params []Expr
3415
+ Params []ColumnType
3399
3416
}
3400
3417
3401
- func (c * ComplexTypeExpr ) Pos () Pos {
3418
+ func (c * ComplexType ) Pos () Pos {
3402
3419
return c .Name .NamePos
3403
3420
}
3404
3421
3405
- func (c * ComplexTypeExpr ) End () Pos {
3422
+ func (c * ComplexType ) End () Pos {
3406
3423
return c .RightParenPos
3407
3424
}
3408
3425
3409
- func (c * ComplexTypeExpr ) String () string {
3426
+ func (c * ComplexType ) String () string {
3410
3427
var builder strings.Builder
3411
3428
builder .WriteString (c .Name .String ())
3412
3429
builder .WriteByte ('(' )
@@ -3420,7 +3437,7 @@ func (c *ComplexTypeExpr) String() string {
3420
3437
return builder .String ()
3421
3438
}
3422
3439
3423
- func (c * ComplexTypeExpr ) Accept (visitor ASTVisitor ) error {
3440
+ func (c * ComplexType ) Accept (visitor ASTVisitor ) error {
3424
3441
visitor .enter (c )
3425
3442
defer visitor .leave (c )
3426
3443
if err := c .Name .Accept (visitor ); err != nil {
@@ -3431,25 +3448,29 @@ func (c *ComplexTypeExpr) Accept(visitor ASTVisitor) error {
3431
3448
return err
3432
3449
}
3433
3450
}
3434
- return visitor .VisitComplexTypeExpr (c )
3451
+ return visitor .VisitComplexType (c )
3452
+ }
3453
+
3454
+ func (c * ComplexType ) Type () string {
3455
+ return c .Name .Name
3435
3456
}
3436
3457
3437
- type NestedTypeExpr struct {
3458
+ type NestedType struct {
3438
3459
LeftParenPos Pos
3439
3460
RightParenPos Pos
3440
3461
Name * Ident
3441
3462
Columns []Expr
3442
3463
}
3443
3464
3444
- func (n * NestedTypeExpr ) Pos () Pos {
3465
+ func (n * NestedType ) Pos () Pos {
3445
3466
return n .Name .NamePos
3446
3467
}
3447
3468
3448
- func (n * NestedTypeExpr ) End () Pos {
3469
+ func (n * NestedType ) End () Pos {
3449
3470
return n .RightParenPos
3450
3471
}
3451
3472
3452
- func (n * NestedTypeExpr ) String () string {
3473
+ func (n * NestedType ) String () string {
3453
3474
var builder strings.Builder
3454
3475
// on the same level as the column type
3455
3476
builder .WriteString (n .Name .String ())
@@ -3465,7 +3486,7 @@ func (n *NestedTypeExpr) String() string {
3465
3486
return builder .String ()
3466
3487
}
3467
3488
3468
- func (n * NestedTypeExpr ) Accept (visitor ASTVisitor ) error {
3489
+ func (n * NestedType ) Accept (visitor ASTVisitor ) error {
3469
3490
visitor .enter (n )
3470
3491
defer visitor .leave (n )
3471
3492
if err := n .Name .Accept (visitor ); err != nil {
@@ -3476,7 +3497,11 @@ func (n *NestedTypeExpr) Accept(visitor ASTVisitor) error {
3476
3497
return err
3477
3498
}
3478
3499
}
3479
- return visitor .VisitNestedTypeExpr (n )
3500
+ return visitor .VisitNestedType (n )
3501
+ }
3502
+
3503
+ func (n * NestedType ) Type () string {
3504
+ return n .Name .Name
3480
3505
}
3481
3506
3482
3507
type CompressionCodec struct {
@@ -3689,29 +3714,29 @@ func (e *EnumValue) Accept(visitor ASTVisitor) error {
3689
3714
if err := e .Value .Accept (visitor ); err != nil {
3690
3715
return err
3691
3716
}
3692
- return visitor .VisitEnumValueExpr (e )
3717
+ return visitor .VisitEnumValue (e )
3693
3718
}
3694
3719
3695
- type EnumValueList struct {
3720
+ type EnumType struct {
3696
3721
Name * Ident
3697
3722
ListPos Pos
3698
3723
ListEnd Pos
3699
- Enums []EnumValue
3724
+ Values []EnumValue
3700
3725
}
3701
3726
3702
- func (e * EnumValueList ) Pos () Pos {
3727
+ func (e * EnumType ) Pos () Pos {
3703
3728
return e .ListPos
3704
3729
}
3705
3730
3706
- func (e * EnumValueList ) End () Pos {
3731
+ func (e * EnumType ) End () Pos {
3707
3732
return e .ListEnd
3708
3733
}
3709
3734
3710
- func (e * EnumValueList ) String () string {
3735
+ func (e * EnumType ) String () string {
3711
3736
var builder strings.Builder
3712
3737
builder .WriteString (e .Name .String ())
3713
3738
builder .WriteByte ('(' )
3714
- for i , enum := range e .Enums {
3739
+ for i , enum := range e .Values {
3715
3740
if i > 0 {
3716
3741
builder .WriteString (", " )
3717
3742
}
@@ -3721,18 +3746,22 @@ func (e *EnumValueList) String() string {
3721
3746
return builder .String ()
3722
3747
}
3723
3748
3724
- func (e * EnumValueList ) Accept (visitor ASTVisitor ) error {
3749
+ func (e * EnumType ) Accept (visitor ASTVisitor ) error {
3725
3750
visitor .enter (e )
3726
3751
defer visitor .leave (e )
3727
3752
if err := e .Name .Accept (visitor ); err != nil {
3728
3753
return err
3729
3754
}
3730
- for i := range e .Enums {
3731
- if err := e .Enums [i ].Accept (visitor ); err != nil {
3755
+ for i := range e .Values {
3756
+ if err := e .Values [i ].Accept (visitor ); err != nil {
3732
3757
return err
3733
3758
}
3734
3759
}
3735
- return visitor .VisitEnumValueExprList (e )
3760
+ return visitor .VisitEnumType (e )
3761
+ }
3762
+
3763
+ func (e * EnumType ) Type () string {
3764
+ return e .Name .Name
3736
3765
}
3737
3766
3738
3767
type IntervalExpr struct {
0 commit comments