indexes.d.cts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { entityKind } from "../entity.cjs";
  2. import type { SQL } from "../sql/sql.cjs";
  3. import type { SQLiteColumn } from "./columns/index.cjs";
  4. import type { SQLiteTable } from "./table.cjs";
  5. export interface IndexConfig {
  6. name: string;
  7. columns: IndexColumn[];
  8. unique: boolean;
  9. where: SQL | undefined;
  10. }
  11. export type IndexColumn = SQLiteColumn | SQL;
  12. export declare class IndexBuilderOn {
  13. private name;
  14. private unique;
  15. static readonly [entityKind]: string;
  16. constructor(name: string, unique: boolean);
  17. on(...columns: [IndexColumn, ...IndexColumn[]]): IndexBuilder;
  18. }
  19. export declare class IndexBuilder {
  20. static readonly [entityKind]: string;
  21. _: {
  22. brand: 'SQLiteIndexBuilder';
  23. };
  24. constructor(name: string, columns: IndexColumn[], unique: boolean);
  25. /**
  26. * Condition for partial index.
  27. */
  28. where(condition: SQL): this;
  29. }
  30. export declare class Index {
  31. static readonly [entityKind]: string;
  32. _: {
  33. brand: 'SQLiteIndex';
  34. };
  35. readonly config: IndexConfig & {
  36. table: SQLiteTable;
  37. };
  38. constructor(config: IndexConfig, table: SQLiteTable);
  39. }
  40. export declare function index(name: string): IndexBuilderOn;
  41. export declare function uniqueIndex(name: string): IndexBuilderOn;