isDatabaseOf<T>(database: Database<any>, adapterClassType: AbstractClassType<T>): database is Database<T>
Type guard for a specialised database adapter. Can be used to
use special methods from an adapter on a generic Database object.
constdatabase = newDatabase(...); //we don't know the adapter
if (isDatabaseOf(database, SQLDatabaseAdapter)) { // cool, we can use `where(sql)` which is only available for SQLDatabaseAdapter database.query(User).where(sql`id > 2`).find();
//or raw SQL queries database.raw(sql`SELECT count(*) FROM ${User}`).find(); }
Type guard for a specialised database adapter. Can be used to use special methods from an adapter on a generic Database object.