@@ -133,6 +133,17 @@ type application struct {
133133 iter iterator
134134}
135135
136+ type dummyNode struct {
137+ Node nodes.Node
138+ }
139+
140+ func (node dummyNode ) Deparse () string {
141+ panic ("Not Implemented" )
142+ }
143+
144+ func (node dummyNode ) Fingerprint (ctx nodes.FingerprintContext , parentNode nodes.Node , parentFieldName string ) {
145+ }
146+
136147func (a * application ) apply (parent nodes.Node , name string , iter * iterator , node nodes.Node ) {
137148 // convert typed nil into untyped nil
138149 if v := reflect .ValueOf (node ); v .Kind () == reflect .Ptr && v .IsNil () {
@@ -1291,13 +1302,20 @@ func (a *application) apply(parent nodes.Node, name string, iter *iterator, node
12911302 a .apply (& n , "GroupClause" , nil , n .GroupClause )
12921303 a .apply (& n , "HavingClause" , nil , n .HavingClause )
12931304 a .apply (& n , "WindowClause" , nil , n .WindowClause )
1294- // TODO: Not sure how to handle a slice of a slice
1295- //
1296- // for _, vs := range n.ValuesLists {
1297- // for _, v := range vs {
1298- // a.apply(&n, "", nil, v)
1299- // }
1300- // }
1305+
1306+ // ValuesLists is a slice of Node slices, which does not implement the
1307+ // Node interface For each Node in the list, pass a dummy node to apply
1308+ // and then updated the ValuesList if it was set.
1309+ for i := range n .ValuesLists {
1310+ for j := range n .ValuesLists [i ] {
1311+ dn := dummyNode {}
1312+ a .apply (& dn , "Node" , nil , n.ValuesLists [i ][j ])
1313+ if dn .Node != nil {
1314+ n.ValuesLists [i ][j ] = dn .Node
1315+ }
1316+ }
1317+ }
1318+
13011319 a .apply (& n , "SortClause" , nil , n .SortClause )
13021320 a .apply (& n , "LimitOffset" , nil , n .LimitOffset )
13031321 a .apply (& n , "LimitCount" , nil , n .LimitCount )
0 commit comments