indexes.cjs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. "use strict";
  2. var __defProp = Object.defineProperty;
  3. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4. var __getOwnPropNames = Object.getOwnPropertyNames;
  5. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6. var __export = (target, all) => {
  7. for (var name in all)
  8. __defProp(target, name, { get: all[name], enumerable: true });
  9. };
  10. var __copyProps = (to, from, except, desc) => {
  11. if (from && typeof from === "object" || typeof from === "function") {
  12. for (let key of __getOwnPropNames(from))
  13. if (!__hasOwnProp.call(to, key) && key !== except)
  14. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  15. }
  16. return to;
  17. };
  18. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  19. var indexes_exports = {};
  20. __export(indexes_exports, {
  21. Index: () => Index,
  22. IndexBuilder: () => IndexBuilder,
  23. IndexBuilderOn: () => IndexBuilderOn,
  24. index: () => index,
  25. uniqueIndex: () => uniqueIndex
  26. });
  27. module.exports = __toCommonJS(indexes_exports);
  28. var import_entity = require("../entity.cjs");
  29. class IndexBuilderOn {
  30. constructor(name, unique) {
  31. this.name = name;
  32. this.unique = unique;
  33. }
  34. static [import_entity.entityKind] = "SingleStoreIndexBuilderOn";
  35. on(...columns) {
  36. return new IndexBuilder(this.name, columns, this.unique);
  37. }
  38. }
  39. class IndexBuilder {
  40. static [import_entity.entityKind] = "SingleStoreIndexBuilder";
  41. /** @internal */
  42. config;
  43. constructor(name, columns, unique) {
  44. this.config = {
  45. name,
  46. columns,
  47. unique
  48. };
  49. }
  50. using(using) {
  51. this.config.using = using;
  52. return this;
  53. }
  54. algorithm(algorithm) {
  55. this.config.algorithm = algorithm;
  56. return this;
  57. }
  58. lock(lock) {
  59. this.config.lock = lock;
  60. return this;
  61. }
  62. /** @internal */
  63. build(table) {
  64. return new Index(this.config, table);
  65. }
  66. }
  67. class Index {
  68. static [import_entity.entityKind] = "SingleStoreIndex";
  69. config;
  70. constructor(config, table) {
  71. this.config = { ...config, table };
  72. }
  73. }
  74. function index(name) {
  75. return new IndexBuilderOn(name, false);
  76. }
  77. function uniqueIndex(name) {
  78. return new IndexBuilderOn(name, true);
  79. }
  80. // Annotate the CommonJS export names for ESM import in node:
  81. 0 && (module.exports = {
  82. Index,
  83. IndexBuilder,
  84. IndexBuilderOn,
  85. index,
  86. uniqueIndex
  87. });
  88. //# sourceMappingURL=indexes.cjs.map