Polyglot SQL API Documentation - v0.2.0
    Preparing search index...

    Function tokenize

    • Tokenize SQL into a token stream.

      Parameters

      • sql: string

        The SQL string to tokenize

      • dialect: Dialect = Dialect.Generic

        The dialect to use for tokenization

      Returns TokenizeResult

      The token stream

      const result = tokenize("SELECT a, b FROM t", Dialect.PostgreSQL);
      if (result.success) {
      for (const token of result.tokens!) {
      console.log(token.tokenType, token.text, token.span);
      }
      }