• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rogerpadilla / uql / 20684188712

03 Jan 2026 11:05PM UTC coverage: 95.31% (-2.8%) from 98.157%
20684188712

push

github

rogerpadilla
refactor: Migrate testing infrastructure to Vitest, add new querier pools, and expand test coverage.

1250 of 1388 branches covered (90.06%)

Branch coverage included in aggregate %.

108 of 117 new or added lines in 14 files covered. (92.31%)

51 existing lines in 14 files now uncovered.

3383 of 3473 relevant lines covered (97.41%)

223.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.49
/packages/core/src/sqlite/sqliteDialect.ts
1
import sqlstring from 'sqlstring-sqlite';
2
import { AbstractSqlDialect } from '../dialect/index.js';
3
import { getMeta } from '../entity/index.js';
4
import type {
5
  FieldKey,
6
  NamingStrategy,
7
  QueryComparisonOptions,
8
  QueryConflictPaths,
9
  QueryContext,
10
  QueryTextSearchOptions,
11
  QueryWhereFieldOperatorMap,
12
  QueryWhereMap,
13
  Type,
14
} from '../type/index.js';
15

16
export class SqliteDialect extends AbstractSqlDialect {
17
  constructor(namingStrategy?: NamingStrategy) {
18
    super(namingStrategy, '`', 'BEGIN TRANSACTION');
15✔
19
  }
20

21
  override addValue(values: unknown[], value: unknown): string {
22
    if (value instanceof Date) {
871✔
23
      value = value.getTime();
2✔
24
    } else if (typeof value === 'boolean') {
869!
25
      value = value ? 1 : 0;
×
26
    }
27
    return super.addValue(values, value);
871✔
28
  }
29

30
  override compare<E, K extends keyof QueryWhereMap<E>>(
31
    ctx: QueryContext,
32
    entity: Type<E>,
33
    key: K,
34
    val: QueryWhereMap<E>[K],
35
    opts?: QueryComparisonOptions,
36
  ): void {
37
    if (key === '$text') {
465✔
38
      const meta = getMeta(entity);
2✔
39
      const search = val as QueryTextSearchOptions<E>;
2✔
40
      const fields = search.$fields.map((fKey) => {
2✔
41
        const field = meta.fields[fKey];
3✔
42
        const columnName = this.resolveColumnName(fKey as string, field);
3✔
43
        return this.escapeId(columnName);
3✔
44
      });
45
      const tableName = this.resolveTableName(entity, meta);
2✔
46
      ctx.append(`${this.escapeId(tableName)} MATCH {${fields.join(' ')}} : `);
2✔
47
      ctx.addValue(search.$value);
2✔
48
      return;
2✔
49
    }
50
    super.compare(ctx, entity, key, val, opts);
463✔
51
  }
52

53
  override compareFieldOperator<E, K extends keyof QueryWhereFieldOperatorMap<E>>(
54
    ctx: QueryContext,
55
    entity: Type<E>,
56
    key: FieldKey<E>,
57
    op: K,
58
    val: QueryWhereFieldOperatorMap<E>[K],
59
    opts: QueryComparisonOptions = {},
443✔
60
  ): void {
61
    super.compareFieldOperator(ctx, entity, key, op, val, opts);
443✔
62
  }
63

64
  override upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E): void {
65
    const meta = getMeta(entity);
6✔
66
    const update = this.getUpsertUpdateAssignments(ctx, meta, conflictPaths, payload, (name) => `EXCLUDED.${name}`);
10✔
67
    const keysStr = this.getUpsertConflictPathsStr(meta, conflictPaths);
6✔
68
    const onConflict = update ? `DO UPDATE SET ${update}` : 'DO NOTHING';
6✔
69
    this.insert(ctx, entity, payload);
6✔
70
    ctx.append(` ON CONFLICT (${keysStr}) ${onConflict}`);
6✔
71
  }
72

73
  override escape(value: unknown): string {
UNCOV
74
    return sqlstring.escape(value);
×
75
  }
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc