/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/core/database/src/utils/knex.ts
22 строки
692 B
Alexandre Bodin
Export isKnexQuery but tag is as internal
09 окт 2023, 11:54
09 окт 2023, 11:54
338a75f
Код
Авторство
О чём код?
import type { Knex } from 'knex'; import KnexBuilder from 'knex/lib/query/querybuilder'; import KnexRaw from 'knex/lib/raw'; import type { Database } from '..'; /** * @internal */ export function isKnexQuery(value: unknown): value is Knex.Raw | Knex.QueryBuilder { return value instanceof KnexBuilder || value instanceof KnexRaw; } /** * Adds the name of the schema to the table name if the schema was defined by the user. * Users can set the db schema only for Postgres in strapi database config. */ export const addSchema = (db: Database, tableName: string): string => { const schemaName = db.getSchemaName(); return schemaName ? `${schemaName}.${tableName}` : tableName; };