createIntrospector

The createIntrospector method creates the introspector that lists the database's tables and columns from the Client's getSchema. Kysely calls it.

createIntrospector(): DatabaseIntrospector
returnsDatabaseIntrospector

A Kysely database introspector.

Example

import {create} from 'tinyjoin';
import {TinyJoinDialect} from 'tinyjoin/kysely';
import {Kysely} from 'kysely';

const client = await create();
await client.exec(`
  CREATE TABLE tasks (id TEXT PRIMARY KEY, title TEXT NOT NULL)
`);
const db = new Kysely<unknown>({dialect: new TinyJoinDialect({client})});

// Kysely reads the tables through the introspector.
const [tasks] = await db.introspection.getTables();
console.log(tasks.name);
// -> 'tasks'
console.log(tasks.columns.map(({name, dataType}) => [name, dataType]));
// -> [['id', 'text'], ['title', 'text']]
await client.close();