QueryBuilderContextBase.js 604 B

12345678910111213141516171819202122232425
  1. const InternalOptions = require('./InternalOptions');
  2. class QueryBuilderContextBase {
  3. constructor(builder) {
  4. this.userContext = builder ? new builder.constructor.QueryBuilderUserContext(builder) : null;
  5. this.options = builder ? new this.constructor.InternalOptions() : null;
  6. this.knex = null;
  7. }
  8. static get InternalOptions() {
  9. return InternalOptions;
  10. }
  11. clone() {
  12. const ctx = new this.constructor();
  13. ctx.userContext = this.userContext;
  14. ctx.options = this.options.clone();
  15. ctx.knex = this.knex;
  16. return ctx;
  17. }
  18. }
  19. module.exports = QueryBuilderContextBase;