Transform an AST tree, returning a new tree with modifications
// Rename all columns named 'old' to 'new'const newAst = transform(ast, { column: (node) => { const data = getExprData(node); if (data.name.name === 'old') { return makeExpr('column', { ...data, name: { ...data.name, name: 'new' } }); } }}); Copy
// Rename all columns named 'old' to 'new'const newAst = transform(ast, { column: (node) => { const data = getExprData(node); if (data.name.name === 'old') { return makeExpr('column', { ...data, name: { ...data.name, name: 'new' } }); } }});
Transform an AST tree, returning a new tree with modifications