createQueryCompiler
The createQueryCompiler method creates Kysely's PostgreSQL query compiler. Kysely calls it.
createQueryCompiler(): QueryCompiler| returns | QueryCompiler | A Kysely query compiler. |
|---|
Example
import {create} from 'tinyjoin';
import {TinyJoinDialect} from 'tinyjoin/kysely';
import {Kysely} from 'kysely';
interface Database {
tasks: {id: string; title: string};
}
const client = await create();
const db = new Kysely<Database>({dialect: new TinyJoinDialect({client})});
// Kysely compiles each query with the compiler, into PostgreSQL's SQL.
const {sql, parameters} = db
.selectFrom('tasks')
.select('title')
.where('id', '=', 'a')
.compile();
console.log(sql);
// -> 'select "title" from "tasks" where "id" = $1'
console.log(parameters);
// -> ['a']
await client.close();