google-sql-syntax-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Google SQL

Typescript and monaco definitions for Google SQL.

Installation

This package is hosted on npm, so can be installed with npm or an equivalent package manager.

npm i @google/google-sql-syntax-ts

Formatting SQL

Example usage:

import { QueryFormatter, GoogleSqlDefinition } from "google-sql-syntax-ts";

const queryFormatter = new QueryFormatter(new GoogleSqlDefinition());

const formattedQuery = queryFormatter.formatQuery(
  "SELECT column, REGEXP_CONTAINS(column, r'a') AS column_contains_a FROM `some-table` WHERE date > 1970-01-01"
);

The formatted query will look like:

SELECT
  COLUMN,
  REGEXP_CONTAINS(COLUMN, r'a') AS column_contains_a
FROM
  `some-table`
WHERE
  date > 1970-01-01

Monaco Editor SQL Highlighting

googleSqlLanguageConfiguration is exported, which can be used as a language configuration for the Monaco Editor.

/google-sql-syntax-ts/

    Package Sidebar

    Install

    npm i google-sql-syntax-ts

    Weekly Downloads

    3,335

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    321 kB

    Total Files

    24

    Last publish

    Collaborators

    • google-wombot