index.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. "use strict";
  2. const _ = require("lodash");
  3. const AbstractDialect = require("../abstract");
  4. const ConnectionManager = require("./connection-manager");
  5. const Query = require("./query");
  6. const QueryGenerator = require("./query-generator");
  7. const DataTypes = require("../../data-types").postgres;
  8. const { PostgresQueryInterface } = require("./query-interface");
  9. class PostgresDialect extends AbstractDialect {
  10. constructor(sequelize) {
  11. super();
  12. this.sequelize = sequelize;
  13. this.connectionManager = new ConnectionManager(this, sequelize);
  14. this.queryGenerator = new QueryGenerator({
  15. _dialect: this,
  16. sequelize
  17. });
  18. this.queryInterface = new PostgresQueryInterface(sequelize, this.queryGenerator);
  19. }
  20. canBackslashEscape() {
  21. return !this.sequelize.options.standardConformingStrings;
  22. }
  23. }
  24. PostgresDialect.prototype.supports = _.merge(_.cloneDeep(AbstractDialect.prototype.supports), {
  25. "DEFAULT VALUES": true,
  26. EXCEPTION: true,
  27. "ON DUPLICATE KEY": false,
  28. "ORDER NULLS": true,
  29. returnValues: {
  30. returning: true
  31. },
  32. bulkDefault: true,
  33. schemas: true,
  34. lock: true,
  35. lockOf: true,
  36. lockKey: true,
  37. lockOuterJoinFailure: true,
  38. skipLocked: true,
  39. forShare: "FOR SHARE",
  40. index: {
  41. concurrently: true,
  42. using: 2,
  43. where: true,
  44. functionBased: true,
  45. operator: true
  46. },
  47. inserts: {
  48. onConflictDoNothing: " ON CONFLICT DO NOTHING",
  49. updateOnDuplicate: " ON CONFLICT DO UPDATE SET",
  50. conflictFields: true,
  51. onConflictWhere: true
  52. },
  53. NUMERIC: true,
  54. ARRAY: true,
  55. RANGE: true,
  56. GEOMETRY: true,
  57. REGEXP: true,
  58. GEOGRAPHY: true,
  59. JSON: true,
  60. JSONB: true,
  61. HSTORE: true,
  62. TSVECTOR: true,
  63. deferrableConstraints: true,
  64. searchPath: true,
  65. escapeStringConstants: true
  66. });
  67. PostgresDialect.prototype.defaultVersion = "9.5.0";
  68. PostgresDialect.prototype.Query = Query;
  69. PostgresDialect.prototype.DataTypes = DataTypes;
  70. PostgresDialect.prototype.name = "postgres";
  71. PostgresDialect.prototype.TICK_CHAR = '"';
  72. PostgresDialect.prototype.TICK_CHAR_LEFT = PostgresDialect.prototype.TICK_CHAR;
  73. PostgresDialect.prototype.TICK_CHAR_RIGHT = PostgresDialect.prototype.TICK_CHAR;
  74. module.exports = PostgresDialect;
  75. module.exports.default = PostgresDialect;
  76. module.exports.PostgresDialect = PostgresDialect;
  77. //# sourceMappingURL=index.js.map