teableio/teable

View on GitHub
apps/nestjs-backend/src/db-provider/base-query/base-query.sqlite.ts

Summary

Maintainability
A
0 mins
Test Coverage
import type { Knex } from 'knex';
import { BaseQueryAbstract } from './abstract';

export class BaseQuerySqlite extends BaseQueryAbstract {
  constructor(protected readonly knex: Knex) {
    super(knex);
  }

  jsonSelect(
    queryBuilder: Knex.QueryBuilder,
    dbFieldName: string,
    alias: string
  ): Knex.QueryBuilder {
    return queryBuilder.select(this.knex.raw(`MAX(??) AS ??`, [dbFieldName, alias]));
  }
}