import Db2Formatter from './languages/Db2Formatter' ; import N1qlFormatter from './languages/N1qlFormatter' ; import PlSqlFormatter from './languages/PlSqlFormatter' ; import StandardSqlFormatter from './languages/StandardSqlFormatter' ; import { Config , Token } from './core/types' ; param { string } query param { Config } cfg param { string } cfg . language param { string } cfg . indent param { string } cfg . reservedWordCase param { number | 'preserve' } cfg . linesBetweenQueries param { any } cfg . params return { string } export const format = ( query , cfg = { } ) : string => { switch ( cfg . language ) { case 'db2' : return new Db2Formatter ( cfg ) . format ( query ) ; case 'n1ql' : return new N1qlFormatter ( cfg ) . format ( query ) ; case 'pl/sql' : return new PlSqlFormatter ( cfg ) . format ( query ) ; case 'sql' : default : return new StandardSqlFormatter ( cfg ) . format ( query ) ; } } ; param { string } query param { Config } cfg return { Token [ ] } export const tokenize = ( query , cfg = { } ) : Token [ ] => { return new StandardSqlFormatter ( cfg ) . tokenize ( query ) ; } ; export default { format , tokenize } ;