Skip to content

Instantly share code, notes, and snippets.

@jeiea
Last active December 14, 2021 05:06
Show Gist options
  • Select an option

  • Save jeiea/e8a58f8c8c5b6903053c4eacd800f684 to your computer and use it in GitHub Desktop.

Select an option

Save jeiea/e8a58f8c8c5b6903053c4eacd800f684 to your computer and use it in GitHub Desktop.
deno sql formatter for dbeaver
// deno run sql_format.ts
import { format } from "http://esm.sh/sql-formatter@4.0.2";
import { readAll, writeAll } from "https://deno.land/std@0.117.0/io/mod.ts";
const input = await readAll(Deno.stdin);
const unformatted = new TextDecoder().decode(input);
const formatted = format(unformatted, { language: "mysql" });
await writeAll(Deno.stdout, new TextEncoder().encode(formatted));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment