AST Visitor Utilities
This module exports walker and transformer functions for traversing and manipulating SQL AST nodes.
Replace nodes matching a predicate with a new node
// Replace all NULL literals with 0const newAst = replaceNodes( ast, (node) => getExprType(node) === 'null', { literal: { literal_type: 'number', value: '0' } } as Expression); Copy
// Replace all NULL literals with 0const newAst = replaceNodes( ast, (node) => getExprType(node) === 'null', { literal: { literal_type: 'number', value: '0' } } as Expression);
AST Visitor Utilities
This module exports walker and transformer functions for traversing and manipulating SQL AST nodes.