CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
indexes.js56 linesDownload Raw Back to sqlite-core
1import { entityKind } from "../entity.js";2class IndexBuilderOn {3  constructor(name, unique) {4    this.name = name;5    this.unique = unique;6  }7  static [entityKind] = "SQLiteIndexBuilderOn";8  on(...columns) {9    return new IndexBuilder(this.name, columns, this.unique);10  }11}12class IndexBuilder {13  static [entityKind] = "SQLiteIndexBuilder";14  /** @internal */15  config;16  constructor(name, columns, unique) {17    this.config = {18      name,19      columns,20      unique,21      where: void 022    };23  }24  /**25   * Condition for partial index.26   */27  where(condition) {28    this.config.where = condition;29    return this;30  }31  /** @internal */32  build(table) {33    return new Index(this.config, table);34  }35}36class Index {37  static [entityKind] = "SQLiteIndex";38  config;39  constructor(config, table) {40    this.config = { ...config, table };41  }42}43function index(name) {44  return new IndexBuilderOn(name, false);45}46function uniqueIndex(name) {47  return new IndexBuilderOn(name, true);48}49export {50  Index,51  IndexBuilder,52  IndexBuilderOn,53  index,54  uniqueIndex55};56//# sourceMappingURL=indexes.js.map