Skip to content

Instantly share code, notes, and snippets.

@jeiea
Last active December 14, 2021 05:06
Show Gist options
  • Save jeiea/e8a58f8c8c5b6903053c4eacd800f684 to your computer and use it in GitHub Desktop.
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/[email protected]";
import { readAll, writeAll } from "https://deno.land/[email protected]/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