schema.cjs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 schema_exports = {};
  20. __export(schema_exports, {
  21. MySqlSchema: () => MySqlSchema,
  22. isMySqlSchema: () => isMySqlSchema,
  23. mysqlDatabase: () => mysqlDatabase,
  24. mysqlSchema: () => mysqlSchema
  25. });
  26. module.exports = __toCommonJS(schema_exports);
  27. var import_entity = require("../entity.cjs");
  28. var import_table = require("./table.cjs");
  29. var import_view = require("./view.cjs");
  30. class MySqlSchema {
  31. constructor(schemaName) {
  32. this.schemaName = schemaName;
  33. }
  34. static [import_entity.entityKind] = "MySqlSchema";
  35. table = (name, columns, extraConfig) => {
  36. return (0, import_table.mysqlTableWithSchema)(name, columns, extraConfig, this.schemaName);
  37. };
  38. view = (name, columns) => {
  39. return (0, import_view.mysqlViewWithSchema)(name, columns, this.schemaName);
  40. };
  41. }
  42. function isMySqlSchema(obj) {
  43. return (0, import_entity.is)(obj, MySqlSchema);
  44. }
  45. function mysqlDatabase(name) {
  46. return new MySqlSchema(name);
  47. }
  48. const mysqlSchema = mysqlDatabase;
  49. // Annotate the CommonJS export names for ESM import in node:
  50. 0 && (module.exports = {
  51. MySqlSchema,
  52. isMySqlSchema,
  53. mysqlDatabase,
  54. mysqlSchema
  55. });
  56. //# sourceMappingURL=schema.cjs.map