Skip to main content
Module

x/pgsql_ast_parser/mod.ts>astMapper

Yet another simple Postgres SQL parser
Go to Latest
function astMapper
import { astMapper } from "https://deno.land/x/pgsql_ast_parser@10.5.2/mod.ts";

Builds an AST modifier based on the default implementation, merged with the one you provide.

Example of a modifier that renames all reference to columns 'foo' to 'bar'

 const mapper = astMapper(b => ({
      ref: a => assignChanged(a, {
          name: a.name === 'foo'
              ? 'bar'
              : a.name
      })
  }));

const modified = mapper.statement(myStatementToModify);

Parameters

modifierBuilder: MapperBuilder