refresh-materialized-view.cjs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 refresh_materialized_view_exports = {};
  20. __export(refresh_materialized_view_exports, {
  21. GelRefreshMaterializedView: () => GelRefreshMaterializedView
  22. });
  23. module.exports = __toCommonJS(refresh_materialized_view_exports);
  24. var import_entity = require("../../entity.cjs");
  25. var import_query_promise = require("../../query-promise.cjs");
  26. var import_tracing = require("../../tracing.cjs");
  27. class GelRefreshMaterializedView extends import_query_promise.QueryPromise {
  28. constructor(view, session, dialect) {
  29. super();
  30. this.session = session;
  31. this.dialect = dialect;
  32. this.config = { view };
  33. }
  34. static [import_entity.entityKind] = "GelRefreshMaterializedView";
  35. config;
  36. concurrently() {
  37. if (this.config.withNoData !== void 0) {
  38. throw new Error("Cannot use concurrently and withNoData together");
  39. }
  40. this.config.concurrently = true;
  41. return this;
  42. }
  43. withNoData() {
  44. if (this.config.concurrently !== void 0) {
  45. throw new Error("Cannot use concurrently and withNoData together");
  46. }
  47. this.config.withNoData = true;
  48. return this;
  49. }
  50. /** @internal */
  51. getSQL() {
  52. return this.dialect.buildRefreshMaterializedViewQuery(this.config);
  53. }
  54. toSQL() {
  55. const { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());
  56. return rest;
  57. }
  58. /** @internal */
  59. _prepare(name) {
  60. return import_tracing.tracer.startActiveSpan("drizzle.prepareQuery", () => {
  61. return this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()), void 0, name, true);
  62. });
  63. }
  64. prepare(name) {
  65. return this._prepare(name);
  66. }
  67. execute = (placeholderValues) => {
  68. return import_tracing.tracer.startActiveSpan("drizzle.operation", () => {
  69. return this._prepare().execute(placeholderValues);
  70. });
  71. };
  72. }
  73. // Annotate the CommonJS export names for ESM import in node:
  74. 0 && (module.exports = {
  75. GelRefreshMaterializedView
  76. });
  77. //# sourceMappingURL=refresh-materialized-view.cjs.map