src/where.js
function traverse (node, options) {
  if (!node) {
    return ''
  }

  switch (node.type) {
    case 'unary_expr':
    case 'binary_expr':
      return handleExpr(node, options)
    case 'function':
      return handleFunction(node, options)
    case 'expr_list':
      return handleExprList(node, options)
    case 'column_ref':
      return handleColumn(node, options)
    case 'string':
    case 'number':
    case 'null':
    case 'bool':
      return handleValue(node, options)
    case 'timestamp':
      return handleTimestampValue(node, options)
    default:
      throw new Error('Unrecognized AST node: \n' + JSON.stringify(node, null, 2))
  }
}
function traverse (node, options) {
  if (!node) {
    return ''
  }

  switch (node.type) {
    case 'unary_expr':
    case 'binary_expr':
      return handleExpr(node, options)
    case 'function':
      return handleFunction(node, options)
    case 'expr_list':
      return handleExprList(node, options)
    case 'column_ref':
      return handleColumn(node, options)
    case 'string':
    case 'number':
    case 'null':
    case 'bool':
      return handleValue(node, options)
    case 'timestamp':
      return handleTimestampValue(node, options)
    default:
      throw new Error('Unrecognized AST node: \n' + JSON.stringify(node, null, 2))
  }
}
function traverse ( node , options ) { if ( ! node ) { return '' } switch ( node . type ) { case 'unary_expr' : case 'binary_expr' : return handleExpr ( node , options ) case 'function' : return handleFunction ( node , options ) case 'expr_list' : return handleExprList ( node , options ) case 'column_ref' : return handleColumn ( node , options ) case 'string' : case 'number' : case 'null' : case 'bool' : return handleValue ( node , options ) case 'timestamp' : return handleTimestampValue ( node , options ) default : throw new Error ( 'Unrecognized AST node: \n' + JSON . stringify ( node , null , 2 ) ) } }
Traverse a SQL AST and return its string representation
@param  {object} node    AST node
@param  {object} options winnow options
@return {string}         AST string
Traverse a SQL AST and return its string representation