Walk calls visit on every node. If visit returns true, the underlying nodes are also visited. If it returns an error, walking is interrupted, and the error is returned.
(visit Visit, nodes ...SQLNode)
| 236 | // are also visited. If it returns an error, walking |
| 237 | // is interrupted, and the error is returned. |
| 238 | func Walk(visit Visit, nodes ...SQLNode) error { |
| 239 | for _, node := range nodes { |
| 240 | if node == nil { |
| 241 | continue |
| 242 | } |
| 243 | kontinue, err := visit(node) |
| 244 | if err != nil { |
| 245 | return err |
| 246 | } |
| 247 | if kontinue { |
| 248 | err = node.walkSubtree(visit) |
| 249 | if err != nil { |
| 250 | return err |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | return nil |
| 255 | } |
| 256 | |
| 257 | // String returns a string representation of an SQLNode. |
| 258 | func String(node SQLNode) string { |