Skip to content

export 'MySqlParserVisitor' (imported as 'MySqlParserVisitor') was not found in 'dt-sql-parser' #236

@Landadadada

Description

@Landadadada

Version
4.0.0-beta.4.9

The Type of SQL
MySQL

Your Code
从文档中复制的代码

import { MySQL, MySqlParserVisitor } from 'dt-sql-parser'

const parser = new MySQL()
const sql = 'select id,name from user1;'
// parseTree
const tree = parser.parse(sql)
class MyVisitor extends MySqlParserVisitor {
  // 重写 visitTableName 方法
  visitTableName(ctx) {
    let tableName = ctx.getText().toLowerCase()
    console.log('TableName', tableName)
  }

  // 重写 visitSelectElements 方法
  visitSelectElements(ctx) {
    let selectElements = ctx.getText().toLowerCase()
    console.log('SelectElements', selectElements)
  }
}
const visitor = new MyVisitor()
visitor.visit(tree)

Problem
从文档中复制的代码,在浏览器端运行报错,没有导出MySqlParserVisitor.
为什么dist/lib/spark/SparkSqlParserVisitor.js导出的是空对象呢?

export 'MySqlParserVisitor' (imported as 'MySqlParserVisitor') was not found in 'dt-sql-parser' (possible exports: 
FlinkSQL, HiveSQL, ImpalaSQL, MySQL, PLSQL, PostgresSQL, SparkSQL, SyntaxContextType, TrinoSQL, legacy_cleanSql, legacy_lexer, legacy_splitSql)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentationhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions