@@ -2391,6 +2391,132 @@ func tableReferenceToJSON(ref ast.TableReference) jsonNode {
23912391 }
23922392 node ["Parameters" ] = params
23932393 }
2394+ if r .Alias != nil {
2395+ node ["Alias" ] = identifierToJSON (r .Alias )
2396+ }
2397+ if len (r .Columns ) > 0 {
2398+ cols := make ([]jsonNode , len (r .Columns ))
2399+ for i , c := range r .Columns {
2400+ cols [i ] = identifierToJSON (c )
2401+ }
2402+ node ["Columns" ] = cols
2403+ }
2404+ node ["ForPath" ] = r .ForPath
2405+ return node
2406+ case * ast.GlobalFunctionTableReference :
2407+ node := jsonNode {
2408+ "$type" : "GlobalFunctionTableReference" ,
2409+ }
2410+ if r .Name != nil {
2411+ node ["Name" ] = identifierToJSON (r .Name )
2412+ }
2413+ if len (r .Parameters ) > 0 {
2414+ params := make ([]jsonNode , len (r .Parameters ))
2415+ for i , p := range r .Parameters {
2416+ params [i ] = scalarExpressionToJSON (p )
2417+ }
2418+ node ["Parameters" ] = params
2419+ }
2420+ if r .Alias != nil {
2421+ node ["Alias" ] = identifierToJSON (r .Alias )
2422+ }
2423+ if len (r .Columns ) > 0 {
2424+ cols := make ([]jsonNode , len (r .Columns ))
2425+ for i , c := range r .Columns {
2426+ cols [i ] = identifierToJSON (c )
2427+ }
2428+ node ["Columns" ] = cols
2429+ }
2430+ node ["ForPath" ] = r .ForPath
2431+ return node
2432+ case * ast.InlineDerivedTable :
2433+ node := jsonNode {
2434+ "$type" : "InlineDerivedTable" ,
2435+ }
2436+ if len (r .RowValues ) > 0 {
2437+ rows := make ([]jsonNode , len (r .RowValues ))
2438+ for i , row := range r .RowValues {
2439+ rowNode := jsonNode {
2440+ "$type" : "RowValue" ,
2441+ }
2442+ if len (row .ColumnValues ) > 0 {
2443+ vals := make ([]jsonNode , len (row .ColumnValues ))
2444+ for j , v := range row .ColumnValues {
2445+ vals [j ] = scalarExpressionToJSON (v )
2446+ }
2447+ rowNode ["ColumnValues" ] = vals
2448+ }
2449+ rows [i ] = rowNode
2450+ }
2451+ node ["RowValues" ] = rows
2452+ }
2453+ if len (r .Columns ) > 0 {
2454+ cols := make ([]jsonNode , len (r .Columns ))
2455+ for i , c := range r .Columns {
2456+ cols [i ] = identifierToJSON (c )
2457+ }
2458+ node ["Columns" ] = cols
2459+ }
2460+ if r .Alias != nil {
2461+ node ["Alias" ] = identifierToJSON (r .Alias )
2462+ }
2463+ node ["ForPath" ] = r .ForPath
2464+ return node
2465+ case * ast.ChangeTableChangesTableReference :
2466+ node := jsonNode {
2467+ "$type" : "ChangeTableChangesTableReference" ,
2468+ }
2469+ if r .Target != nil {
2470+ node ["Target" ] = schemaObjectNameToJSON (r .Target )
2471+ }
2472+ if r .SinceVersion != nil {
2473+ node ["SinceVersion" ] = scalarExpressionToJSON (r .SinceVersion )
2474+ }
2475+ node ["ForceSeek" ] = r .ForceSeek
2476+ if len (r .Columns ) > 0 {
2477+ cols := make ([]jsonNode , len (r .Columns ))
2478+ for i , c := range r .Columns {
2479+ cols [i ] = identifierToJSON (c )
2480+ }
2481+ node ["Columns" ] = cols
2482+ }
2483+ if r .Alias != nil {
2484+ node ["Alias" ] = identifierToJSON (r .Alias )
2485+ }
2486+ node ["ForPath" ] = r .ForPath
2487+ return node
2488+ case * ast.ChangeTableVersionTableReference :
2489+ node := jsonNode {
2490+ "$type" : "ChangeTableVersionTableReference" ,
2491+ }
2492+ if r .Target != nil {
2493+ node ["Target" ] = schemaObjectNameToJSON (r .Target )
2494+ }
2495+ if len (r .PrimaryKeyColumns ) > 0 {
2496+ cols := make ([]jsonNode , len (r .PrimaryKeyColumns ))
2497+ for i , c := range r .PrimaryKeyColumns {
2498+ cols [i ] = identifierToJSON (c )
2499+ }
2500+ node ["PrimaryKeyColumns" ] = cols
2501+ }
2502+ if len (r .PrimaryKeyValues ) > 0 {
2503+ vals := make ([]jsonNode , len (r .PrimaryKeyValues ))
2504+ for i , v := range r .PrimaryKeyValues {
2505+ vals [i ] = scalarExpressionToJSON (v )
2506+ }
2507+ node ["PrimaryKeyValues" ] = vals
2508+ }
2509+ node ["ForceSeek" ] = r .ForceSeek
2510+ if len (r .Columns ) > 0 {
2511+ cols := make ([]jsonNode , len (r .Columns ))
2512+ for i , c := range r .Columns {
2513+ cols [i ] = identifierToJSON (c )
2514+ }
2515+ node ["Columns" ] = cols
2516+ }
2517+ if r .Alias != nil {
2518+ node ["Alias" ] = identifierToJSON (r .Alias )
2519+ }
23942520 node ["ForPath" ] = r .ForPath
23952521 return node
23962522 case * ast.InternalOpenRowset :
0 commit comments