Full Code of Vincit/objection.js for AI

main a7784ded683c cached
410 files
2.8 MB
765.7k tokens
2826 symbols
1 requests
Download .txt
Showing preview only (3,054K chars total). Download the full file or copy to clipboard to get everything.
Repository: Vincit/objection.js
Branch: main
Commit: a7784ded683c
Files: 410
Total size: 2.8 MB

Directory structure:
gitextract_1w8nr7ov/

├── .eslintrc.json
├── .github/
│   ├── ISSUE_TEMPLATE.md
│   ├── dependabot.yml
│   └── workflows/
│       └── test.yml
├── .gitignore
├── .prettierrc.json
├── LICENSE
├── README.md
├── doc/
│   ├── .prettierrc.json
│   ├── .vuepress/
│   │   ├── config.js
│   │   ├── styles/
│   │   │   ├── index.styl
│   │   │   └── palette.styl
│   │   └── theme/
│   │       ├── components/
│   │       │   └── AlgoliaSearchBox.vue
│   │       └── index.js
│   ├── README.md
│   ├── api/
│   │   ├── README.md
│   │   ├── model/
│   │   │   ├── instance-methods.md
│   │   │   ├── instance-properties.md
│   │   │   ├── overview.md
│   │   │   ├── static-methods.md
│   │   │   └── static-properties.md
│   │   ├── objection/
│   │   │   └── README.md
│   │   ├── query-builder/
│   │   │   ├── README.md
│   │   │   ├── eager-methods.md
│   │   │   ├── find-methods.md
│   │   │   ├── join-methods.md
│   │   │   ├── mutate-methods.md
│   │   │   ├── other-methods.md
│   │   │   └── static-methods.md
│   │   └── types/
│   │       └── README.md
│   ├── guide/
│   │   ├── contributing.md
│   │   ├── documents.md
│   │   ├── getting-started.md
│   │   ├── hooks.md
│   │   ├── installation.md
│   │   ├── models.md
│   │   ├── plugins.md
│   │   ├── query-examples.md
│   │   ├── relations.md
│   │   ├── transactions.md
│   │   └── validation.md
│   ├── recipes/
│   │   ├── composite-keys.md
│   │   ├── custom-id-column.md
│   │   ├── custom-query-builder.md
│   │   ├── custom-validation.md
│   │   ├── default-values.md
│   │   ├── error-handling.md
│   │   ├── extra-properties.md
│   │   ├── indexing-postgresql-jsonb-columns.md
│   │   ├── joins.md
│   │   ├── json-queries.md
│   │   ├── modifiers.md
│   │   ├── multitenancy-using-multiple-databases.md
│   │   ├── paging.md
│   │   ├── plugins.md
│   │   ├── polymorphic-associations.md
│   │   ├── precedence-and-parentheses.md
│   │   ├── raw-queries.md
│   │   ├── relation-subqueries.md
│   │   ├── returning-tricks.md
│   │   ├── snake-case-to-camel-case-conversion.md
│   │   ├── subqueries.md
│   │   ├── ternary-relationships.md
│   │   └── timestamps.md
│   └── release-notes/
│       ├── changelog.md
│       └── migration.md
├── docker-compose.yml
├── examples/
│   ├── koa/
│   │   ├── .prettierrc.json
│   │   ├── README.md
│   │   ├── api.js
│   │   ├── app.js
│   │   ├── client.js
│   │   ├── knexfile.js
│   │   ├── migrations/
│   │   │   └── 20150613161239_initial_schema.js
│   │   ├── models/
│   │   │   ├── Animal.js
│   │   │   ├── Movie.js
│   │   │   └── Person.js
│   │   └── package.json
│   ├── koa-ts/
│   │   ├── .prettierrc.json
│   │   ├── README.md
│   │   ├── api.ts
│   │   ├── app.ts
│   │   ├── client.js
│   │   ├── knexfile.js
│   │   ├── migrations/
│   │   │   └── 20150613161239_initial_schema.js
│   │   ├── models/
│   │   │   ├── Animal.ts
│   │   │   ├── Movie.ts
│   │   │   └── Person.ts
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── minimal/
│   │   ├── README.md
│   │   ├── app.js
│   │   ├── knexfile.js
│   │   ├── migrations/
│   │   │   └── 20190330121219_initial_schema.js
│   │   ├── models/
│   │   │   └── Person.js
│   │   └── package.json
│   ├── plugin/
│   │   ├── README.md
│   │   ├── index.js
│   │   ├── package.json
│   │   └── tests.js
│   └── plugin-with-options/
│       ├── README.md
│       ├── index.js
│       ├── package.json
│       └── tests.js
├── lib/
│   ├── .eslintrc.json
│   ├── initialize.js
│   ├── model/
│   │   ├── AjvValidator.js
│   │   ├── Model.js
│   │   ├── ModifierNotFoundError.js
│   │   ├── NotFoundError.js
│   │   ├── RelationDoesNotExistError.js
│   │   ├── ValidationError.js
│   │   ├── Validator.js
│   │   ├── getModel.js
│   │   ├── graph/
│   │   │   ├── ModelGraph.js
│   │   │   ├── ModelGraphBuilder.js
│   │   │   ├── ModelGraphEdge.js
│   │   │   └── ModelGraphNode.js
│   │   ├── inheritModel.js
│   │   ├── modelBindKnex.js
│   │   ├── modelClone.js
│   │   ├── modelColPropMap.js
│   │   ├── modelId.js
│   │   ├── modelJsonAttributes.js
│   │   ├── modelParseRelations.js
│   │   ├── modelQueryProps.js
│   │   ├── modelSet.js
│   │   ├── modelTableMetadata.js
│   │   ├── modelToJson.js
│   │   ├── modelUtils.js
│   │   ├── modelValidate.js
│   │   ├── modelValues.js
│   │   └── modelVisitor.js
│   ├── objection.js
│   ├── queryBuilder/
│   │   ├── FunctionBuilder.js
│   │   ├── InternalOptions.js
│   │   ├── JoinBuilder.js
│   │   ├── QueryBuilder.js
│   │   ├── QueryBuilderBase.js
│   │   ├── QueryBuilderContext.js
│   │   ├── QueryBuilderContextBase.js
│   │   ├── QueryBuilderOperationSupport.js
│   │   ├── QueryBuilderUserContext.js
│   │   ├── RawBuilder.js
│   │   ├── ReferenceBuilder.js
│   │   ├── RelationExpression.js
│   │   ├── StaticHookArguments.js
│   │   ├── ValueBuilder.js
│   │   ├── graph/
│   │   │   ├── GraphAction.js
│   │   │   ├── GraphData.js
│   │   │   ├── GraphFetcher.js
│   │   │   ├── GraphNodeDbExistence.js
│   │   │   ├── GraphOperation.js
│   │   │   ├── GraphOptions.js
│   │   │   ├── GraphUpsert.js
│   │   │   ├── delete/
│   │   │   │   ├── GraphDelete.js
│   │   │   │   └── GraphDeleteAction.js
│   │   │   ├── insert/
│   │   │   │   ├── GraphInsert.js
│   │   │   │   ├── GraphInsertAction.js
│   │   │   │   └── JoinRowGraphInsertAction.js
│   │   │   ├── patch/
│   │   │   │   ├── GraphPatch.js
│   │   │   │   └── GraphPatchAction.js
│   │   │   └── recursiveUpsert/
│   │   │       ├── GraphRecursiveUpsert.js
│   │   │       └── GraphRecursiveUpsertAction.js
│   │   ├── join/
│   │   │   ├── JoinResultColumn.js
│   │   │   ├── JoinResultParser.js
│   │   │   ├── RelationJoiner.js
│   │   │   ├── TableNode.js
│   │   │   ├── TableTree.js
│   │   │   └── utils.js
│   │   ├── operations/
│   │   │   ├── DelegateOperation.js
│   │   │   ├── DeleteOperation.js
│   │   │   ├── FindByIdOperation.js
│   │   │   ├── FindByIdsOperation.js
│   │   │   ├── FindOperation.js
│   │   │   ├── FirstOperation.js
│   │   │   ├── FromOperation.js
│   │   │   ├── InsertAndFetchOperation.js
│   │   │   ├── InsertGraphAndFetchOperation.js
│   │   │   ├── InsertGraphOperation.js
│   │   │   ├── InsertOperation.js
│   │   │   ├── InstanceDeleteOperation.js
│   │   │   ├── InstanceFindOperation.js
│   │   │   ├── InstanceInsertOperation.js
│   │   │   ├── InstanceUpdateOperation.js
│   │   │   ├── JoinRelatedOperation.js
│   │   │   ├── KnexOperation.js
│   │   │   ├── MergeOperation.js
│   │   │   ├── ObjectionToKnexConvertingOperation.js
│   │   │   ├── OnBuildKnexOperation.js
│   │   │   ├── OnBuildOperation.js
│   │   │   ├── OnErrorOperation.js
│   │   │   ├── QueryBuilderOperation.js
│   │   │   ├── RangeOperation.js
│   │   │   ├── RelateOperation.js
│   │   │   ├── ReturningOperation.js
│   │   │   ├── RunAfterOperation.js
│   │   │   ├── RunBeforeOperation.js
│   │   │   ├── UnrelateOperation.js
│   │   │   ├── UpdateAndFetchOperation.js
│   │   │   ├── UpdateOperation.js
│   │   │   ├── UpsertGraphAndFetchOperation.js
│   │   │   ├── UpsertGraphOperation.js
│   │   │   ├── WhereCompositeOperation.js
│   │   │   ├── eager/
│   │   │   │   ├── EagerOperation.js
│   │   │   │   ├── JoinEagerOperation.js
│   │   │   │   ├── NaiveEagerOperation.js
│   │   │   │   └── WhereInEagerOperation.js
│   │   │   ├── jsonApi/
│   │   │   │   ├── WhereJsonHasPostgresOperation.js
│   │   │   │   ├── WhereJsonNotObjectPostgresOperation.js
│   │   │   │   ├── WhereJsonPostgresOperation.js
│   │   │   │   └── postgresJsonApi.js
│   │   │   ├── select/
│   │   │   │   ├── SelectOperation.js
│   │   │   │   └── Selection.js
│   │   │   └── whereInComposite/
│   │   │       ├── WhereInCompositeMsSqlOperation.js
│   │   │       ├── WhereInCompositeOperation.js
│   │   │       └── WhereInCompositeSqliteOperation.js
│   │   ├── parsers/
│   │   │   ├── jsonFieldExpressionParser.js
│   │   │   ├── jsonFieldExpressionParser.pegjs
│   │   │   ├── relationExpressionParser.js
│   │   │   └── relationExpressionParser.pegjs
│   │   └── transformations/
│   │       ├── CompositeQueryTransformation.js
│   │       ├── QueryTransformation.js
│   │       ├── WrapMysqlModifySubqueryTransformation.js
│   │       └── index.js
│   ├── relations/
│   │   ├── Relation.js
│   │   ├── RelationDeleteOperation.js
│   │   ├── RelationFindOperation.js
│   │   ├── RelationInsertOperation.js
│   │   ├── RelationOwner.js
│   │   ├── RelationProperty.js
│   │   ├── RelationUpdateOperation.js
│   │   ├── belongsToOne/
│   │   │   ├── BelongsToOneDeleteOperation.js
│   │   │   ├── BelongsToOneInsertOperation.js
│   │   │   ├── BelongsToOneRelateOperation.js
│   │   │   ├── BelongsToOneRelation.js
│   │   │   └── BelongsToOneUnrelateOperation.js
│   │   ├── hasMany/
│   │   │   ├── HasManyInsertOperation.js
│   │   │   ├── HasManyRelateOperation.js
│   │   │   ├── HasManyRelation.js
│   │   │   └── HasManyUnrelateOperation.js
│   │   ├── hasOne/
│   │   │   └── HasOneRelation.js
│   │   ├── hasOneThrough/
│   │   │   └── HasOneThroughRelation.js
│   │   └── manyToMany/
│   │       ├── ManyToManyModifyMixin.js
│   │       ├── ManyToManyRelation.js
│   │       ├── ManyToManySqliteModifyMixin.js
│   │       ├── delete/
│   │       │   ├── ManyToManyDeleteOperation.js
│   │       │   ├── ManyToManyDeleteOperationBase.js
│   │       │   └── ManyToManyDeleteSqliteOperation.js
│   │       ├── find/
│   │       │   └── ManyToManyFindOperation.js
│   │       ├── insert/
│   │       │   └── ManyToManyInsertOperation.js
│   │       ├── relate/
│   │       │   └── ManyToManyRelateOperation.js
│   │       ├── unrelate/
│   │       │   ├── ManyToManyUnrelateOperation.js
│   │       │   ├── ManyToManyUnrelateOperationBase.js
│   │       │   └── ManyToManyUnrelateSqliteOperation.js
│   │       └── update/
│   │           ├── ManyToManyUpdateOperation.js
│   │           ├── ManyToManyUpdateOperationBase.js
│   │           └── ManyToManyUpdateSqliteOperation.js
│   ├── transaction.js
│   └── utils/
│       ├── assert.js
│       ├── buildUtils.js
│       ├── classUtils.js
│       ├── clone.js
│       ├── createModifier.js
│       ├── deprecate.js
│       ├── identifierMapping.js
│       ├── internalPropUtils.js
│       ├── knexUtils.js
│       ├── mixin.js
│       ├── normalizeIds.js
│       ├── objectUtils.js
│       ├── parseFieldExpression.js
│       ├── promiseUtils/
│       │   ├── after.js
│       │   ├── afterReturn.js
│       │   ├── index.js
│       │   ├── isPromise.js
│       │   ├── map.js
│       │   ├── mapAfterAllReturn.js
│       │   └── try.js
│       ├── resolveModel.js
│       └── tmpColumnUtils.js
├── package.json
├── publish-docs.sh
├── reproduction-template.js
├── setup-test-db.js
├── testUtils/
│   ├── TestSession.js
│   ├── mockKnex.js
│   └── testUtils.js
├── tests/
│   ├── integration/
│   │   ├── compositeKeys.js
│   │   ├── crossDb/
│   │   │   ├── index.js
│   │   │   └── mysql.js
│   │   ├── delete.js
│   │   ├── find.js
│   │   ├── graph/
│   │   │   └── GraphInsert.js
│   │   ├── index.js
│   │   ├── insert.js
│   │   ├── insertGraph.js
│   │   ├── jsonQueries.js
│   │   ├── jsonRelations.js
│   │   ├── knexIdentifierMapping.js
│   │   ├── knexSnakeCase.js
│   │   ├── misc/
│   │   │   ├── #1074.js
│   │   │   ├── #1202.js
│   │   │   ├── #1215.js
│   │   │   ├── #1223.js
│   │   │   ├── #1227.js
│   │   │   ├── #1265.js
│   │   │   ├── #1455.js
│   │   │   ├── #1467.js
│   │   │   ├── #1489.js
│   │   │   ├── #1627.js
│   │   │   ├── #1718.js
│   │   │   ├── #1757.js
│   │   │   ├── #2105.js
│   │   │   ├── #292.js
│   │   │   ├── #325.js
│   │   │   ├── #403.js
│   │   │   ├── #517.js
│   │   │   ├── #712.js
│   │   │   ├── #733.js
│   │   │   ├── #760.js
│   │   │   ├── #844.js
│   │   │   ├── #909.js
│   │   │   ├── aggregateMethodsWithRelations.js
│   │   │   ├── concurrency.js
│   │   │   ├── defaultModelFieldValues.js
│   │   │   ├── generatedId.js
│   │   │   ├── hasOneTree.js
│   │   │   ├── index.js
│   │   │   ├── modelWithLengthProperty.js
│   │   │   ├── multipleResultsWithOneToOneRelation.js
│   │   │   ├── mysqlBinaryColumns.js
│   │   │   ├── nonMutatingRelatedQuery.js
│   │   │   ├── refAttack.js
│   │   │   ├── relatedQueryErrors.js
│   │   │   ├── relationHooks.js
│   │   │   ├── tableMetadata.js
│   │   │   ├── unhandledRejectionErrors.js
│   │   │   ├── usingUnboundModelsByPassingKnex.js
│   │   │   └── zeroValueInRelationColumn.js
│   │   ├── modifiers.js
│   │   ├── nonPrimaryKeyRelations.js
│   │   ├── patch.js
│   │   ├── queryContext.js
│   │   ├── relate.js
│   │   ├── relationModify.js
│   │   ├── schema.js
│   │   ├── snakeCase.js
│   │   ├── staticHooks.js
│   │   ├── toKnexQuery.js
│   │   ├── transactions.js
│   │   ├── unrelate.js
│   │   ├── update.js
│   │   ├── upsertGraph.js
│   │   ├── viewsAndAliases.js
│   │   └── withGraph.js
│   ├── main.js
│   ├── ts/
│   │   ├── custom-query-builder.ts
│   │   ├── documents.ts
│   │   ├── examples.ts
│   │   ├── fixtures/
│   │   │   ├── animal.ts
│   │   │   ├── movie.ts
│   │   │   ├── person.ts
│   │   │   └── review.ts
│   │   ├── model/
│   │   │   └── instance-methods.ts
│   │   ├── model-class.ts
│   │   ├── query-builder-api/
│   │   │   ├── eager-loading-methods.ts
│   │   │   ├── find-methods.ts
│   │   │   ├── join-methods.ts
│   │   │   ├── mutating-methods.ts
│   │   │   └── other-methods.ts
│   │   ├── query-examples/
│   │   │   ├── basic-queries/
│   │   │   │   ├── delete.ts
│   │   │   │   ├── find.ts
│   │   │   │   ├── insert.ts
│   │   │   │   └── update.ts
│   │   │   ├── eager-loading.ts
│   │   │   ├── graph-inserts.ts
│   │   │   ├── graph-upserts.ts
│   │   │   └── relation-queries/
│   │   │       ├── delete.ts
│   │   │       ├── find.ts
│   │   │       ├── insert.ts
│   │   │       ├── relate.ts
│   │   │       ├── unrelate.ts
│   │   │       └── update.ts
│   │   ├── transactions/
│   │   │   ├── creating.ts
│   │   │   └── using.ts
│   │   └── validation.ts
│   └── unit/
│       ├── model/
│       │   ├── AjvValidator.js
│       │   └── Model.js
│       ├── queryBuilder/
│       │   ├── JoinBuilder.js
│       │   ├── QueryBuilder.js
│       │   ├── ReferenceBuilder.js
│       │   ├── RelationExpression.js
│       │   ├── ValueBuilder.js
│       │   └── jsonFieldExpressionParser.js
│       ├── relations/
│       │   ├── BelongsToOneRelation.js
│       │   ├── HasManyRelation.js
│       │   ├── ManyToManyRelation.js
│       │   ├── Relation.js
│       │   └── files/
│       │       ├── InvalidModel.js
│       │       ├── InvalidModelManyNamedModels.js
│       │       ├── JoinModel.js
│       │       ├── ModelWithARandomError.js
│       │       ├── OwnerModel.js
│       │       ├── RelatedModel.js
│       │       └── RelatedModelNamedExport.js
│       ├── utils/
│       │   └── resolveModel.js
│       └── utils.js
├── tsconfig.json
└── typings/
    └── objection/
        └── index.d.ts

================================================
FILE CONTENTS
================================================

================================================
FILE: .eslintrc.json
================================================
{
  "parserOptions": {
    "ecmaVersion": "latest"
  },
  "plugins": [
    "prettier"
  ],
  "rules": {
    "prettier/prettier": "error",
    "no-undef": "error"
  },
  "env": {
    "es6": true,
    "node": true,
    "mocha": true
  }
}


================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
Please read the instructions linked below before opening an issue.

https://vincit.github.io/objection.js/guide/contributing.html#issues


================================================
FILE: .github/dependabot.yml
================================================

version: 2
updates:
  - package-ecosystem: 'npm'
    directory: '/'
    schedule:
      interval: 'daily'


================================================
FILE: .github/workflows/test.yml
================================================
name: tests

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  run-tests:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x, 16.x, 18.x, 20.x, 22.x, 24.x]

    steps:
      - uses: actions/checkout@v2

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install dependencies
        run: npm ci

      - name: Run docker compose
        run: docker compose up -d

      - name: Setup test db
        run: node setup-test-db.js

      - name: Run tests
        run: npm test


================================================
FILE: .gitignore
================================================
node_modules
.history
.idea
scratchpad.js
testCoverage
examples/*/*.db
examples/*/dist
examples/**/package-lock.json
*.iml
*.DS_Store
profiling
npm-debug.log*
.vscode
/**/yarn.lock
/**/.vuepress/dist

================================================
FILE: .prettierrc.json
================================================
{
  "printWidth": 100,
  "singleQuote": true,
  "bracketSpacing": true,
  "semi": true
}

================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2015 Sami Koskimäki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



================================================
FILE: README.md
================================================
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua)

[![Tests](https://github.com/Vincit/objection.js/actions/workflows/test.yml/badge.svg)](https://github.com/Vincit/objection.js)
[![Join the chat at https://gitter.im/Vincit/objection.js](https://badges.gitter.im/Vincit/objection.js.svg)](https://gitter.im/Vincit/objection.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

# [Objection.js](https://vincit.github.io/objection.js)

Objection.js is an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) for [Node.js](https://nodejs.org/) that aims to stay out of your way and make it as easy as possible to use the full power of SQL and the underlying database engine while still making the common stuff easy and enjoyable.

Even though ORM is the best commonly known acronym to describe objection, a more accurate description is to call it **a relational query builder**. You get all the benefits of an SQL query builder but also a powerful set of tools for working with relations.

Objection.js is built on an SQL query builder called [knex](http://knexjs.org). All databases supported by knex are supported by objection.js. **SQLite3**, **Postgres** and **MySQL** are [thoroughly tested](https://github.com/Vincit/objection.js/actions).

What objection.js gives you:

- **An easy declarative way of [defining models](https://vincit.github.io/objection.js/guide/models.html) and relationships between them**
- **Simple and fun way to [fetch, insert, update and delete](https://vincit.github.io/objection.js/guide/query-examples.html) objects using the full power of SQL**
- **Powerful mechanisms for [eager loading](https://vincit.github.io/objection.js/guide/query-examples.html#eager-loading), [inserting](https://vincit.github.io/objection.js/guide/query-examples.html#graph-inserts) and [upserting](https://vincit.github.io/objection.js/guide/query-examples.html#graph-upserts) object graphs**
- **Easy to use [transactions](https://vincit.github.io/objection.js/guide/transactions.html)**
- **Official [TypeScript](https://github.com/Vincit/objection.js/blob/main/typings/objection/index.d.ts) support**
- **Optional [JSON schema](https://vincit.github.io/objection.js/guide/validation.html) validation**
- **A way to [store complex documents](https://vincit.github.io/objection.js/guide/documents.html) as single rows**

What objection.js **doesn't** give you:

- **A fully object oriented view of your database**
  With objection you don't work with entities. You work with queries. Objection doesn't try to wrap every concept with an 
  object oriented equivalent. The best attempt to do that (IMO) is Hibernate, which is excellent, but it has 800k lines
  of code and a lot more concepts to learn than SQL itself. The point is, writing a good traditional ORM is borderline
  impossible. Objection attempts to provide a completely different way of working with SQL.
- **A custom query DSL. SQL is used as a query language.**
  This doesn't mean you have to write SQL strings though. A query builder based on [knex](http://knexjs.org) is
  used to build the SQL. However, if the query builder fails you for some reason, raw SQL strings can be easily
  written using the [raw](https://vincit.github.io/objection.js/api/objection/#raw) helper function.
- **Automatic database schema creation and migration from model definitions.**
  For simple things it is useful that the database schema is automatically generated from the model definitions,
  but usually just gets in your way when doing anything non-trivial. Objection.js leaves the schema related things
  to you. knex has a great [migration tool](https://knexjs.org/guide/migrations.html) that we recommend for this job. Check
  out the [example project](https://github.com/Vincit/objection.js/tree/main/examples/koa-ts).

The best way to get started is to clone our [example project](https://github.com/Vincit/objection.js/tree/main/examples/koa) and start playing with it. There's also a [typescript version](https://github.com/Vincit/objection.js/tree/main/examples/koa-ts) available.

Check out [this issue](https://github.com/Vincit/objection.js/issues/1069) to see who is using objection and what they think about it.

Shortcuts:

- [Who uses objection.js](https://github.com/Vincit/objection.js/discussions/2464)
- [API reference](https://vincit.github.io/objection.js/api/query-builder/)
- [Example projects](https://github.com/Vincit/objection.js/tree/main/examples)
- [Changelog](https://vincit.github.io/objection.js/release-notes/changelog.html)
- [v1 -> v2 -> v3 migration guide](https://vincit.github.io/objection.js/release-notes/migration.html)
- [Contribution guide](https://vincit.github.io/objection.js/guide/contributing.html)
- [Plugins](https://vincit.github.io/objection.js/guide/plugins.html)


================================================
FILE: doc/.prettierrc.json
================================================
{
  "printWidth": 80,
  "singleQuote": true,
  "bracketSpacing": true,
  "semi": true
}


================================================
FILE: doc/.vuepress/config.js
================================================
module.exports = {
  title: 'Objection.js',
  description: 'An SQL friendly ORM for node.js',
  base: '/objection.js/',

  themeConfig: {
    repo: 'vincit/objection.js',
    repoLabel: 'GitHub',

    algolia: {
      apiKey: '8b9b4ac9f68d11c702e8102479760861',
      indexName: 'vincit_objectionjs',
    },

    nav: [
      {
        text: 'Guide',
        link: '/guide/',
      },

      {
        text: 'API Reference',
        items: [
          {
            text: 'Main Module',
            link: '/api/objection/',
          },
          {
            text: 'Query Builder',
            link: '/api/query-builder/',
          },
          {
            text: 'Model',
            link: '/api/model/',
          },
          {
            text: 'Types',
            link: '/api/types/',
          },
        ],
      },

      {
        text: 'Recipe Book',
        link: '/recipes/',
      },

      {
        text: 'Release Notes',
        items: [
          {
            text: 'Changelog',
            link: '/release-notes/changelog.md',
          },
          {
            text: 'Migration to 3.0',
            link: '/release-notes/migration.md',
          },
          {
            text: 'v2.x documentation',
            link: 'https://github.com/Vincit/objection.js/tree/v2/doc',
          },
          {
            text: 'v1.x documentation',
            link: 'https://github.com/Vincit/objection.js/tree/v1/doc',
          },
        ],
      },

      {
        text: '⭐ Star',
        link: 'https://github.com/vincit/objection.js',
      },
    ],

    sidebar: {
      '/guide/': [
        {
          title: 'Guide',
          collapsable: false,
          children: [
            'installation',
            'getting-started',
            'models',
            'relations',
            'query-examples',
            'transactions',
            'hooks',
            'validation',
            'documents',
            'plugins',
            'contributing',
          ],
        },
      ],

      '/api/model/': [
        {
          title: 'Model API Reference',
          collapsable: false,
          children: [
            'overview',
            'static-properties',
            'static-methods',
            'instance-methods',
            'instance-properties',
          ],
        },
      ],

      '/api/objection/': [
        {
          title: 'Objection API Reference',
          collapsable: false,
        },
      ],

      '/api/query-builder/': [
        {
          title: 'Query Builder API Reference',
          collapsable: false,
          children: [
            'find-methods',
            'mutate-methods',
            'eager-methods',
            'join-methods',
            'other-methods',
            'static-methods',
          ],
        },
      ],

      '/recipes/': [
        {
          title: 'Recipes',
          collapsable: false,
          children: [
            'raw-queries',
            'precedence-and-parentheses',
            'subqueries',
            'relation-subqueries',
            'joins',
            'modifiers',
            'composite-keys',
            'polymorphic-associations',
            'json-queries',
            'custom-id-column',
            'extra-properties',
            'custom-validation',
            'snake-case-to-camel-case-conversion',
            'paging',
            'returning-tricks',
            'timestamps',
            'custom-query-builder',
            'multitenancy-using-multiple-databases',
            'default-values',
            'error-handling',
            'ternary-relationships',
            'indexing-postgresql-jsonb-columns',
          ],
        },
      ],
    },
  },
};


================================================
FILE: doc/.vuepress/styles/index.styl
================================================
$bgColor = #1E1E1E;
$mediumBgColor = #252525;
$lightBgColor = #383838;
$accentColor = #e0b24d;
$textColor = #DDDDDD;
$borderColor = #383838;

html, body {
  background-color: $bgColor !important;
}

a:focus, button:focus  {
  // Remove ugly mozilla outline.
  outline: none;
}

.theme-container {
  background-color: $bgColor;

  h2 {
    padding-bottom: 1rem;
  }

  h5 {
    font-size: 14px;
  }

  .page {
    background-color: $bgColor;
  }

  .navbar {
    background-color: $mediumBgColor;

    .links {
      background-color: $mediumBgColor;

      .search-box {
        input {
          background-color: $lightBgColor;
        }

        .suggestions {
          background-color: $mediumBgColor;
          border-color: $lightBgColor;

          .suggestion.focused {
            background-color: $lightBgColor;
          }
        }
      }
    }
  }

  code {
    background-color: lighten($bgColor, 6%);
  }

  .warning, .tip {
    code {
      background-color: rgba(0, 0, 0, 0.15);
    }
  }

  .sidebar {
    background-color: $mediumBgColor;
    scrollbar-width: none;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  .dropdown-wrapper {
    .nav-dropdown {
      background-color: $mediumBgColor;
      border-color: $lightBgColor;
    }
  }

  .custom-block {
    color: $textColor;

    &.tip {
      background-color: $lightBgColor;
    }
  }

  .home {
    .hero {
      .action-button  {
        color: $mediumBgColor;
      }
    }
  }

  th, td {
    border-color: #666666;
  }

  tr:nth-child(2n) {
    background-color: lighten($bgColor, 2%);
  }

  .algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu {
    background-color: $bgColor;
    border-color: $lightBgColor;

    .algolia-docsearch-suggestion--category-header {
      background-color: $bgColor;
      color: $textColor;
      border: none;
      border-radius: unset;
    }

    .algolia-docsearch-suggestion--content:before {
      background-color: $lightBgColor;
    }

    [class*=ds-dataset-] {
      background-color: $bgColor;
    }

    .algolia-docsearch-suggestion {
      background-color: $borderColor;
    }

    .algolia-docsearch-suggestion--subcategory-column {
      background-color: lighten($bgColor, 2%);
    }

    .algolia-docsearch-suggestion--content {
      background-color: lighten($bgColor, 2%);
    }

    .algolia-docsearch-suggestion--highlight {
      color: $accentColor;
      background-color: initial;
    }
  }

  .algolia-search-wrapper .algolia-autocomplete .ds-dropdown-menu .ds-cursor .algolia-docsearch-suggestion--content {
    background-color: $lightBgColor !important;
  }

  .algolia-autocomplete .ds-dropdown-menu:before {
    display: none;
  }
}


================================================
FILE: doc/.vuepress/styles/palette.styl
================================================
$accentColor = #e0b24d;
$textColor = #DDDDDD;
$borderColor = #383838;
$codeBgColor = #252525;


================================================
FILE: doc/.vuepress/theme/components/AlgoliaSearchBox.vue
================================================
<template>
  <form
    id="search-form"
    class="algolia-search-wrapper search-box"
    role="search"
  >
    <input
      id="algolia-search-input"
      class="search-query"
    >
  </form>
</template>

<script>
export default {
  props: ['options'],
  mounted () {
    this.initialize(this.options, this.$lang)
  },
  methods: {
    initialize (userOptions, lang) {
      Promise.all([
        import(/* webpackChunkName: "docsearch" */ 'docsearch.js/dist/cdn/docsearch.min.js'),
        import(/* webpackChunkName: "docsearch" */ 'docsearch.js/dist/cdn/docsearch.min.css')
      ]).then(([docsearch]) => {
        docsearch = docsearch.default
        const { algoliaOptions = {}} = userOptions
        docsearch(Object.assign(
          {},
          userOptions,
          {
            inputSelector: '#algolia-search-input',
            // #697 Make docsearch work well at i18n mode.
            algoliaOptions: Object.assign({
              'facetFilters': [`lang:${lang}`].concat(algoliaOptions.facetFilters || [])
            }, algoliaOptions),
            handleSelected: (input, event, suggestion) => {
              // MODIFICATION_FROM_THEME - old
              // this.$router.push(new URL(suggestion.url).pathname)
              // issue: this will redirect the page with duplicate site base
              // MODIFICATION_FROM_THEME - new
              let { pathname, hash } = new URL(suggestion.url)
              const baseUrl = this.$site.base;
              if (baseUrl && pathname.substr(0, baseUrl.length) === baseUrl) {
                pathname = pathname.substr(baseUrl.length - 1)
              }
              this.$router.push(`${pathname}${hash}`)
              // MODIFICATION_FROM_THEME - end
            }
          }
        ))
      })
    },
    update (options, lang) {
      this.$el.innerHTML = '<input id="algolia-search-input" class="search-query">dddd'
      this.initialize(options, lang)
    }
  },
  watch: {
    $lang (newValue) {
      this.update(this.options, newValue)
    },
    options (newValue) {
      this.update(newValue, this.$lang)
    }
  }
}
</script>

<style lang="stylus">
.algolia-search-wrapper
  & > span
    vertical-align middle
  .algolia-autocomplete
    line-height normal
    .ds-dropdown-menu
      background-color #fff
      border 1px solid #999
      border-radius 4px
      font-size 16px
      margin 6px 0 0
      padding 4px
      text-align left
      &:before
        border-color #999
      [class*=ds-dataset-]
        border none
        padding 0
      .ds-suggestions
        margin-top 0
      .ds-suggestion
        border-bottom 1px solid $borderColor
    .algolia-docsearch-suggestion--highlight
      color #2c815b
    .algolia-docsearch-suggestion
      border-color $borderColor
      padding 0
      .algolia-docsearch-suggestion--category-header
        padding 5px 10px
        margin-top 0
        background $accentColor
        color #fff
        font-weight 600
        .algolia-docsearch-suggestion--highlight
          background rgba(255, 255, 255, 0.6)
      .algolia-docsearch-suggestion--wrapper
        padding 0
      .algolia-docsearch-suggestion--title
        font-weight 600
        margin-bottom 0
        color $textColor
      .algolia-docsearch-suggestion--subcategory-column
        vertical-align top
        padding 5px 7px 5px 5px
        border-color $borderColor
        background #f1f3f5
        &:after
          display none
      .algolia-docsearch-suggestion--subcategory-column-text
        color #555
    .algolia-docsearch-footer
      border-color $borderColor
    .ds-cursor .algolia-docsearch-suggestion--content
      background-color #e7edf3 !important
      color $textColor
@media (min-width: $MQMobile)
  .algolia-search-wrapper
    .algolia-autocomplete
      .algolia-docsearch-suggestion
        .algolia-docsearch-suggestion--subcategory-column
          float none
          width 150px
          min-width 150px
          display table-cell
        .algolia-docsearch-suggestion--content
          float none
          display table-cell
          width 100%
          vertical-align top
        .ds-dropdown-menu
          min-width 515px !important
@media (max-width: $MQMobile)
  .algolia-search-wrapper
    .ds-dropdown-menu
      min-width calc(100vw - 4rem) !important
      max-width calc(100vw - 4rem) !important
    .algolia-docsearch-suggestion--wrapper
      padding 5px 7px 5px 5px !important
    .algolia-docsearch-suggestion--subcategory-column
      padding 0 !important
      background white !important
    .algolia-docsearch-suggestion--subcategory-column-text:after
      content " > "
      font-size 10px
      line-height 14.4px
      display inline-block
      width 5px
      margin -3px 3px 0
      vertical-align middle
</style>


================================================
FILE: doc/.vuepress/theme/index.js
================================================
const path = require('path');

module.exports = (_, ctx) => ({
  // MODIFICATION_FROM_THEME - this alias method is imported without change
  // to point to updated AlgoliaSearchBox.vue
  alias() {
    const { themeConfig, siteConfig } = ctx;

    // resolve algolia
    const isAlgoliaSearch =
      themeConfig.algolia ||
      Object.keys((siteConfig.locales && themeConfig.locales) || {}).some(
        (base) => themeConfig.locales[base].algolia,
      );

    return {
      '@AlgoliaSearchBox': isAlgoliaSearch
        ? path.resolve(__dirname, 'components/AlgoliaSearchBox.vue')
        : path.resolve(__dirname, 'noopModule.js'),
    };
  },

  extend: '@vuepress/theme-default',
});


================================================
FILE: doc/README.md
================================================
---
home: true
heroText: Objection.js
tagline: An SQL-friendly ORM for Node.js
actionText: Get Started →
actionLink: /guide/installation
footer: MIT Licensed | Copyright © 2015-present Sami Koskimäki
---

Objection.js is an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) for [Node.js](https://nodejs.org/) that aims to stay out of your way and make it as easy as possible to use the full power of SQL and the underlying database engine while still making the common stuff easy and enjoyable.

Even though ORM is the best commonly known acronym to describe objection, a more accurate description is to call it **a relational query builder**. You get all the benefits of an SQL query builder but also a powerful set of tools for working with relations.

Objection.js is built on an SQL query builder called [knex](https://knexjs.org). All databases supported by knex are supported by objection.js. **SQLite3**, **Postgres** and **MySQL** are [thoroughly tested](https://github.com/Vincit/objection.js/actions).

What objection.js gives you:

- **An easy declarative way of [defining models](/guide/models.html) and relationships between them**
- **Simple and fun way to [fetch, insert, update and delete](/guide/query-examples.html) objects using the full power of SQL**
- **Powerful mechanisms for [eager loading](/guide/query-examples.html#eager-loading), [inserting](/guide/query-examples.html#graph-inserts) and [upserting](/guide/query-examples.html#graph-upserts) object graphs**
- **Easy to use [transactions](/guide/transactions.html)**
- **Official [TypeScript](https://github.com/Vincit/objection.js/blob/main/typings/objection/index.d.ts) support**
- **Optional [JSON schema](/guide/validation.html) validation**
- **A way to [store complex documents](/guide/documents.html) as single rows**

What objection.js **doesn't** give you:

- **A custom query DSL. SQL is used as a query language.**
  This doesn't mean you have to write SQL strings though. A query builder based on [knex](https://knexjs.org) is
  used to build the SQL. However, if the query builder fails you for some reason, raw SQL strings can be easily
  written using the [raw](/api/objection/#raw) helper function.
- **Automatic database schema creation and migration from model definitions.**
  For simple things it is useful that the database schema is automatically generated from the model definitions,
  but usually just gets in your way when doing anything non-trivial. Objection.js leaves the schema related things
  to you. knex has a great [migration tool](https://knexjs.org/guide/migrations.html) that we recommend for this job. Check
  out the [example project](https://github.com/Vincit/objection.js/tree/main/examples/koa-ts).

The best way to get started is to clone our [example project](https://github.com/Vincit/objection.js/tree/main/examples/koa) and start playing with it. There's also a [typescript version](https://github.com/Vincit/objection.js/tree/main/examples/koa-ts) available.

Check out [this issue](https://github.com/Vincit/objection.js/issues/1069) to see who is using objection and what they think about it.


================================================
FILE: doc/api/README.md
================================================
# API Reference

**NOTE**: Everything not mentioned in the API documentation is considered private implementation
and shouldn't be relied upon. Private implemementation can change without any notice even between
patch versions. Public API described here follows [semantic versioning](https://semver.org/).


================================================
FILE: doc/api/model/instance-methods.md
================================================
# Instance Methods

All instance methods start with the character `$` to prevent them from colliding with the database column names.

## $query()

```js
const queryBuilder = person.$query(transactionOrKnex);
```

Creates a query builder for this model instance.

All queries built using the returned builder only affect this instance.

##### Arguments

| Argument          | Type   | Description                                                                                                                                                        |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| transactionOrKnex | object | Optional transaction or knex instance for the query. This can be used to specify a transaction or even a different database for a query. Falsy values are ignored. |

##### Return value

| Type                                | Description   |
| ----------------------------------- | ------------- |
| [QueryBuilder](/api/query-builder/) | query builder |

##### Examples

Re-fetch an item from the database:

```js
// If you need to refresh the same instance you can do this:
const reFetchedPerson = await person.$query();

// Note that `person` did not get modified by the fetch.
person.$set(reFetchedPerson);
```

Insert a new item to database:

```js
const jennifer = await Person.fromJson({ firstName: 'Jennifer' })
  .$query()
  .insert();

console.log(jennifer.id);
```

Patch an item:

```js
await person.$query().patch({ lastName: 'Cooper' });

console.log('person updated');
```

Delete an item.

```js
await person.$query().delete();

console.log('person deleted');
```

## $relatedQuery()

```js
const builder = person.$relatedQuery(relationName, transactionOrKnex);
```

Use this to build a query that only affects items related through a relation.

See the examples below and [here](/guide/query-examples.html#relation-queries).

::: tip
This methods is just a shortcut for this call to the static [relatedQuery](/api/model/static-methods.html#static-relatedquery) method:

```js
const builder = Person.relatedQuery(relationName, transactionOrKnex).for(
  person
);
```

:::

##### Arguments

| Argument          | Type   | Description                                                                                                                                                        |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| relationName      | string | The name of the relation to query.                                                                                                                                 |
| transactionOrKnex | object | Optional transaction or knex instance for the query. This can be used to specify a transaction or even a different database for a query. Falsy values are ignored. |

##### Return value

| Type                                | Description     |
| ----------------------------------- | --------------- |
| [QueryBuilder](/api/query-builder/) | A query builder |

##### Examples

Fetch all items related to an item through a relation:

```js
const pets = await jennifer.$relatedQuery('pets');

console.log('jennifer has', pets.length, 'pets');
```

The related query is just like any other query. All knex and objection query builder methods are available:

```js
const dogsAndCats = await jennifer
  .$relatedQuery('pets')
  .select('animals.*', 'persons.name as ownerName')
  .where('species', '=', 'dog')
  .orWhere('breed', '=', 'cat')
  .innerJoin('persons', 'persons.id', 'animals.ownerId')
  .orderBy('animals.name');

// All the dogs and cats have the owner's name "Jennifer"
// joined as the `ownerName` property.
console.log(dogsAndCats);
```

This inserts a new item to the database and binds it to the owner item as defined by the relation (by default):

```js
const waldo = await jennifer
  .$relatedQuery('pets')
  .insert({ species: 'dog', name: 'Fluffy' });

console.log(waldo.id);
```

To attach an existing item to a relation the `relate` method can be used. In this example the dog `fluffy` already exists in the database but it isn't related to `jennifer` through the `pets` relation. We can make the connection like this:

```js
await jennifer.$relatedQuery('pets').relate(fluffy.id);

console.log('fluffy is now related to jennifer through pets relation');
```

The connection can be removed using the `unrelate` method. Again, this doesn't delete the related model. Only the connection is removed. For example in the case of ManyToMany relation the join table entries are deleted.

```js
await jennifer
  .$relatedQuery('pets')
  .unrelate()
  .where('id', fluffy.id);

console.log('jennifer no longer has fluffy as a pet');
```

Related items can be deleted using the delete method. Note that in the case of ManyToManyRelation the join table entries are not deleted. You should use `ON DELETE CASCADE` in your database migrations to make the database properly delete the join table rows when either end of the relation is deleted. Naturally the delete query can be chained with any query building methods.

```js
await jennifer
  .$relatedQuery('pets')
  .delete()
  .where('species', 'cat');

console.log('jennifer no longer has any cats');
```

`update` and `patch` can be used to update related models. Only difference between the mentioned methods is that `update` validates the input objects using the related model class's full schema and `patch` ignores the `required` property of the schema. Use `update` when you want to update _all_ properties of a model and `patch` when only a subset should be updated.

```js
const updatedFluffy = await jennifer
  .$relatedQuery('pets')
  .update({ species: 'dog', name: 'Fluffy the great', vaccinated: false })
  .where('id', fluffy.id);

console.log("fluffy's new name is", updatedFluffy.name);

// This query will be rejected assuming that `name` or `species`
// is a required property for an Animal.
await jennifer
  .$relatedQuery('pets')
  .update({ vaccinated: true })
  .where('species', 'dog');

// This query will succeed.
await jennifer
  .$relatedQuery('pets')
  .patch({ vaccinated: true })
  .where('species', 'dog');

console.log('jennifer just got all her dogs vaccinated');
```

## $beforeInsert()

```js
class Person extends Model {
  async $beforeInsert(queryContext) {
    await super.$beforeInsert(queryContext);
    await this.doPossiblyAsyncStuff();
  }
}
```

Called before a model is inserted into the database.

You can return a promise from this function if you need to do asynchronous stuff. You can also throw an exception to abort the insert and reject the query. This can be useful if you need to do insert specific validation.

If you start a query from this hook, make sure you specify `queryContext.transaction` as it's connection to make sure the query takes part in the same transaction as the parent query. See the example below.

##### Arguments

| Argument     | Type   | Description                                                                                           |
| ------------ | ------ | ----------------------------------------------------------------------------------------------------- |
| queryContext | Object | The context object of the insert query. See [context](/api/query-builder/other-methods.html#context). |

##### Return value

| Type                                                               | Description                                                  |
| ------------------------------------------------------------------ | ------------------------------------------------------------ |
| [Promise](http://bluebirdjs.com/docs/getting-started.html)<br>void | Promise or void depending whether your hook is async or not. |

##### Examples

The current query's transaction/knex instance can always be accessed through `queryContext.transaction`.

```js
class Person extends Model {
  async $beforeInsert(queryContext) {
    await super.$beforeInsert(queryContext);
    // This can always be done even if there is no running
    // transaction. In that case `queryContext.transaction`
    // returns the normal knex instance. This makes sure that
    // the query is not executed outside the original query's
    // transaction.
    await SomeModel.query(queryContext.transaction).insert(whatever);
  }
}
```

## $afterInsert()

```js
class Person extends Model {
  async $afterInsert(queryContext) {
    await super.$afterInsert(queryContext);
    await this.doPossiblyAsyncStuff();
  }
}
```

Called after a model has been inserted into the database.

You can return a promise from this function if you need to do asynchronous stuff.

##### Arguments

| Argument     | Type   | Description                                                                                           |
| ------------ | ------ | ----------------------------------------------------------------------------------------------------- |
| queryContext | Object | The context object of the insert query. See [context](/api/query-builder/other-methods.html#context). |

##### Return value

| Type                                                               | Description                                                  |
| ------------------------------------------------------------------ | ------------------------------------------------------------ |
| [Promise](http://bluebirdjs.com/docs/getting-started.html)<br>void | Promise or void depending whether your hook is async or not. |

##### Examples

The current query's transaction/knex instance can always be accessed through `queryContext.transaction`.

```js
class Person extends Model {
  async $afterInsert(queryContext) {
    await super.$afterInsert(queryContext);
    // This can always be done even if there is no running transaction. In that
    // case `queryContext.transaction` returns the normal knex instance. This
    // makes sure that the query is not executed outside the original query's
    // transaction.
    await SomeModel.query(queryContext.transaction).insert(whatever);
  }
}
```

## $beforeUpdate()

```js
class Person extends Model {
  async $beforeUpdate(opt, queryContext) {
    await super.$beforeUpdate(opt, queryContext);
    await this.doPossiblyAsyncStuff();
  }
}
```

Called before a model instance is updated.

You can return a promise from this function if you need to do asynchronous stuff. You can also throw an exception to abort the update and reject the query. This can be useful if
you need to do update specific validation.

This method is also called before a model is patched. Therefore all the model's properties may not exist. You can check if the update operation is a patch by checking the `opt.patch` boolean.

Inside the hook, `this` contains the values to be updated. If (and only if) the query is started for an existing model instance using [\$query](/api/model/instance-methods.html#query), `opt.old` object contains the old values. The old values are never fetched from the database implicitly. For non-instance queries the `opt.old` object is `undefined`. See the examples.

##### Arguments

| Argument     | Type                                          | Description                                                                                           |
| ------------ | --------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| opt          | [ModelOptions](/api/types/#type-modeloptions) | Update options.                                                                                       |
| queryContext | Object                                        | The context object of the update query. See [context](/api/query-builder/other-methods.html#context). |

##### Return value

| Type                                                               | Description                                                  |
| ------------------------------------------------------------------ | ------------------------------------------------------------ |
| [Promise](http://bluebirdjs.com/docs/getting-started.html)<br>void | Promise or void depending whether your hook is async or not. |

##### Examples

The current query's transaction/knex instance can always be accessed through `queryContext.transaction`.

```js
class Person extends Model {
  async $beforeUpdate(opt, queryContext) {
    await super.$beforeUpdate(opt, queryContext);
    // This can always be done even if there is no running transaction.
    // In that case `queryContext.transaction` returns the normal knex
    // instance. This makes sure that the query is not executed outside
    // the original query's transaction.
    await SomeModel.query(queryContext.transaction).insert(whatever);
  }
}
```

Note that the `opt.old` object is only populated for instance queries started with `$query`:

```js
somePerson.$query().update(newValues);
```

For the following query `opt.old` is `undefined` because there is no old object in the JavaScript side. objection.js doesn't fetch the old values even if they existed in the database
for performance and simplicity reasons.

```js
Person.query()
  .update(newValues)
  .where('foo', 'bar');
```

## $afterUpdate()

```js
class Person extends Model {
  async $afterUpdate(opt, queryContext) {
    await super.$afterUpdate(opt, queryContext);
    await this.doPossiblyAsyncStuff();
  }
}
```

Called after a model instance is updated.

You can return a promise from this function if you need to do asynchronous stuff.

This method is also called after a model is patched. Therefore all the model's properties may not exist. You can check if the update operation is a patch by checking the `opt.patch` boolean.

Inside the hook, `this` contains the values to be updated. If (and only if) the query is started for an existing model instance using [\$query](/api/model/instance-methods.html#query), `opt.old` object contains the old values. The old values are never fetched from the database implicitly. For non-instance queries the `opt.old` object is `undefined`. See the examples.

##### Arguments

| Argument     | Type                                          | Description                                                                                           |
| ------------ | --------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| opt          | [ModelOptions](/api/types/#type-modeloptions) | Update options.                                                                                       |
| queryContext | Object                                        | The context object of the update query. See [context](/api/query-builder/other-methods.html#context). |

##### Return value

| Type                                                               | Description                                                  |
| ------------------------------------------------------------------ | ------------------------------------------------------------ |
| [Promise](http://bluebirdjs.com/docs/getting-started.html)<br>void | Promise or void depending whether your hook is async or not. |

##### Examples

The current query's transaction/knex instance can always be accessed through `queryContext.transaction`.

```js
class Person extends Model {
  async $afterUpdate(opt, queryContext) {
    await super.$afterUpdate(opt, queryContext);
    // This can always be done even if there is no running transaction.
    // In that case `queryContext.transaction` returns the normal knex
    // instance. This makes sure that the query is not executed
    // outside the original query's transaction.
    await SomeModel.query(queryContext.transaction).insert(whatever);
  }
}
```

Note that the `opt.old` object is only populated for instance queries started with `$query`:

```js
somePerson.$query().update(newValues);
```

For the following query `opt.old` is `undefined` because there is no old object in the JavaScript side. objection.js doesn't fetch the old values even if they existed in the database for performance and simplicity reasons.

```js
Person.query()
  .update(newValues)
  .where('foo', 'bar');
```

## $beforeDelete()

```js
class Person extends Model {
  async $beforeDelete(queryContext) {
    await super.$beforeDelete(queryContext);
    await doPossiblyAsyncStuff();
  }
}
```

Called before a model is deleted.

You can return a promise from this function if you need to do asynchronous stuff.

::: warning
This method is only called for instance deletes started with [\$query()](/api/model/instance-methods.html#query) method. All hooks are instance methods. For deletes there is no instance for which to call the hook, except when [\$query()](/api/model/instance-methods.html#query) is used. Objection doesn't fetch the item just to call the hook for it to ensure predictable performance and prevent a whole class of concurrency bugs.
:::

##### Arguments

| Argument     | Type   | Description                                                                                           |
| ------------ | ------ | ----------------------------------------------------------------------------------------------------- |
| queryContext | Object | The context object of the update query. See [context](/api/query-builder/other-methods.html#context). |

##### Return value

| Type                                                               | Description                                                  |
| ------------------------------------------------------------------ | ------------------------------------------------------------ |
| [Promise](http://bluebirdjs.com/docs/getting-started.html)<br>void | Promise or void depending whether your hook is async or not. |

##### Examples

The current query's transaction/knex instance can always be accessed through `queryContext.transaction`.

```js
class Person extends Model {
  async $beforeDelete(queryContext) {
    await super.$beforeDelete(queryContext);
    // This can always be done even if there is no running transaction.
    // In that case `queryContext.transaction` returns the normal knex
    // instance. This makes sure that the query is not executed outside
    // the original query's transaction.
    await SomeModel.query(queryContext.transaction).insert(whatever);
  }
}
```

## $afterDelete()

```js
class Person extends Model {
  async $afterDelete(queryContext) {
    await super.$afterDelete(queryContext);
    await this.doPossiblyAsyncStuff();
  }
}
```

Called after a model is deleted.

You can return a promise from this function if you need to do asynchronous stuff.

::: warning
This method is only called for instance deletes started with [\$query()](/api/model/instance-methods.html#query) method. All hooks are instance methods. For deletes there is no instance for which to call the hook, except when [\$query()](/api/model/instance-methods.html#query) is used. Objection doesn't fetch the item just to call the hook for it to ensure predictable performance and prevent a whole class of concurrency bugs.
:::

##### Arguments

| Argument     | Type   | Description                                                                                           |
| ------------ | ------ | ----------------------------------------------------------------------------------------------------- |
| queryContext | Object | The context object of the update query. See [context](/api/query-builder/other-methods.html#context). |

##### Return value

| Type                                                               | Description                                                  |
| ------------------------------------------------------------------ | ------------------------------------------------------------ |
| [Promise](http://bluebirdjs.com/docs/getting-started.html)<br>void | Promise or void depending whether your hook is async or not. |

##### Examples

The current query's transaction/knex instance can always be accessed through `queryContext.transaction`.

```js
class Person extends Model {
  async $afterDelete(queryContext) {
    await super.$afterDelete(queryContext);
    // This can always be done even if there is no running transaction. In that
    // case `queryContext.transaction` returns the normal knex instance. This
    // makes sure that the query is not executed outside the original query's
    // transaction.
    await SomeModel.query(queryContext.transaction).insert(whatever);
  }
}
```

## $afterFind()

```js
class Person extends Model {
  $afterFind(queryContext) {
    return doPossiblyAsyncStuff();
  }
}
```

Called after a model is fetched.

This method is _not_ called for insert, update or delete operations.

You can return a promise from this function if you need to do asynchronous stuff.

##### Arguments

| Argument     | Type   | Description                                                                                           |
| ------------ | ------ | ----------------------------------------------------------------------------------------------------- |
| queryContext | Object | The context object of the update query. See [context](/api/query-builder/other-methods.html#context). |

##### Return value

| Type                                                               | Description                                                  |
| ------------------------------------------------------------------ | ------------------------------------------------------------ |
| [Promise](http://bluebirdjs.com/docs/getting-started.html)<br>void | Promise or void depending whether your hook is async or not. |

##### Examples

The current query's transaction/knex instance can always be accessed through `queryContext.transaction`.

```js
class Person extends Model {
  $afterFind(queryContext) {
    // This can always be done even if there is no running transaction.
    // In that case `queryContext.transaction` returns the normal knex
    // instance. This makes sure that the query is not executed outside
    // the original query's transaction.
    return SomeModel.query(queryContext.transaction).insert(whatever);
  }
}
```

## $clone()

```js
const clone = modelInstance.$clone(options);
```

Returns a (deep) copy of a model instance.

If the item to be cloned has instances of [Model](/api/model/) as properties (or arrays of them) they are cloned using their `$clone()` method. A shallow copy without relations can be created by passing the `shallow: true` option.

##### Arguments

| Argument | Type                                          | Description      |
| -------- | --------------------------------------------- | ---------------- |
| opt      | [CloneOptions](/api/types/#type-cloneoptions) | Optional options |

##### Return value

| Type                 | Description          |
| -------------------- | -------------------- |
| [Model](/api/model/) | Deep clone of `this` |

##### Examples

```js
const shallowClone = modelInstance.$clone({ shallow: true });
```

## toJSON()

```js
const jsonObj = modelInstance.toJSON(opt);
```

Exports this model as a JSON object.

See [this section](/api/model/overview.html#model-data-lifecycle) for more information.

##### Arguments

| Argument | Type                                            | Description      |
| -------- | ----------------------------------------------- | ---------------- |
| opt      | [ToJsonOptions](/api/types/#type-tojsonoptions) | Optional options |

##### Return value

| Type   | Description             |
| ------ | ----------------------- |
| Object | Model as a JSON object. |

##### Examples

```js
const shallowObj = modelInstance.toJSON({ shallow: true, virtuals: false });
```

```js
const onlySomeVirtuals = modelInstance.toJSON({ virtuals: ['fullName'] });
```

## $toJson()

Alias for [toJSON](/api/model/instance-methods.html#tojson)

## $toDatabaseJson()

```js
const row = modelInstance.$toDatabaseJson();
```

Exports this model as a database JSON object.

This method is called internally to convert a model into a database row.

See [this section](/api/model/overview.html#model-data-lifecycle) for more information.

##### Return value

| Type   | Description   |
| ------ | ------------- |
| Object | Database row. |

## $parseDatabaseJson()

```js
class Person extends Model {
  $parseDatabaseJson(json) {
    // Remember to call the super class's implementation.
    json = super.$parseDatabaseJson(json);
    // Do your conversion here.
    return json;
  }
}
```

This is called when a [Model](/api/model/) instance is created from a database JSON object. This method converts the JSON object from the database format to the internal format.

You can override this method to carry out whatever conversions you want for the data when it's fetched from the database, before it's converted into a model instance. See [this section](/api/model/overview.html#model-data-lifecycle) for more information.

There are a couple of requirements for the implementation:

1. This function must be pure. It shouldn't have any side effects because it is called from "unexpected" places (for example to determine if your model somehow transforms column names between db and code).

2. This function must be able to handle any subset of the model's properties coming in.You cannot assume that some column is present in the `json` object as it depends on the select statement. There can also be additional columns because of joins, aliases etc. This method must also be prepared for null values in _any_ property of the `json` object.

##### Arguments

| Argument | Type   | Description                      |
| -------- | ------ | -------------------------------- |
| json     | Object | The JSON POJO in database format |

##### Return value

| Type   | Description                      |
| ------ | -------------------------------- |
| Object | The JSON POJO in internal format |

## $formatDatabaseJson()

```js
class Person extends Model {
  $formatDatabaseJson(json) {
    // Remember to call the super class's implementation.
    json = super.$formatDatabaseJson(json);
    // Do your conversion here.
    return json;
  }
}
```

This is called when a [Model](/api/model/) is converted to database format.

You can override this method to carry out whatever conversions you want for the data when it's being sent to the database driver. See [this section](/api/model/overview.html#model-data-lifecycle) for more information.

There are a couple of requirements for the implementation:

1. This function must be pure. It shouldn't have any side effects because it is called from "unexpected" places (for example to determine if your model somehow transforms column names between db and code).

2. This function must be able to handle any subset of the model's properties coming in. You cannot assume that some property is present in the `json` object. There can also be additional properties. This method must also be prepared for null values in _any_ property of the `json` object.

##### Arguments

| Argument | Type   | Description                      |
| -------- | ------ | -------------------------------- |
| json     | Object | The JSON POJO in internal format |

##### Return value

| Type   | Description                      |
| ------ | -------------------------------- |
| Object | The JSON POJO in database format |

## $parseJson()

```js
class Person extends Model {
  $parseJson(json, opt) {
    // Remember to call the super class's implementation.
    json = super.$parseJson(json, opt);
    // Do your conversion here.
    return json;
  }
}
```

This is called when a [Model](/api/model/) is created from a JSON object. Converts the JSON object from the external format to the internal format.

You can override this method to carry out whatever conversions you want for the data when a model instance is being created from external data. See [this section](/api/model/overview.html#model-data-lifecycle) for more information.

There are a couple of requirements for the implementation:

1. This function must be pure. It shouldn't have any side effects because it is called from "unexpected" places (for example to determine if your model somehow transforms column names between db and code).

2. This function must be able to handle any subset of the model's properties coming in. You cannot assume that some property is present in the `json` object. There can also be additional properties. This method must also be prepared for null values in _any_ property of the `json` object.

##### Arguments

| Argument | Type                                          | Description                      |
| -------- | --------------------------------------------- | -------------------------------- |
| json     | Object                                        | The JSON POJO in external format |
| opt      | [ModelOptions](/api/types/#type-modeloptions) | Optional options                 |

##### Return value

| Type   | Description                      |
| ------ | -------------------------------- |
| Object | The JSON POJO in internal format |

## $formatJson()

```js
class Person extends Model {
  $formatJson(json) {
    // Remember to call the super class's implementation.
    json = super.$formatJson(json);
    // Do your conversion here.
    return json;
  }
}
```

This is called when a [Model](/api/model/) is converted to JSON. Converts the JSON object from the internal format to the external format.

You can override this method to carry out whatever conversions you want for the data when a model instance is being converted into external representation. See [this section](/api/model/overview.html#model-data-lifecycle) for more information.

There are a couple of requirements for the implementation:

1. This function must be pure. It shouldn't have any side effects because it is called from "unexpected" places (for example to determine if your model somehow transforms column names between db and code).

2. This function must be able to handle any subset of the model's properties coming in. You cannot assume that some column is present in the `json` object as it depends on the select statement. There can also be additional columns because of joins, aliases etc. This method must also be prepared for null values in _any_ property of the `json` object.

##### Arguments

| Argument | Type   | Description                      |
| -------- | ------ | -------------------------------- |
| json     | Object | The JSON POJO in internal format |

##### Return value

| Type   | Description                      |
| ------ | -------------------------------- |
| Object | The JSON POJO in external format |

## $setJson()

```js
modelInstance.$setJson(json, opt);
```

Sets the values from a JSON object.

Validates the JSON before setting values.

##### Arguments

| Argument | Type                                          | Description          |
| -------- | --------------------------------------------- | -------------------- |
| json     | Object                                        | The JSON POJO to set |
| opt      | [ModelOptions](/api/types/#type-modeloptions) | Optional options     |

##### Return value

| Type                 | Description         |
| -------------------- | ------------------- |
| [Model](/api/model/) | `this` for chaining |

## $setDatabaseJson()

```js
modelInstance.$setDatabaseJson(json);
```

Sets the values from a JSON object in database format.

##### Arguments

| Argument | Type   | Description                      |
| -------- | ------ | -------------------------------- |
| json     | Object | The JSON POJO in database format |

##### Return value

| Type                 | Description         |
| -------------------- | ------------------- |
| [Model](/api/model/) | `this` for chaining |

## $set()

```js
modelInstance.$set(json);
```

Sets the values from another model instance or object.

Unlike [\$setJson](/api/model/instance-methods.html#setjson), this doesn't call any [\$parseJson](/api/model/instance-methods.html#parsejson) hooks or validate the input. This simply sets each value in the object to this object.

##### Arguments

| Argument | Type   | Description       |
| -------- | ------ | ----------------- |
| obj      | Object | The values to set |

##### Return value

| Type                 | Description         |
| -------------------- | ------------------- |
| [Model](/api/model/) | `this` for chaining |

## $setRelated()

```js
modelInstance.$setRelated(relation, relatedModels);
```

Sets related models to a corresponding property in the object.

##### Arguments

| Argument      | Type                                               | Description                                  |
| ------------- | -------------------------------------------------- | -------------------------------------------- |
| relation      | string&#124;[Relation](/api/types/#class-relation) | Relation name or a relation instance to set. |
| relatedModels | [Model](/api/model/)&#124;[Model](/api/model/)[]   | Models to set.                               |

##### Return value

| Type                 | Description         |
| -------------------- | ------------------- |
| [Model](/api/model/) | `this` for chaining |

##### Examples

```js
person.$setRelated('parent', parent);
console.log(person.parent);
```

```js
person.$setRelated('children', children);
console.log(person.children[0]);
```

## $appendRelated()

```js
modelInstance.$appendRelated(relation, relatedModels);
```

Appends related models to a corresponding property in the object.

##### Arguments

| Argument      | Type                                               | Description                                        |
| ------------- | -------------------------------------------------- | -------------------------------------------------- |
| relation      | string&#124;[Relation](/api/types/#class-relation) | Relation name or a relation instance to append to. |
| relatedModels | [Model](/api/model/)&#124;[Model](/api/model/)[]   | Models to append.                                  |

##### Return value

| Type                 | Description         |
| -------------------- | ------------------- |
| [Model](/api/model/) | `this` for chaining |

##### Examples

```js
person.$appendRelated('parent', parent);
console.log(person.parent);
```

```js
person.$appendRelated('children', child1);
person.$appendRelated('children', child2);

child1 = person.children[person.children.length - 1];
child2 = person.children[person.children.length - 2];
```

## $fetchGraph()

```js
const builder = person.$fetchGraph(expression, options);
```

Shortcut for [Person.fetchGraph(person, options)](/api/model/static-methods.html#static-fetchgraph)

## $traverse()

```js
person.$traverse(filterConstructor, callback);
```

Shortcut for [Model.traverse(filterConstructor, this, callback)](/api/model/static-methods.html#static-traverse).

## $traverseAsync()

```js
person.$traverseAsync(filterConstructor, callback);
```

Shortcut for [Model.traverseAsync(filterConstructor, this, callback)](/api/model/static-methods.html#static-traverseasync).

## $knex()

```js
const knex = person.$knex();
```

Shortcut for [Person.knex()](/api/model/static-methods.html#static-knex).

## $transaction()

```js
const knex = person.$transaction();
```

Shortcut for [Person.knex()](/api/model/static-methods.html#static-knex).

## $id()

```js
console.log(model.$id()); // -> 100
// Sets the id.
model.$id(100);
```

Returns or sets the identifier of a model instance.

The identifier property does not have to be accessed or set using this method.

If the identifier property is known it can be accessed or set just like any other property. You don't need to use this method to set the identifier. This method is mainly helpful when building plugins and other tools on top of objection.

##### Examples

Composite key

```js
console.log(model.$id()); // -> [100, 20, 30]
// Sets the id.
model.$id([100, 20, 30]);
```

## $beforeValidate()

```js
class Person extends Model {
  $beforeValidate(jsonSchema, json, opt) {
    return jsonSchema;
  }
}
```

This is called before validation.

You can add any additional validation to this method. If validation fails, simply throw an exception and the query will be rejected. If you modify the `jsonSchema` argument and return it, that one will be used to validate the model.

`opt.old` object contains the old values while `json` contains the new values if validation is being done for an existing object.

##### Arguments

| Argument   | Type                                          | Description                             |
| ---------- | --------------------------------------------- | --------------------------------------- |
| jsonSchema | Object                                        | A deep clone of this class's jsonSchema |
| json       | Object                                        | The JSON object to be validated         |
| opt        | [ModelOptions](/api/types/#type-modeloptions) | Optional options                        |

##### Return value

| Type   | Description                                      |
| ------ | ------------------------------------------------ |
| Object | The modified jsonSchema or the input jsonSchema. |

## $afterValidate()

```js
class Person extends Model {
  $afterValidate(json, opt) {}
}
```

This is called after successful validation.

You can do further validation here and throw an error if something goes wrong.

`opt.old` object contains the old values while `json` contains the new values if validation is being done for an existing object.

##### Arguments

| Argument | Type                                          | Description                     |
| -------- | --------------------------------------------- | ------------------------------- |
| json     | Object                                        | The JSON object to be validated |
| opt      | [ModelOptions](/api/types/#type-modeloptions) | Optional options                |

## $validate()

```js
modelInstance.$validate();
```

Validates the model instance.

Calls [\$beforeValidate](/api/model/instance-methods.html#beforevalidate) and [\$afterValidate](/api/model/instance-methods.html#aftervalidate) methods. This method is called automatically from [fromJson](/api/model/static-methods.html#static-fromjson) and [\$setJson](/api/model/instance-methods.html#setjson) methods. This method can also be
called explicitly when needed.

##### Throws

| Type                                                 | Description          |
| ---------------------------------------------------- | -------------------- |
| [ValidationError](/api/types/#class-validationerror) | If validation fails. |

## $omitFromJson()

```js
modelInstance.$omitFromJson(props);
```

Omits a set of properties when converting the model to JSON.

##### Arguments

| Argument | Type                                                     | Description   |
| -------- | -------------------------------------------------------- | ------------- |
| props    | string<br>string[]<br>Object&lt;string,&nbsp;boolean&gt; | props to omit |

##### Return value

| Type                 | Description         |
| -------------------- | ------------------- |
| [Model](/api/model/) | `this` for chaining |

##### Examples

```js
const json = person
  .fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
  .$omitFromJson('lastName')
  .$toJson();

console.log(_.has(json, 'lastName')); // --> false
```

```js
const json = person
  .fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
  .$omitFromJson(['lastName'])
  .$toJson();

console.log(_.has(json, 'lastName')); // --> false
```

```js
const json = person
  .fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
  .$omitFromJson({ lastName: true })
  .$toJson();

console.log(_.has(json, 'lastName')); // --> false
```

## $omitFromDatabaseJson()

```js
modelInstance.$omitFromDatabaseJson(props);
```

Omits a set of properties when converting the model to database JSON.

##### Arguments

| Argument | Type                                                     | Description   |
| -------- | -------------------------------------------------------- | ------------- |
| props    | string<br>string[]<br>Object&lt;string,&nbsp;boolean&gt; | props to omit |

##### Return value

| Type                 | Description         |
| -------------------- | ------------------- |
| [Model](/api/model/) | `this` for chaining |

##### Examples

```js
const json = person
  .fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
  .$omitFromDatabaseJson('lastName')
  .$toDatabaseJson();

console.log(_.has(json, 'lastName')); // --> false
```

```js
const json = person
  .fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
  .$omitFromJson(['lastName'])
  .$toDatabaseJson();

console.log(_.has(json, 'lastName')); // --> false
```

```js
const json = person
  .fromJson({ firstName: 'Jennifer', lastName: 'Lawrence', age: 24 })
  .$omitFromJson({ lastName: true })
  .$toDatabaseJson();

console.log(_.has(json, 'lastName')); // --> false
```


================================================
FILE: doc/api/model/instance-properties.md
================================================
# Instance Properties

All instance properties start with the character `$` to prevent them from colliding with the database column names.

## $modelClass

```js
const modelClass = person.$modelClass;
```

Returns the class of the model instance. The return value is equal to `this.constructor`. This is mainly useful with typescript where the type is `ModelClass<this>` which is more useful than the `Function` type of `this.constructor`.

##### Examples

```js
const person = Person.fromJson({ id: 1 });
console.log(person.$modelClass === Person); // prints true
```

================================================
FILE: doc/api/model/overview.md
================================================
# Overview

## Model data lifecycle

For the purposes of this explanation, let’s define three data layouts:

1. `database`: The data layout returned by the database.
2. `internal`: The data layout of a model instance.
3. `external`: The data layout after calling model.toJSON().

Whenever data is converted from one layout to another, converter methods are called:

1. `database` -> [\$parseDatabaseJson](/api/model/instance-methods.html#parsedatabasejson) -> `internal`
2. `internal` -> [\$formatDatabaseJson](/api/model/instance-methods.html#formatdatabasejson) -> `database`
3. `external` -> [\$parseJson](/api/model/instance-methods.html#parsejson) -> `internal`
4. `internal` -> [\$formatJson](/api/model/instance-methods.html#formatjson) -> `external`

So for example when the results of a query are read from the database the data goes through the [\$parseDatabaseJson](/api/model/instance-methods.html#parsedatabasejson) method. When data is written to database it goes through the [\$formatDatabaseJson](/api/model/instance-methods.html#formatdatabasejson) method.

Similarly when you give data for a query (for example [`query().insert(req.body)`](/api/query-builder/mutate-methods.html#insert)) or create a model explicitly using [`Model.fromJson(obj)`](/api/model/static-methods.html#static-fromjson) the [\$parseJson](/api/model/instance-methods.html#parsejson) method is invoked. When you call [`model.toJSON()`](/api/model/instance-methods.html#tojson) or [`model.$toJson()`](/api/model/instance-methods.html#tojson) the [\$formatJson](/api/model/instance-methods.html#formatjson) is called.

Note: Most libraries like [express](https://expressjs.com/en/index.html) and [koa](https://koajs.com/) automatically call the [toJSON](/api/model/instance-methods.html#tojson) method when you pass the model instance to methods like `response.json(model)`. You rarely need to call [toJSON()](/api/model/instance-methods.html#tojson) or [\$toJson()](/api/model/instance-methods.html#tojson) explicitly.

By overriding the lifecycle methods, you can have different layouts for the data in database and when exposed to the outside world.

All instance methods of models are prefixed with `$` letter so that they won’t overlap with database properties. All properties that start with `$` are also removed from `database` and `external` layouts.

In addition to these data formatting hooks, Model also has query lifecycle hooks

- [\$beforeUpdate](/api/model/instance-methods.html#beforeupdate)
- [\$afterUpdate](/api/model/instance-methods.html#afterupdate)
- [\$beforeInsert](/api/model/instance-methods.html#beforeinsert)
- [\$afterInsert](/api/model/instance-methods.html#afterinsert)
- [\$beforeDelete](/api/model/instance-methods.html#beforedelete)
- [\$afterDelete](/api/model/instance-methods.html#afterdelete)
- [\$afterFind](/api/model/instance-methods.html#afterfind)


================================================
FILE: doc/api/model/static-methods.md
================================================
# Static Methods

## `static` query()

```js
const queryBuilder = Person.query(transactionOrKnex);
```

Creates a query builder for the model's table.

All query builders are created using this function, including `$query`, `relatedQuery` and `$relatedQuery`. That means you can modify each query by overriding this method for your model class.

See the [query examples](/guide/query-examples.html) section for more examples.

#### Arguments

| Argument          | Type   | Description                                                                                                                                                         |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| transactionOrKnex | object | Optional transaction or knex instance for the query. This can be used to specify a transaction or even a different database. for a query. Falsy values are ignored. |

#### Return value

| Type                                | Description               |
| ----------------------------------- | ------------------------- |
| [QueryBuilder](/api/query-builder/) | The created query builder |

#### Examples

Read models from the database:

```js
// Get all rows.
const people = await Person.query();
console.log('there are', people.length, 'people in the database');

// Example of a more complex WHERE clause. This generates:
// SELECT "persons".*
// FROM "persons"
// WHERE ("firstName" = 'Jennifer' AND "age" < 30)
// OR ("firstName" = 'Mark' AND "age" > 30)
const marksAndJennifers = await Person.query()
  .where(builder => {
    builder.where('firstName', 'Jennifer').where('age', '<', 30);
  })
  .orWhere(builder => {
    builder.where('firstName', 'Mark').where('age', '>', 30);
  });

console.log(marksAndJennifers);

// Get a subset of rows and fetch related models
// for each row.
const oldPeople = await Person.query()
  .where('age', '>', 60)
  .withGraphFetched('children.children.movies');

console.log(
  "some old person's grand child has appeared in",
  oldPeople[0].children[0].children[0].movies.length,
  'movies'
);
```

Insert models to the database:

```js
const sylvester = await Person.query().insert({
  firstName: 'Sylvester',
  lastName: 'Stallone'
});

console.log(sylvester.fullName());
// --> 'Sylvester Stallone'.

// Batch insert. This only works on Postgresql as it is
// the only database that returns the identifiers of
// _all_ inserted rows. If you need to do batch inserts
// on other databases useknex* directly.
// (See .knexQuery() method).
const inserted = await Person.query().insert([
  { firstName: 'Arnold', lastName: 'Schwarzenegger' },
  { firstName: 'Sylvester', lastName: 'Stallone' }
]);

console.log(inserted[0].fullName()); // --> 'Arnold Schwarzenegger'
```

`update` and `patch` can be used to update models. Only difference between the mentioned methods is that `update` validates the input objects using the model class's full jsonSchema and `patch` ignores the `required` property of the schema. Use `update` when you want to update _all_ properties of a model and `patch` when only a subset should be updated.

```js
const numUpdatedRows = await Person.query()
  .update({ firstName: 'Jennifer', lastName: 'Lawrence', age: 35 })
  .where('id', jennifer.id);

console.log(numUpdatedRows);

// This will throw assuming that `firstName` or `lastName`
// is a required property for a Person.
await Person.query().update({ age: 100 });

// This will _not_ throw.
await Person.query().patch({ age: 100 });

console.log('Everyone is now 100 years old');
```

Models can be deleted using the delete method. Naturally the delete query can be chained with any knex\* methods:

```js
await Person.query()
  .delete()
  .where('age', '>', 90);

console.log('anyone over 90 is now removed from the database');
```

## `static` relatedQuery()

```js
const queryBuilder = Person.relatedQuery(relationName, transactionOrKnex);
```

Creates a query builder that can be used to query a relation of an item (or items).

This method is best explained through examples. See the examples below and the following sections:

- [relation queries](/guide/query-examples.html#relation-queries)
- [relation subqueries recipe](/recipes/relation-subqueries.html)

##### Arguments

| Argument          | Type   | Description                                                                                                                                                        |
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| relationName      | string | The name of the relation to query.                                                                                                                                 |
| transactionOrKnex | object | Optional transaction or knex instance for the query. This can be used to specify a transaction or even a different database for a query. Falsy values are ignored. |

##### Return value

| Type                                | Description               |
| ----------------------------------- | ------------------------- |
| [QueryBuilder](/api/query-builder/) | The created query builder |

##### Examples

This example fetches `pets` for a person with id 1. `pets` is the name of the relation defined in [relationMappings](/api/model/static-properties.html#static-relationmappings).

```js
const personId = 1;
const pets = await Person.relatedQuery('pets').for(personId);
```

```sql
select "animals".* from "animals"
where "animals"."ownerId" = 1
```

Just like to any query, you can chain any methods. The following example only fetches dogs and sorts them by name:

```js
const dogs = await Person.relatedQuery('pets')
  .for(1)
  .where('species', 'dog')
  .orderBy('name');
```

```sql
select "animals".* from "animals"
where "species" = 'dog'
and "animals"."ownerId" = 1
order by "name" asc
```

If you want to fetch dogs of multiple people in one query, you can pass an array of identifiers to the [for](/api/query-builder/other-methods.html#for) method like this:

```js
const dogs = await Person.relatedQuery('pets')
  .for([1, 2])
  .where('species', 'dog')
  .orderBy('name');
```

```sql
select "animals".* from "animals"
where "species" = 'dog'
and "animals"."ownerId" in (1, 2)
order by "name" asc
```

You can even give it a subquery! The following example fetches all dogs of all people named Jennifer.

```js
// Note that there is no `await` here. This query does not get executed.
const jennifers = Person.query().where('name', 'Jennifer');

// This is the only executed query in this example.
const allDogsOfAllJennifers = await Person.relatedQuery('pets')
  .for(jennifers)
  .where('species', 'dog')
  .orderBy('name');
```

```sql
select "animals".* from "animals"
where "species" = 'dog'
and "animals"."ownerId" in (
  select "persons"."id"
  from "persons"
  where "name" = 'Jennifer'
)
order by "name" asc
```

`relatedQuery` also works with `relate` , `unrelate`, `delete` and all other query methods. The following example relates a person with id 100 to a movie with id 200 for the many-to-many relation `movies`:

```js
await Person.relatedQuery('movies')
  .for(100)
  .relate(200);
```

```sql
insert into "persons_movies" ("personId", "movieId") values (100, 200)
```

See more examples [here](/guide/query-examples.html#relation-queries).

`relatedQuery` can also be used as a subquery when `for` is omitted. The next example selects the count of a relation and the maximum value of another one:

```js
const people = await Person.query().select([
  'persons.*',

  Person.relatedQuery('pets')
    .count()
    .where('species', 'dog')
    .as('dogCount'),

  Person.relatedQuery('movies')
    .max('createdAt')
    .as('mostRecentMovieDate')
]);

console.log(people[0].id);
console.log(people[0].dogCount);
console.log(people[0].mostRecentMovieDate);
```

Find models that have at least one item in a relation:

```js
const peopleThatHavePets = await Person.query().whereExists(
  Person.relatedQuery('pets')
);
```

Generates something like this:

```sql
select "persons".*
from "persons"
where exists (
  select "pets".*
  from "animals" as "pets"
  where "pets"."ownerId" = "persons"."id"
)
```

## `static` knex()

Get/Set the knex instance for a model class.

Subclasses inherit the connection. A system-wide knex instance can thus be set by calling `objection.Model.knex(knex)`. This works even after subclasses have been created.

If you want to use multiple databases, you can instead pass the knex instance to each individual query or use the [bindKnex](/api/model/static-methods.html#static-bindknex) method.

##### Examples

Set a knex instance:

```js
const knex = require('knex')({
  client: 'sqlite3',
  connection: {
    filename: 'database.db'
  }
});

Model.knex(knex);
```

Get the knex instance:

```js
const knex = Person.knex();
```

## `static` transaction()

```js
const result = await Person.transaction(callback);
const result = await Person.transaction(trxOrKnex, callback);
```

Shortcut for `Person.knex().transaction(callback)`.

See the [transaction guide](/guide/transactions.html).

##### Arguments

| Argument  | Type               | Description                                     |
| --------- | ------------------ | ----------------------------------------------- |
| callback  | function           |
| trxOrKnex | knex or Transation | Optional existing transaction or knex instance. |

##### Examples

```js
try {
  const scrappy = await Person.transaction(async trx => {
    const jennifer = await Person.query(trx).insert({
      firstName: 'Jennifer',
      lastName: 'Lawrence'
    });

    const scrappy = await jennifer
      .$relatedQuery('pets', trx)
      .insert({ name: 'Scrappy' });

    return scrappy;
  });

  console.log('Great success! Both Jennifer and Scrappy were inserted');
} catch (err) {
  console.log(
    'Something went wrong. Neither Jennifer nor Scrappy were inserted'
  );
}
```

## `static` startTransaction()

```js
const trx = await Person.startTransaction(trxOrKnex);
```

Shortcut for `objection.transaction.start(Model1.knex())`.

See the [transaction guide](/guide/transactions.html).

##### Arguments

| Argument  | Type               | Description                                     |
| --------- | ------------------ | ----------------------------------------------- |
| trxOrKnex | knex or Transation | Optional existing transaction or knex instance. |

##### Examples

```js
const trx = await Person.startTransaction();

try {
  await Person.query(trx).insert(person1);
  await Person.query(trx).insert(person2);
  await Person.query(trx)
    .patch(person3)
    .where('id', person3.id);
  await trx.commit();
} catch (err) {
  await trx.rollback();
  throw err;
}
```

## `static` beforeFind()

```js
class Person extends Model {
  static beforeFind(args) {}
}
```

A hook that is executed before find queries.

See these sections for more information:

- [static hooks guide](/guide/hooks.html#static-query-hooks)
- [documentation for the arguments](/api/types/#type-statichookarguments)

##### Arguments

| Argument | Type                                                        | Description   |
| -------- | ----------------------------------------------------------- | ------------- |
| args     | [StaticHookArguments](/api/types/#type-statichookarguments) | The arguments |

##### Return value

| Type | Description                   |
| ---- | ----------------------------- |
| any  | The return value is not used. |

## `static` afterFind()

```js
class Person extends Model {
  static afterFind(args) {}
}
```

A hook that is executed after find queries.

See these sections for more information:

- [static hooks guide](/guide/hooks.html#static-query-hooks)
- [documentation for the arguments](/api/types/#type-statichookarguments)

##### Arguments

| Argument | Type                                                        | Description   |
| -------- | ----------------------------------------------------------- | ------------- |
| args     | [StaticHookArguments](/api/types/#type-statichookarguments) | The arguments |

##### Return value

| Type | Description                                                                               |
| ---- | ----------------------------------------------------------------------------------------- |
| any  | If the return value is not `undefined`, it will be used as the return value of the query. |

## `static` beforeUpdate()

```js
class Person extends Model {
  static beforeUpdate(args) {}
}
```

A hook that is executed before update and patch queries.

See these sections for more information:

- [static hooks guide](/guide/hooks.html#static-query-hooks)
- [documentation for the arguments](/api/types/#type-statichookarguments)

##### Arguments

| Argument | Type                                                        | Description   |
| -------- | ----------------------------------------------------------- | ------------- |
| args     | [StaticHookArguments](/api/types/#type-statichookarguments) | The arguments |

##### Return value

| Type | Description                   |
| ---- | ----------------------------- |
| any  | The return value is not used. |

## `static` afterUpdate()

```js
class Person extends Model {
  static afterUpdate(args) {}
}
```

A hook that is executed after update and patch queries.

See these sections for more information:

- [static hooks guide](/guide/hooks.html#static-query-hooks)
- [documentation for the arguments](/api/types/#type-statichookarguments)

##### Arguments

| Argument | Type                                                        | Description   |
| -------- | ----------------------------------------------------------- | ------------- |
| args     | [StaticHookArguments](/api/types/#type-statichookarguments) | The arguments |

##### Return value

| Type | Description                                                                               |
| ---- | ----------------------------------------------------------------------------------------- |
| any  | If the return value is not `undefined`, it will be used as the return value of the query. |

## `static` beforeInsert()

```js
class Person extends Model {
  static beforeInsert(args) {}
}
```

A hook that is executed before insert queries.

See these sections for more information:

- [static hooks guide](/guide/hooks.html#static-query-hooks)
- [documentation for the arguments](/api/types/#type-statichookarguments)

##### Arguments

| Argument | Type                                                        | Description   |
| -------- | ----------------------------------------------------------- | ------------- |
| args     | [StaticHookArguments](/api/types/#type-statichookarguments) | The arguments |

##### Return value

| Type | Description                   |
| ---- | ----------------------------- |
| any  | The return value is not used. |

## `static` afterInsert()

```js
class Person extends Model {
  static afterInsert(args) {}
}
```

A hook that is executed after insert queries.

See these sections for more information:

- [static hooks guide](/guide/hooks.html#static-query-hooks)
- [documentation for the arguments](/api/types/#type-statichookarguments)

##### Arguments

| Argument | Type                                                        | Description   |
| -------- | ----------------------------------------------------------- | ------------- |
| args     | [StaticHookArguments](/api/types/#type-statichookarguments) | The arguments |

##### Return value

| Type | Description                                                                               |
| ---- | ----------------------------------------------------------------------------------------- |
| any  | If the return value is not `undefined`, it will be used as the return value of the query. |

## `static` beforeDelete()

```js
class Person extends Model {
  static beforeDelete(args) {}
}
```

A hook that is executed before delete queries.

See these sections for more information:

- [static hooks guide](/guide/hooks.html#static-query-hooks)
- [documentation for the arguments](/api/types/#type-statichookarguments)

##### Arguments

| Argument | Type                                                        | Description   |
| -------- | ----------------------------------------------------------- | ------------- |
| args     | [StaticHookArguments](/api/types/#type-statichookarguments) | The arguments |

##### Return value

| Type | Description                   |
| ---- | ----------------------------- |
| any  | The return value is not used. |

## `static` afterDelete()

```js
class Person extends Model {
  static afterDelete(args) {}
}
```

A hook that is executed after delete queries.

See these sections for more information:

- [static hooks guide](/guide/hooks.html#static-query-hooks)
- [documentation for the arguments](/api/types/#type-statichookarguments)

##### Arguments

| Argument | Type                                                        | Description   |
| -------- | ----------------------------------------------------------- | ------------- |
| args     | [StaticHookArguments](/api/types/#type-statichookarguments) | The arguments |

##### Return value

| Type | Description                                                                               |
| ---- | ----------------------------------------------------------------------------------------- |
| any  | If the return value is not `undefined`, it will be used as the return value of the query. |

## `static` bindKnex()

```js
const BoundPerson = Person.bindKnex(transactionOrKnex);
```

Creates an anonymous model subclass class that is bound to the given knex instance or transaction.

This method can be used to bind a Model subclass to multiple databases for example in a multi-tenant system. See the [multi tenancy recipe](/recipes/multitenancy-using-multiple-databases.html) for more info.

Also check out the [model binding pattern for transactions](/guide/transactions.html#binding-models-to-a-transaction) which internally uses `bindKnex`.

##### Arguments

| Argument          | Type   | Description                                          |
| ----------------- | ------ | ---------------------------------------------------- |
| transactionOrKnex | object | knex instance or a transaction to bind the model to. |

##### Return value

| Type                         | Description                            |
| ---------------------------- | -------------------------------------- |
| Constructor<? extends Model> | The created model subclass constructor |

##### Examples

```js
const knex1 = require('knex')({
  client: 'sqlite3',
  connection: {
    filename: 'database1.db'
  }
});

const knex2 = require('knex')({
  client: 'sqlite3',
  connection: {
    filename: 'database2.db'
  }
});

SomeModel.knex(null);

const BoundModel1 = SomeModel.bindKnex(knex1);
const BoundModel2 = SomeModel.bindKnex(knex2);

// Throws since the knex instance is null.
await SomeModel.query();

// Works.
const models = await BoundModel1.query();

console.log(models[0] instanceof SomeModel); // --> true
console.log(models[0] instanceof BoundModel1); // --> true

// Works.
const models = await BoundModel2.query();

console.log(models[0] instanceof SomeModel); // --> true
console.log(models[0] instanceof BoundModel2); // --> true
```

## `static` bindTransaction()

Alias for [bindKnex](/api/model/static-methods.html#static-bindknex).

##### Examples

```js
const { transaction } = require('objection');
const Person = require('./models/Person');

await transaction(Person.knex(), async trx => {
  const TransactingPerson = Person.bindTransaction(trx);

  await TransactingPerson.query().insert({ firstName: 'Jennifer' });

  return TransactingPerson.query()
    .patch({ lastName: 'Lawrence' })
    .where('id', jennifer.id);
});
```

This is 100% equivalent to the example above:

```js
const { transaction } = require('objection');
const Person = require('./models/Person');

await transaction(Person, async TransactingPerson => {
  await TransactingPerson.query().insert({ firstName: 'Jennifer' });

  return TransactingPerson.query()
    .patch({ lastName: 'Lawrence' })
    .where('id', jennifer.id);
});
```

## `static` fromJson()

```js
const person = Person.fromJson(json, opt);
```

Creates a model instance from a POJO (Plain Old Javascript Object).

The object is checked against [jsonSchema](/api/model/static-properties.html#static-jsonschema) if a schema is provided and an exception is thrown on failure.

The `json` object is also passed through the [\$parseJson](/api/model/instance-methods.html#parsejson) hook before the model instance is created. See [this section](/api/model/overview.html#model-data-lifecycle) for more info.

##### Arguments

| Argument | Type                                          | Description                                     |
| -------- | --------------------------------------------- | ----------------------------------------------- |
| json     | Object                                        | The JSON object from which to create the model. |
| opt      | [ModelOptions](/api/types/#type-modeloptions) | Update options.                                 |

##### Return value

| Type                 | Description                |
| -------------------- | -------------------------- |
| [Model](/api/model/) | The created model instance |

##### Examples

Create a model instance:

```js
const jennifer = Person.fromJson({ firstName: 'Jennifer' });
```

Create a model instance skipping validation:

```js
const jennifer = Person.fromJson(
  { firstName: 'Jennifer' },
  { skipValidation: true }
);
```

## `static` fromDatabaseJson()

```js
const person = Person.fromDatabaseJson(row);
```

Creates a model instance from a JSON object send by the database driver.

Unlike [fromJson](/api/model/static-methods.html#static-fromjson), this method doesn't validate the input. The input is expected to be in the database format as explained [here](/api/model/overview.html#model-data-lifecycle).

##### Arguments

| Argument | Type   | Description     |
| -------- | ------ | --------------- |
| row      | Object | A database row. |

##### Return value

| Type                 | Description                |
| -------------------- | -------------------------- |
| [Model](/api/model/) | The created model instance |

## `static` modifierNotFound()

```js
class BaseModel extends Model {
  static modifierNotFound(builder, modifier) {
    const { properties } = this.jsonSchema;
    if (properties && modifier in properties) {
      builder.select(modifier);
    } else {
      super.modifierNotFound(builder, modifier);
    }
  }
}
```

This method is called when an unknown modifier is used somewhere.

By default, the static `modifierNotFound()` hook throws a `ModifierNotFoundError` error. If a model class overrides the hook, it can decide to handle the modifer through the passed `builder` instance, or call the hook's definition in the super class to still throw the error.

##### Arguments

| Argument | Type                                | Description                                       |
| -------- | ----------------------------------- | ------------------------------------------------- |
| builder  | [QueryBuilder](/api/query-builder/) | The query builder on which to apply the modifier. |
| modifier | string                              | The name of the unknown modifier.                 |

## `static` createValidator()

```js
class BaseModel extends Model {
  static createValidator() {
    return new MyCustomValidator();
  }
}
```

Creates an instance of a [Validator](/api/types/#class-validator) that is used to do all validation related stuff. This method is called only once per model class.

You can override this method to return an instance of your custom validator. The custom validator doesn't need to be based on the `jsonSchema`. It can be anything at all as long as it implements the [Validator](/api/types/#class-validator) interface.

If you want to use the default json schema based [AjvValidator](/api/types/#class-ajvvalidator) but want to modify it, you can use the `objection.AjvValidator` constructor. See the default implementation example.

If you want to share the same validator instance between multiple models, that's completely fine too. Simply implement `createValidator` so that it always returns the same object instead of creating a new one.

##### Examples

Sharing the same validator between model classes is also possible:

```js
const validator = new MyCustomValidator();

class BaseModel extends Model {
  static createValidator() {
    return validator;
  }
}
```

The default implementation:

```js
const AjvValidator = require('objection').AjvValidator;

class Model {
  static createValidator() {
    return new AjvValidator({
      onCreateAjv: ajv => {
        // Here you can modify the `Ajv` instance.
      },
      options: {
        allErrors: true,
        validateSchema: false,
        ownProperties: true,
        v5: true
      }
    });
  }
}
```

## `static` createNotFoundError()

```js
class BaseModel extends Model {
  static createNotFoundError(queryContext, props) {
    return new MyCustomNotFoundError({ ...props, modelClass: this });
  }
}
```

Creates an error thrown by [throwIfNotFound](/api/query-builder/other-methods.html#throwifnotfound) method. You can override this
to throw any error you want.

##### Arguments

| Argument     | Type   | Description                                                                                                               |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| queryContext | Object | The context object of query that produced the empty result. See [context](/api/query-builder/other-methods.html#context). |
| props        | any    | Data passed to the error class constructor.

##### Return value

| Type    | Description                                                                     |
| ------- | ------------------------------------------------------------------------------- |
| `Error` | The created error. [NotFoundError](/api/types/#class-notfounderror) by default. |

##### Examples

The default implementation:

```js
class Model {
  static createNotFoundError(queryContext, props) {
    return new this.NotFoundError({ ...props, modelClass: this });
  }
}
```

## `static` createValidationError()

```js
class BaseModel extends Model {
  static createValidationError({ type, message, data }) {
    return new MyCustomValidationError({ type, message, data, modelClass: this });
  }
}
```

Creates an error thrown when validation fails for a model. You can override this to throw any error you want. The errors created by this function don't have to implement any interface or have the same properties as `ValidationError`. Objection only throws errors created by this function an never catches them.

##### Return value

| Type    | Description                                                                         |
| ------- | ----------------------------------------------------------------------------------- |
| `Error` | The created error. [ValidationError](/api/types/#class-validationerror) by default. |

## `static` fetchGraph()

```js
const queryBuilder = Person.fetchGraph(models, expression, options);
```

Load related models for a set of models using a [RelationExpression](/api/types/#type-relationexpression).

##### Arguments

| Argument   | Type                                                                  | Description                                                                                                                                     |
| ---------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| models     | Array&lt;[Model](/api/model/)&#124;Object&gt;                         | Model instances for which to fetch the relations. Can be an array of model instances, array of POJOs, a single model instance or a single POJO. |
| expression | string&#124;[RelationExpression](/api/types/#type-relationexpression) | The relation expression                                                                                                                         |
| options    | [FetchGraphOptions](/api/types/#type-fetchgraphoptions)               | Optional options.                                                                                                                               |

##### Return value

| Type                                | Description               |
| ----------------------------------- | ------------------------- |
| [QueryBuilder](/api/query-builder/) | The created query builder |

##### Examples

```js
const people = await Person.fetchGraph([person1, person2], 'children.pets');

const person1 = people[0];
const person2 = people[1];
```

Relations can be filtered by giving modifier functions as arguments for the relations:

```js
const people = await Person.fetchGraph(
  [person1, person2],
  `
    children(orderByAge).[
      pets(onlyDogs, orderByName),
      movies
    ]
  `
).modifiers({
  orderByAge(builder) {
    builder.orderBy('age');
  },

  orderByName(builder) {
    builder.orderBy('name');
  },

  onlyDogs(builder) {
    builder.where('species', 'dog');
  }
});

console.log(people[1].children.pets[0]);
```

## `static` traverseAsync()

Traverses the relation tree of a model instance (or a list of model instances).

Calls the callback for each related model recursively. The callback is called also for the input models themselves.

In the second example the traverser function is only called for `Person` instances.

##### Arguments

| Argument          | Type                                             | Description                                                                                                                                                                                                                                 |
| ----------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filterConstructor | function                                         | If this optional constructor is given, the `traverser` is only called for models for which `model instanceof filterConstructor` returns `true`.                                                                                               |
| models            | [Model](/api/model/)&#124;[Model](/api/model/)[] | The model(s) whose relation trees to traverse.                                                                                                                                                                                              |
| traverser         | function([Model](/api/model/), string, string)   | The traverser function that is called for each model. The first argument is the model itself. If the model is in a relation of some other model the second argument is the parent model and the third argument is the name of the relation. |

##### Examples

There are two ways to call this method:

```js
const models = await SomeModel.query();

await Model.traverseAsync(models, async (model, parentModel, relationName) => {
  await doSomething(model);
});
```

and

```js
const persons = await Person.query();

Model.traverseAsync(
  Person,
  persons,
  async (person, parentModel, relationName) => {
    await doSomethingWithPerson(person);
  }
);
```

Also works with a single model instance

```js
const person = await Person.query();

await Person.traverseAsync(person, async (model, parentModel, relationName) => {
  await doSomething(model);
});
```

## `static` getRelations()

```js
const relations = Person.getRelations();
```

Returns a [Relation](/api/types/#class-relation) object for each relation defined in [relationMappings](/api/model/static-properties.html#static-relationmappings).

This method is mainly useful for plugin developers and for other generic usages.

##### Return value

| Type                                                              | Description                                                                                           |
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| Object&lt;string,&nbsp;[Relation](/api/types/#class-relation)&gt; | Object whose keys are relation names and values are [Relation](/api/types/#class-relation) instances. |

## `static` columnNameToPropertyName()

```js
const propertyName = Person.columnNameToPropertyName(columnName);
```

Runs the property through possible `columnNameMappers` and `$parseDatabaseJson` hooks to apply any possible conversion for the column name.

##### Arguments

| Argument   | Type   | Description   |
| ---------- | ------ | ------------- |
| columnName | string | A column name |

##### Return value

| Type   | Description       |
| ------ | ----------------- |
| string | The property name |

##### Examples

If you have defined `columnNameMappers = snakeCaseMappers()` for your model:

```js
const propName = Person.columnNameToPropertyName('foo_bar');
console.log(propName); // --> 'fooBar'
```

## `static` propertyNameToColumnName()

```js
const columnName = Person.propertyNameToColumnName(propertyName);
```

Runs the property through possible `columnNameMappers` and `$formatDatabaseJson` hooks to apply any possible conversion for the property name.

##### Arguments

| Argument     | Type   | Description     |
| ------------ | ------ | --------------- |
| propertyName | string | A property name |

##### Return value

| Type   | Description     |
| ------ | --------------- |
| string | The column name |

##### Examples

If you have defined `columnNameMappers = snakeCaseMappers()` for your model:

```js
const columnName = Person.propertyNameToColumnName('fooBar');
console.log(columnName); // --> 'foo_bar'
```

## `static` fetchTableMetadata()

```js
const metadata = await Person.fetchTableMetadata(opt);
```

Fetches and caches the table metadata.

Most of the time objection doesn't need this metadata, but some methods like [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) do. This method is called by objection when the metadata is needed. The result is cached and after the first call the cached promise is returned and no queries are executed.

Because objection uses this on demand, the first query that needs this information can have unpredicable performance. If that's a problem, you can call this method for each of your models during your app's startup.

If you've implemented [tableMetadata](/api/model/static-methods.html#static-tablemetadata) method to return a custom metadata object, this method doesn't execute database queries, but returns `Promise.resolve(this.tableMetadata())` instead.

##### Arguments

| Argument | Type                                                                    | Description      |
| -------- | ----------------------------------------------------------------------- | ---------------- |
| opt      | [TableMetadataFetchOptions](/api/types/#type-tablemetadatafetchoptions) | Optional options |

##### Return value

| Type                                                           | Description               |
| -------------------------------------------------------------- | ------------------------- |
| Promise&lt;[TableMetadata](/api/types/#type-tablemetadata)&gt; | The table metadata object |

## `static` tableMetadata()

```js
const metadata = Person.tableMetadata(opt);
```

Synchronously returns the table metadata object from the cache.

You can override this method to return a custom object if you don't want objection to use
[fetchTableMetadata](/api/model/static-methods.html#static-fetchtablemetadata).

See [fetchTableMetadata](/api/model/static-methods.html#static-fetchtablemetadata) for more information.

##### Arguments

| Argument | Type                                                          | Description      |
| -------- | ------------------------------------------------------------- | ---------------- |
| opt      | [TableMetadataOptions](/api/types/#type-tablemetadataoptions) | Optional options |

##### Return value

| Type                                            | Description               |
| ----------------------------------------------- | ------------------------- |
| [TableMetadata](/api/types/#type-tablemetadata) | The table metadata object |

##### Examples

A custom override that uses the property information in `jsonSchema`.

```js
class Person extends Model {
  static tableMetadata() {
    return {
      columns: Object.keys(this.jsonSchema.properties)
    };
  }
}
```

## `static` raw()

Shortcut for `Person.knex().raw(...args)`

## `static` ref()

Returns a [ReferenceBuilder](/api/types/#class-referencebuilder) instance that is bound to the model class. Any reference created using it will add the correct table name to the reference.

```js
const { ref } = Person;
await Person.query().where(ref('firstName'), 'Jennifer');
```

```sql
select "persons".* from "persons" where "persons"."firstName" = 'Jennifer'
```

`ref` uses the correct table name even when an alias has been given to the table.

```js
const { ref } = Person;
await Person.query()
  .alias('p')
  .where(ref('firstName'), 'Jennifer');
```

```sql
select "p".* from "persons" as "p" where "p"."firstName" = 'Jennifer'
```

Note that the following two ways to use `Model.ref` are completely equivalent:

```js
const { ref } = Person;
await Person.query().where(ref('firstName'), 'Jennifer');
```

```js
await Person.query().where(Person.ref('firstName'), 'Jennifer');
```

## `static` fn()

Shortcut for `Person.knex().fn`

## `static` knexQuery()

Shortcut for `Person.knex().table(Person.tableName)`


================================================
FILE: doc/api/model/static-properties.md
================================================
# Static Properties

## `static` tableName

```js
class Person extends Model {
  static get tableName() {
    return 'persons';
  }
}
```

Name of the database table for this model.

Each model must set this.

## `static` relationMappings

This property defines the relations (relationships, associations) to other models.

`relationMappings` is an object (or a function/getter that returns an object) whose keys are relation names and values are [RelationMapping](/api/types/#type-relationmapping) instances. The `join` property in addition to the relation type define how the models are related to one another.

The `from` and `to` properties of the `join` object define the database columns through which the models are associated. Note that neither of these columns need to be primary keys. They can be any columns. In fact they can even be fields inside JSON columns (using the [ref](/api/objection/#ref) helper). In the case of ManyToManyRelation also the join table needs to be defined. This is done using the `through` object.

The `modelClass` passed to the relation mappings is the class of the related model. It can be one of the following:

1. A model class constructor
2. An absolute path to a module that exports a model class
3. A path relative to one of the paths in [modelPaths](/api/model/static-properties.html#static-modelpaths) array.

The file path versions are handy for avoiding require loops.

Further reading:

- [the relation guide](/guide/relations.html)
- [RelationMapping](/api/types/#type-relationmapping)

##### Examples

```js
const { Model, ref } = require('objection');

class Person extends Model {
  static get tableName() {
    return 'persons';
  }

  static get relationMappings() {
    return {
      pets: {
        relation: Model.HasManyRelation,
        modelClass: Animal,
        join: {
          from: 'persons.id',
          to: 'animals.ownerId'

          // Any of the `to` and `from` fields can also be
          // references to nested fields (or arrays of references).
          // Here the relation is created between `persons.id` and
          // `animals.json.details.ownerId` properties. The reference
          // must be cast to the same type as the other key.
          //
          // to: ref('animals.json:details.ownerId').castInt()
        }
      },

      father: {
        relation: Model.BelongsToOneRelation,
        modelClass: Person,
        join: {
          from: 'persons.fatherId',
          to: 'persons.id'
        }
      },

      movies: {
        relation: Model.ManyToManyRelation,
        modelClass: Movie,
        join: {
          from: 'persons.id',
          through: {
            from: 'persons_movies.actorId',
            to: 'persons_movies.movieId'

            // If you have a model class for the join table
            // you can specify it like this:
            //
            // modelClass: PersonMovie,

            // Columns listed here are automatically joined
            // to the related models on read and written to
            // the join table instead of the related table
            // on insert/update.
            //
            // extra: ['someExtra']
          },
          to: 'movies.id'
        }
      }
    };
  }
}
```

## `static` idColumn

```js
class Person extends Model {
  static get idColumn() {
    return 'some_column_name';
  }
}
```

Name of the primary key column in the database table.

Composite id can be specified by giving an array of column names.

Defaults to 'id'.

You can return `null` in order to tell objection there is no primary key. This may be useful in models of join tables.

## `static` jsonSchema

```js
class Person extends Model {
  static get jsonSchema() {
    return {
      type: 'object',
      required: ['name'],
      properties: {
        id: { type: 'integer' },
        name: { type: 'string', minLength: 1, maxLength: 255 },
        age: { type: 'number' } // optional
      }
    };
  }
}
```

The optional schema against which the model is validated.

Must follow [JSON Schema](https://json-schema.org) specification. If unset, no validation is done.

##### Read more

- [\$validate](/api/model/instance-methods.html#validate)
- [jsonAttributes](/api/model/static-properties.html#static-jsonattributes)
- [custom validation recipe](/recipes/custom-validation.html)

##### Examples

```js
class Person extends Model {
  static get jsonSchema() {
    return {
      type: 'object',
      required: ['firstName', 'lastName'],

      properties: {
        id: { type: 'integer' },
        parentId: { type: ['integer', 'null'] },
        firstName: { type: 'string', minLength: 1, maxLength: 255 },
        lastName: { type: 'string', minLength: 1, maxLength: 255 },
        age: { type: 'number' },

        // Properties defined as objects or arrays are
        // automatically converted to JSON strings when
        // writing to database and back to objects and arrays
        // when reading from database. To override this
        // behaviour, you can override the
        // Person.jsonAttributes property.
        address: {
          type: 'object',
          properties: {
            street: { type: 'string' },
            city: { type: 'string' },
            zipCode: { type: 'string' }
          }
        }
      }
    };
  }
}
```

## `static` virtualAttributes

```js
class Person extends Model {
  static get virtualAttributes() {
    return ['fullName', 'isFemale'];
  }

  fullName() {
    return `${this.firstName} ${this.lastName}`;
  }

  get isFemale() {
    return this.gender === 'female';
  }
}
```

Getters and methods listed here are serialized with real properties when [toJSON](/api/model/instance-methods.html#tojson) is called. Virtual attribute methods and getters must be synchronous.

The virtual values are not written to database. Only the "external" JSON format will contain them.

##### Examples

```js
class Person extends Model {
  static get virtualAttributes() {
    return ['fullName', 'isFemale'];
  }

  fullName() {
    return `${this.firstName} ${this.lastName}`;
  }

  get isFemale() {
    return this.gender === 'female';
  }
}

const person = Person.fromJson({
  firstName: 'Jennifer',
  lastName: 'Aniston',
  gender: 'female'
});

// Note that `toJSON` is always called automatically
// when an object is serialized to a JSON string using
// JSON.stringify. You very rarely need to call `toJSON`
// explicitly. koa, express and all other frameworks I'm
// aware of use JSON.stringify to serialize objects to JSON.
const pojo = person.toJSON();

console.log(pojo.fullName); // --> 'Jennifer Aniston'
console.log(pojo.isFemale); // --> true
```

You can also pass options to [toJSON](/api/model/instance-methods.html#tojson) to only serialize a subset of virtual attributes. In fact, when the `virtuals` option is used, the attributes don't even need to be listed in `virtualAttributes`.

```js
const pojo = person.toJSON({ virtuals: ['fullName'] });
```

## `static` modifiers

Reusable query building functions that can be used in any query using [modify](/api/query-builder/other-methods.html#modify) method and in many other places.

Also see the [modifier recipe](/recipes/modifiers.html) for more info and examples.

```js
class Movie extends Model {
  static get modifiers() {
    return {
      goodMovies(builder) {
        builder.where('stars', '>', 3);
      },

      orderByName(builder) {
        builder.orderBy('name');
      }
    };
  }
}

class Animal extends Model {
  static get modifiers() {
    return {
      dogs(builder) {
        builder.where('species', 'dog');
      }
    };
  }
}
```

Modifiers can be used for relations in a `withGraphFetched` or `withGraphJoined` query.

```js
Person.query().withGraphFetched(
  '[movies(goodMovies, orderByName).actors, pets(dogs)]'
);
```

Modifiers can also be used through [modifyGraph](/api/query-builder/other-methods.html#modifygraph):

```js
Person.query()
  .withGraphFetched('[movies.actors, pets]')
  .modifyGraph('movies', ['goodMovies', 'orderByName'])
  .modifyGraph('pets', 'dogs');
```

## `static` modelPaths

```js
class Person extends Model {
  static get modelPaths() {
    return [__dirname];
  }
}
```

A list of paths from which to search for models for relations.

A model class can be defined for a relation in [relationMappings](/api/model/static-properties.html#static-relationmappings) as

1. A model class constructor
2. An absolute path to a module that exports a model class
3. A path relative to one of the paths in `modelPaths` array.

You probably don't want to define `modelPaths` property for each model. Once again we
recommend that you create a `BaseModel` super class for all your models and define
shared configuration such as this there.

##### Examples

Using a shared `BaseModel` superclass:

```js
const { Model } = require('objection');

// models/BaseModel.js
class BaseModel extends Model {
  static get modelPaths() {
    return [__dirname];
  }
}

module.exports = {
  BaseModel
};

// models/Person.js
const { BaseModel } = require('./BaseModel');

class Person extends BaseModel {
  ...
}
```

## `static` concurrency

```js
class Person extends Model {
  static get concurrency() {
    return 10;
  }
}
```

How many queries can be run concurrently per connection.

This doesn't limit the concurrency of the entire server. It only limits the number of concurrent queries that can be run on a single connection. By default knex connection pool size is 10, which means that the maximum number of concurrent queries started by objection is `Model.concurrency * 10`. You can also easily increase the knex pool size.

The default concurrency is 4 except for mssql, for which the default is 1. The mssql default is needed because of the buggy driver that only allows one query at a time per connection.

## `static` jsonAttributes

```js
class Person extends Model {
  static get jsonAttributes() {
    return ['someProp', 'someOtherProp'];
  }
}
```

Properties that should be saved to database as JSON strings.

The properties listed here are serialized to JSON strings upon insertion/update to the database and parsed back to objects when models are read from the database. Combined with the postgresql's json or jsonb data type, this is a powerful way of representing documents as single database rows.

If this property is left unset all properties declared as objects or arrays in the [jsonSchema](/api/model/static-properties.html#static-jsonschema) are implicitly added to this list.

## `static` cloneObjectAttributes

```js
class Person extends Model {
  static get cloneObjectAttributes() {
    return false;
  }
}
```

If `true` (the default) object attributes (for example jsonb columns) are cloned when `$toDatabaseJson`, `$toJson` or `toJSON` is called. If this is set to `false`, they are not cloned. Note that nested `Model` instances inside relations etc. are still effectively cloned, because `$toJson` is called for them recursively, but their jsonb columns, again,
are not :)

Usually you don't need to care about this setting, but if you have large object fields (for example large objects in jsonb columns) cloning the data can become slow and play a significant part in your server's performance. There's rarely a need to to clone this data, but since it has historically been copied, we cannot change the default behaviour
easily.

TLDR; Set this setting to `false` if you have large jsonb columns and you see that cloning that data takes a significant amount of time **when you profile the code**.

## `static` columnNameMappers

```js
const { Model, snakeCaseMappers } = require('objection');

class Person extends Model {
  static get columnNameMappers() {
    return snakeCaseMappers();
  }
}
```

The mappers to use to convert column names to property names in code.

Further reading:

- [snakeCaseMappers](/api/objection/#snakecasemappers)
- [snake_case to camelCase conversion recipe](/recipes/snake-case-to-camel-case-conversion.html)

##### Examples

If your columns are UPPER_SNAKE_CASE:

```js
const { Model, snakeCaseMappers } = require('objection');

class Person extends Model {
  static get columnNameMappers() {
    return snakeCaseMappers({ upperCase: true });
  }
}
```

The mapper signature:

```js
class Person extends Model {
  static columnNameMappers = {
    parse(obj) {
      // database --> code
    },

    format(obj) {
      // code --> database
    }
  };
}
```

## `static` uidProp

```js
class Person extends Model {
  static get uidProp() {
    return '#id';
  }
}
```

Name of the property used to store a temporary non-db identifier for the model.

NOTE: You cannot use any of the model's properties as `uidProp`. For example if your model has a property `id`, you cannot set `uidProp = 'id'`.

Defaults to '#id'.

## `static` uidRefProp

```js
class Person extends Model {
  static get uidRefProp() {
    return '#ref';
  }
}
```

Name of the property used to store a reference to a [uidProp](/api/model/static-properties.html#static-uidprop)

NOTE: You cannot use any of the model's properties as `uidRefProp`. For example if your model has a property `ref`, you cannot set `uidRefProp = 'ref'`.

Defaults to `'#ref'`.

## `static` dbRefProp

```js
class Person extends Model {
  static get dbRefProp() {
    return '#dbRef';
  }
}
```

Name of the property used to point to an existing database row from an `insertGraph` graph.

NOTE: You cannot use any of the model's properties as `dbRefProp`. For example if your model has a property `id`, you cannot set `dbRefProp = 'id'`.

Defaults to '#dbRef'.

## `static` propRefRegex

```js
class Person extends Model {
  static get propRefRegex() {
    return /#ref{([^\.]+)\.([^}]+)}/g;
  }
}
```

Regular expression for parsing a reference to a property.

Defaults to `/#ref{([^\.]+)\.([^}]+)}/g`.

## `static` pickJsonSchemaProperties

```js
class Person extends Model {
  static get pickJsonSchemaProperties() {
    return true;
  }
}
```

If this is `true` only properties in `jsonSchema` are picked when inserting or updating a row in the database.

Defaults to `false`.

## `static` defaultGraphOptions

```js
class Person extends Model {
  static get defaultGraphOptions() {
    return {
      minimize: true,
      separator: '->',
      aliases: {},
      maxBatchSize: 10000
    };
  }
}
```

Sets the default options for [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) and [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined). See the possible
fields [here](/api/types/#type-graphoptions).

Defaults to `{ minimize: false, separator: ':', aliases: {}, maxBatchSize: 10000 }`.

## `static` useLimitInFirst

```js
class Animal extends Model {
  static get useLimitInFirst() {
    return true;
  }
}
```

If `true`, `limit(1)` is added to the query when [first()](/api/query-builder/other-methods.html#first) is called. Defaults to `false` for legacy reasons.

## `static` QueryBuilder

```js
class Person extends Model {
  static get QueryBuilder() {
    return MyCustomQueryBuilder;
  }
}
```

[QueryBuilder](/api/query-builder/) subclass to use for all queries created for this model.

This constructor is used whenever a query builder is created using [query](/api/model/static-methods.html#static-query), [\$query](/api/model/instance-methods.html#query), [\$relatedQuery](/api/model/instance-methods.html#relatedquery) or any other method that creates a query. You can override this to use your own [QueryBuilder](/api/query-builder/) subclass.

[Usage example](/recipes/custom-query-builder.html).

## `static` BelongsToOneRelation

```js
class Person extends Model {
  static get relationMappings() {
    parent: {
      relation: Model.BelongsToOneRelation,
      ...
    }
  }
}
```

A relation type that can be used in [relationMappings](/api/model/static-properties.html#static-relationmappings) to create a belongs-to-one relationship. See [this section](/guide/relations.md) for more information about different relation types.

## `static` HasOneRelation

```js
class Person extends Model {
  static get relationMappings() {
    parent: {
      relation: Model.HasOneRelation,
      ...
    }
  }
}
```

A relation type that can be used in [relationMappings](/api/model/static-properties.html#static-relationmappings) to create a has-one relationship. See [this section](/guide/relations.md) for more information about different relation types.

## `static` HasManyRelation

```js
class Person extends Model {
  static get relationMappings() {
    pets: {
      relation: Model.HasManyRelation,
      ...
    }
  }
}
```

A relation type that can be used in [relationMappings](/api/model/static-properties.html#static-relationmappings) to create a has-many relationship. See [this section](/guide/relations.md) for more information about different relation types.

## `static` ManyToManyRelation

```js
class Person extends Model {
  static get relationMappings() {
    movies: {
      relation: Model.ManyToManyRelation,
      ...
    }
  }
}
```

A relation type that can be used in [relationMappings](/api/model/static-properties.html#static-relationmappings) to create a many-to-many relationship. See [this section](/guide/relations.md) for more information about different relation types.

## `static` HasOneThroughRelation

```js
class Person extends Model {
  static get relationMappings() {
    favoriteMovie: {
      relation: Model.HasOneThroughRelation,
      ...
    }
  }
}
```

A relation type that can be used in [relationMappings](/api/model/static-properties.html#static-relationmappings) to create a has-one-through relationship. See [this section](/guide/relations.md) for more information about different relation types.


================================================
FILE: doc/api/objection/README.md
================================================
---
sidebar: auto
---

# `module` objection

```js
const objection = require('objection');
const { Model, ref } = require('objection');
```

The objection module is what you get when you import objection. It has a bunch of properties that are listed below.

## Model

```js
const { Model } = require('objection');
```

[The model class](/api/model/)

## initialize

```js
const { initialize } = require('objection');
```

For some queries objection needs to perform asynchronous operations in preparation, like fetch table metadata from the db. Objection does these preparations on-demand the first time such query is executed. However, some methods like `toKnexQuery` need these preparations to have been made so that the query can be built synchronously. In these cases you can use `initialize` to "warm up" the models and do all needed async preparations needed. You only need to call this function once if you choose to use it.

Calling this function is completely optional. If some method requires this to have been called, they will throw a clear error message asking you to do so. These cases are extremely rare, but this function is here for those cases.

You can also call this function if you want to be in control of when these async preparation operations get executed. It can be helpful for example in tests.

##### Examples

```js
const { initialize } = require('objection');

await initialize(knex, [Person, Movie, Pet, SomeOtherModelClass]);
```

If knex has been installed for the `Model` globally, you can omit the first argument.

```js
const { initialize } = require('objection');

await initialize([Person, Movie, Pet, SomeOtherModelClass]);
```

## transaction

```js
const { transaction } = require('objection');
```

[The transaction function](/guide/transactions.html)

## ref

```js
const { ref } = require('objection');
```

Factory function that returns a [ReferenceBuilder](/api/types/#class-referencebuilder) instance, that makes it easier to refer to tables, columns, json attributes etc. [ReferenceBuilder](/api/types/#class-referencebuilder) can also be used to type cast and alias the references.

See [FieldExpression](/api/types/#type-fieldexpression) for more information about how to refer to json fields.

##### Examples

```js
const { ref } = require('objection');

await Model.query()
  .select([
    'id',
    ref('Model.jsonColumn:details.name')
      .castText()
      .as('name'),
    ref('Model.jsonColumn:details.age')
      .castInt()
      .as('age')
  ])
  .join(
    'OtherModel',
    ref('Model.jsonColumn:details.name').castText(),
    '=',
    ref('OtherModel.name')
  )
  .where('age', '>', ref('OtherModel.ageLimit'));
```

`withGraphJoined` and `joinRelated` methods also use `:` as a separator which can lead to ambiquous queries when combined with json references. For example:

```
jsonColumn:details.name
```

Can mean two things:

1. column `name` of the relation `jsonColumn.details`
2. field `name` of the `details` object inside `jsonColumn` column

When used with `withGraphJoined` and `joinRelated` you can use the `from` method of the `ReferenceBuilder` to specify the table:

```js
await Person.query()
  .withGraphJoined('children.children')
  .where(ref('jsonColumn:details.name').from('children:children'), 'Jennifer');
```

## raw

```js
const { raw } = require('objection');
```

Factory function that returns a [RawBuilder](/api/types/#class-rawbuilder) instance. [RawBuilder](/api/types/#class-rawbuilder) is a wrapper for knex raw method that doesn't depend on knex. Instances of [RawBuilder](/api/types/#class-rawbuilder) are converted to knex raw instances lazily when the query is executed.

Also see [the raw query recipe](/recipes/raw-queries.html).

##### Examples

When using raw SQL segments in queries, it's a good idea to use placeholders instead of adding user input directly to the SQL to avoid injection errors. Placeholders are sent to the database engine which then takes care of interpolating the SQL safely.

You can use `??` as a placeholder for identifiers (column names, aliases etc.) and `?` for values.

```js
const { raw } = require('objection');

const result = await Person.query()
  .select(raw('coalesce(sum(??), 0) as ??', ['age', 'ageSum']))
  .where('age', '<', raw('? + ?', [50, 25]));

console.log(result[0].ageSum);
```

You can use `raw` in insert and update queries too:

```js
await Person.query().patch({
  age: raw('age + ?', 10)
});
```

You can also use named placeholders. `:someName:` for identifiers (column names, aliases etc.) and `:someName` for values.

```js
await Person.query()
  .select(
    raw('coalesce(sum(:sumColumn:), 0) as :alias:', {
      sumColumn: 'age',
      alias: 'ageSum'
    })
  )
  .where(
    'age',
    '<',
    raw(':value1 + :value2', {
      value1: 50,
      value2: 25
    })
  );
```

You can nest `ref`, `raw`, `val` and query builders (both knex and objection) in `raw` calls

```js
const { val } = require('objection')

await Person
  .query()
  .select(raw('coalesce(:sumQuery, 0) as :alias:', {
    sumQuery: Person.query().sum('age'),
    alias: 'ageSum'
  }))
  .where('age', '<', raw(':value1 + :value2', {
    value1: val(50)
    value2: knex.raw('25')
  }));
```

## val

```js
const { val } = require('objection');
```

Factory function that returns a [ValueBuilder](/api/types/#class-valuebuilder) instance. [ValueBuilder](/api/types/#class-valuebuilder) helps build values of different types.

##### Examples

```js
const { val, ref } = require('objection');

// Compare json objects
await Model.query().where(
  ref('Model.jsonColumn:details'),
  '=',
  val({ name: 'Jennifer', age: 29 })
);

// Insert an array.
await Model.query().insert({
  numbers: val([1, 2, 3])
    .asArray()
    .castTo('real[]')
});
```

## fn

```js
const { fn } = require('objection');
```

Factory function that returns a [FunctionBuilder](/api/types/#class-functionbuilder) instance. `fn` helps calling SQL functions. The signature is:

```js
const functionBuilder = fn(functionName, ...args);
```

For example:

```js
fn('coalesce', ref('age'), 0);
```

The `fn` function also has shortcuts for most common functions:

```js
fn.now();
fn.now(precision);
fn.coalesce(...args);
fn.concat(...args);
fn.sum(...args);
fn.avg(...args);
fn.min(...args);
fn.max(...args);
fn.count(...args);
fn.upper(...args);
fn.lower(...args);
```

All arguments are interpreted as values by default. Use `ref` to refer to columns. you can also pass `raw` instances, other `fn` instances, `QueryBuilders` knex builders, knex raw and anything else just like to any other objection method.

##### Examples

```js
const { fn, ref } = require('objection');

// Compare nullable numbers
await Model.query().where(fn('coalesce', ref('age'), 0), '>', 30);

// The same example using the fn.coalesce shortcut
await Model.query().where(fn.coalesce(ref('age'), 0), '>', 30);
```

Note that it can often be cleaner to use `raw` or `whereRaw`:

```js
await Model.query().whereRaw('coalesce(age, 0) > ?', 30);
```

## mixin

```js
const { mixin } = require('objection');
```

The mixin helper for applying multiple [plugins](/guide/plugins.html).

##### Examples

```js
const { mixin, Model } = require('objection');

class Person extends mixin(Model, [
  SomeMixin,
  SomeOtherMixin,
  EvenMoreMixins,
  LolSoManyMixins,
  ImAMixinWithOptions({ foo: 'bar' })
]) {}
```

## compose

```js
const { compose } = require('objection');
```

The compose helper for applying multiple [plugins](/guide/plugins.html).

##### Examples

```js
const { compose, Model } = require('objection');

const mixins = compose(
  SomeMixin,
  SomeOtherMixin,
  EvenMoreMixins,
  LolSoManyMixins,
  ImAMixinWithOptions({ foo: 'bar' })
);

class Person extends mixins(Model) {}
```

## snakeCaseMappers

```js
const { snakeCaseMappers } = require('objection');
```

Function for adding snake_case to camelCase conversion to objection models. Better documented [here](/recipes/snake-case-to-camel-case-conversion.html). The `snakeCaseMappers` function accepts an options object. The available options are:

| Option                            | Type    | Default | Description                                                                                                                                             |
| --------------------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| upperCase                         | boolean | `false` | Set to `true` if your columns are UPPER_SNAKE_CASED.                                                                                                    |
| underscoreBeforeDigits            | boolean | `false` | When `true`, will place an underscore before digits (`foo1Bar2` becomes `foo_1_bar_2`). When `false`, `foo1Bar2` becomes `foo1_bar2`.                   |
| underscoreBetweenUppercaseLetters | boolean | `false` | When `true`, will place underscores between consecutive uppercase letters (`fooBAR` becomes `foo_b_a_r`). When `false`, `fooBAR` will become `foo_bar`. |

##### Examples

```js
const { Model, snakeCaseMappers } = require('objection');

class Person extends Model {
  static get columnNameMappers() {
    return snakeCaseMappers();
  }
}
```

If your columns are UPPER_SNAKE_CASE

```js
const { Model, snakeCaseMappers } = require('objection');

class Person extends Model {
  static get columnNameMappers() {
    return snakeCaseMappers({ upperCase: true });
  }
}
```

## knexSnakeCaseMappers

```js
const { knexSnakeCaseMappers } = require('objection');
```

Function for adding a snake_case to camelCase conversion to `knex`. Better documented [here](/recipes/snake-case-to-camel-case-conversion.html). The `knexSnakeCaseMappers` function accepts an options object. The available options are:

| Option                            | Type    | Default | Description                                                                                                                                             |
| --------------------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| upperCase                         | boolean | `false` | Set to `true` if your columns are UPPER_SNAKE_CASED.                                                                                                    |
| underscoreBeforeDigits            | boolean | `false` | When `true`, will place an underscore before digits (`foo1Bar2` becomes `foo_1_bar_2`). When `false`, `foo1Bar2` becomes `foo1_bar2`.                   |
| underscoreBetweenUppercaseLetters | boolean | `false` | When `true`, will place underscores between consecutive uppercase letters (`fooBAR` becomes `foo_b_a_r`). When `false`, `fooBAR` will become `foo_bar`. |

##### Examples

```js
const { knexSnakeCaseMappers } = require('objection');
const Knex = require('knex');

const knex = Knex({
  client: 'postgres',

  connection: {
    host: '127.0.0.1',
    user: 'objection',
    database: 'objection_test'
  }

  ...knexSnakeCaseMappers()
});
```

If your columns are UPPER_SNAKE_CASE

```js
const { knexSnakeCaseMappers } = require('objection');
const Knex = require('knex');

const knex = Knex({
  client: 'postgres',

  connection: {
    host: '127.0.0.1',
    user: 'objection',
    database: 'objection_test'
  }

  ...knexSnakeCaseMappers({ upperCase: true })
});
```

For older nodes:

```js
const Knex = require('knex');
const knexSnakeCaseMappers = require('objection').knexSnakeCaseMappers;

const knex = Knex({
  client: 'postgres',

  connection: {
    host: '127.0.0.1',
    user: 'objection',
    database: 'objection_test'
  },

  ...knexSnakeCaseMappers()
});
```

## knexIdentifierMapping

```js
const { knexIdentifierMapping } = require('objection');
```

Like [knexSnakeCaseMappers](/api/objection/#knexsnakecasemappers), but can be used to make an arbitrary static mapping between column names and property names. In the examples, you would have identifiers `MyId`, `MyProp` and `MyAnotherProp` in the database and you would like to map them into `id`, `prop` and `anotherProp` in the code.

##### Examples

```js
const { knexIdentifierMapping } = require('objection');
const Knex = require('knex');

const knex = Knex({
  client: 'postgres',

  connection: {
    host: '127.0.0.1',
    user: 'objection',
    database: 'objection_test'
  }

  ...knexIdentifierMapping({
    MyId: 'id',
    MyProp: 'prop',
    MyAnotherProp: 'anotherProp'
  })
});
```

Note that you can pretty easily define the conversions in some static property of your model. In this example we have added a property `column` to jsonSchema and use that to create the mapping object.

```js
const { knexIdentifierMapping } = require('objection');
const Knex = require('knex');
const path = require('path')
const fs = require('fs');

// Path to your model folder.
const MODELS_PATH = path.join(__dirname, 'models');

const knex = Knex({
  client: 'postgres',

  connection: {
    host: '127.0.0.1',
    user: 'objection',
    database: 'objection_test'
  }

  // Go through all models and add conversions using the custom property
  // `column` in json schema.
  ...knexIdentifierMapping(fs.readdirSync(MODELS_PATH)
    .filter(it => it.endsWith('.js'))
    .map(it => require(path.join(MODELS_PATH, it)))
    .reduce((mapping, modelClass) => {
      const properties = modelClass.jsonSchema.properties;
      return Object.keys(properties).reduce((mapping, propName) => {
        mapping[properties[propName].column] = propName;
        return mapping;
      }, mapping);
    }, {});
  )
});
```

For older nodes:

```js
const Knex = require('knex');
const knexIdentifierMapping = require('objection').knexIdentifierMapping;

const knex = Knex({
  client: 'postgres',

  connection: {
    host: '127.0.0.1',
    user: 'objection',
    database: 'objection_test'
  },

  ...knexIdentifierMapping({
    MyId: 'id',
    MyProp: 'prop',
    MyAnotherProp: 'anotherProp'
  })
});
```

## ValidationError

```js
const { ValidationError } = require('objection');
```

The [ValidationError](/api/types/#class-validationerror) class.

## NotFoundError

```js
const { NotFoundError } = require('objection');
```

The [NotFoundError](/api/types/#class-notfounderror) class.

## DBError

```js
const { DBError } = require('objection');
```

The [DBError](https://github.com/Vincit/db-errors#dberror) from [db-errors](https://github.com/Vincit/db-errors) library.

## ConstraintViolationError

```js
const { ConstraintViolationError } = require('objection');
```

The [ConstraintViolationError](https://github.com/Vincit/db-errors#constraintviolationerror) from [db-errors](https://github.com/Vincit/db-errors) library.

## UniqueViolationError

```js
const { UniqueViolationError } = require('objection');
```

The [UniqueViolationError](https://github.com/Vincit/db-errors#uniqueviolationerror) from [db-errors](https://github.com/Vincit/db-errors) library.

## NotNullViolationError

```js
const { NotNullViolationError } = require('objection');
```

The [NotNullViolationError](https://github.com/Vincit/db-errors#notnullviolationerror) from [db-errors](https://github.com/Vincit/db-errors) library.

## ForeignKeyViolationError

```js
const { ForeignKeyViolationError } = require('objection');
```

The [ForeignKeyViolationError](https://github.com/Vincit/db-errors#foreignkeyviolationerror) from [db-errors](https://github.com/Vincit/db-errors) library.

## CheckViolationError

```js
const { CheckViolationError } = require('objection');
```

The [CheckViolationError](https://github.com/Vincit/db-errors#checkviolationerror) from [db-errors](https://github.com/Vincit/db-errors) library.

## DataError

```js
const { DataError } = require('objection');
```

The [DataError](https://github.com/Vincit/db-errors#dataerror) from [db-errors](https://github.com/Vincit/db-errors) library.


================================================
FILE: doc/api/query-builder/README.md
================================================
# `class` QueryBuilder

`QueryBuilder` is the most important component in objection. Every method that allows you to fetch or modify items in the database returns an instance of the `QueryBuilder`.

`QueryBuilder` is a wrapper around [knex QueryBuilder](https://knexjs.org/guide/query-builder.html). QueryBuilder has all the methods a knex QueryBuilder has and more. While knex QueryBuilder returns plain JavaScript objects, QueryBuilder returns Model subclass instances.

QueryBuilder is thenable, meaning that it can be used like a promise. You can `await` a query builder, and it will get executed. You can return query builder from a [then](/api/query-builder/other-methods.html#then) method of a promise and it gets chained just like a normal promise would.

See also

- [Custom query builder recipe](/recipes/custom-query-builder.html)


================================================
FILE: doc/api/query-builder/eager-methods.md
================================================
# Eager Loading Methods

## withGraphFetched()

```js
queryBuilder = queryBuilder.withGraphFetched(relationExpression, graphOptions);
```

Fetch a graph of related items for the result of any query (eager loading).

There are two methods that can be used to load relations eagerly: [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) and [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined). The main difference is that [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) uses multiple queries under the hood to fetch the result while [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) uses a single query and joins to fetch the results. Both methods allow you to do different things which we will go through in detail in the examples below and in the examples of the [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) method.

As mentioned, this method uses multiple queries to fetch the related objects. Objection performs one query per level in the relation expression tree. For example only two additional queries will be created for the expression `children.children` no matter how many children the item has or how many children each of the children have. This algorithm is explained in detail in [this blog post](https://www.vincit.fi/en/blog/nested-eager-loading-and-inserts-with-objection-js/) (note that `withGraphFetched` method used to be called `eager`).

**Limitations:**

- Relations cannot be referenced in the root query because they are not joined.
- `limit` and `page` methods will work incorrectly when applied to a relation using `modifyGraph` or `modifiers` because they will be applied on a query that fetches relations for multiple parents. You can use `limit` and `page` for the root query.

See the [eager loading](/guide/query-examples.html#eager-loading) section for more examples and [RelationExpression](/api/types/#type-relationexpression) for more info about the relation expression language.

See the [fetchGraph](/api/model/static-methods.html#static-fetchgraph) and [\$fetchGraph](/api/model/instance-methods.html#fetchgraph) methods if you want to load relations for items already loaded from the database.

**About performance:**

Note that while [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) sounds more performant than [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched), both methods have very similar performance in most cases and [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) is actually much much faster in some cases where the [relationExpression](/api/types/#type-relationexpression) contains multiple many-to-many or has-many relations. The flat record list the db returns for joins can have an incredible amount of duplicate information in some cases. Transferring + parsing that data from the db to node can be very costly, even though the actual joins in the db are very fast. You shouldn't select [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) blindly just because it sounds more peformant. The three rules of optimization apply here too: 1. Don't optimize 2. Don't optimize yet 3. Profile before optimizing. When you don't actually need joins, use [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched).

##### Arguments

| Argument           | Type                                                      | Description                                                  |
| ------------------ | --------------------------------------------------------- | ------------------------------------------------------------ |
| relationExpression | [RelationExpression](/api/types/#type-relationexpression) | The relation expression describing which relations to fetch. |
| options            | [GraphOptions](/api/types/#type-graphoptions)             | Optional options.                                            |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

Fetches all `Persons` named Arnold with all their pets. `'pets'` is the name of the relation defined in [relationMappings](/api/model/static-properties.html#static-relationmappings).

```js
const people = await Person.query()
  .where('firstName', 'Arnold')
  .withGraphFetched('pets');

console.log(people[0].pets[0].name);
```

Fetch `children` relation for each result Person and `pets` and `movies`
relations for all the children.

```js
const people = await Person.query().withGraphFetched('children.[pets, movies]');

console.log(people[0].children[0].pets[0].name);
console.log(people[0].children[0].movies[0].id);
```

[Relation expressions](/api/types/#relationexpression-object-notation) can also be objects. This is equivalent to the previous example:

```js
const people = await Person.query().withGraphFetched({
  children: {
    pets: true,
    movies: true
  }
});

console.log(people[0].children[0].pets[0].name);
console.log(people[0].children[0].movies[0].id);
```

Relation results can be filtered and modified by giving modifier function names as arguments for the relations:

```js
const people = await Person.query()
  .withGraphFetched(
    'children(selectNameAndId).[pets(onlyDogs, orderByName), movies]'
  )
  .modifiers({
    selectNameAndId(builder) {
      builder.select('name', 'id');
    },

    orderByName(builder) {
      builder.orderBy('name');
    },

    onlyDogs(builder) {
      builder.where('species', 'dog');
    }
  });

console.log(people[0].children[0].pets[0].name);
console.log(people[0].children[0].movies[0].id);
```

Reusable modifiers can be defined for a model class using [modifiers](/api/model/static-properties.html#static-modifiers). Also see the [modifiers recipe](/recipes/modifiers.md).

```js
class Person extends Model {
  static get modifiers() {
    return {
      // Note that this modifier takes an argument!
      filterGender(builder, gender) {
        builder.where('gender', gender);
      },

      defaultSelects(builder) {
        builder.select('id', 'firstName', 'lastName');
      },

      orderByAge(builder) {
        builder.orderBy('age');
      }
    };
  }
}

class Animal extends Model {
  static get modifiers() {
    return {
      orderByName(builder) {
        builder.orderBy('name');
      },

      filterSpecies(builder, species) {
        builder.where('species', species);
      }
    };
  }
}

const people = await Person.query().modifiers({
  // You can bind arguments to Model modifiers like this
  filterFemale(builder) {
    builder.modify('filterGender', 'female');
  },

  filterDogs(builder) {
    builder.modify('filterSpecies', 'dog');
  }
}).withGraphFetched(`
    children(defaultSelects, orderByAge, filterFemale).[
      pets(filterDogs, orderByName),
      movies
    ]
  `);

console.log(people[0].children[0].pets[0].name);
console.log(people[0].children[0].movies[0].id);
```

Filters can also be registered using the [modifyGraph](/api/query-builder/other-methods.html#modifygraph) method:

```js
const people = await Person.query()
  .withGraphFetched('children.[pets, movies]')
  .modifyGraph('children', builder => {
    // Order children by age and only select id.
    builder.orderBy('age').select('id');
  })
  .modifyGraph('children.[pets, movies]', builder => {
    // Only select `pets` and `movies` whose id > 10 for the children.
    builder.where('id', '>', 10);
  });

console.log(people[0].children[0].pets[0].name);
console.log(people[0].children[0].movies[0].id);
```

Relations can be given aliases using the `as` keyword:

```js
const people = await Person.query().withGraphFetched(`[
    children(orderByAge) as kids .[
      pets(filterDogs) as dogs,
      pets(filterCats) as cats

      movies.[
        actors
      ]
    ]
  ]`);

console.log(people[0].kids[0].dogs[0].name);
console.log(people[0].kids[0].movies[0].id);
```

Eager loading is optimized to avoid the N + 1 queries problem. Consider this query:

```js
const people = await Person.query()
  .where('id', 1)
  .withGraphFetched('children.children');

console.log(people[0].children.length); // --> 10
console.log(people[0].children[9].children.length); // --> 10
```

The person has 10 children and they all have 10 children. The query above will return 100 database rows but will generate only three database queries when using `withGraphFetched` and only one query when using `withGraphJoined`.

## withGraphJoined()

```js
queryBuilder = queryBuilder.withGraphJoined(relationExpression, graphOptions);
```

Join and fetch a graph of related items for the result of any query (eager loading).

There are two methods that can be used to load relations eagerly: [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) and [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined). The main difference is that [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) uses multiple queries under the hood to fetch the result while [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) uses a single query and joins to fetch the results. Both methods allow you to do different things which we will go through in detail in the examples below and in the examples of the [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) method.

As mentioned, this method uses [SQL joins](https://www.postgresql.org/docs/12/tutorial-join.html) to join all the relations defined in the `relationExpression` and then parses the result into a graph of model instances equal to the one you get from `withGraphFetched`. The main benefit of this is that you can filter the query based on the relations. See the examples.

By default left join is used but you can define the join type using the [joinOperation](/api/types/#type-eageroptions) option.

**Limitations:**

- `limit`, `page` and `range` methods will work incorrectly because they will limit the result set that contains all the result rows in a flattened format. For example the result set of the eager expression children.children will have 10 \* 10 \* 10 rows assuming that you fetched 10 models that all had 10 children that all had 10 children.

**About performance:**

Note that while [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) sounds more performant than [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched), both methods have very similar performance in most cases and [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) is actually much much faster in some cases where the [relationExpression](/api/types/#type-relationexpression) contains multiple many-to-many or has-many relations. The flat record list the db returns for joins can have an incredible amount of duplicate information in some cases. Transferring + parsing that data from the db to node can be very costly, even though the actual joins in the db are very fast. You shouldn't select [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) blindly just because it sounds more peformant. The three rules of optimization apply here too: 1. Don't optimize 2. Don't optimize yet 3. Profile before optimizing. When you don't actually need joins, use [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched).

##### Arguments

| Argument           | Type                                                      | Description                                                  |
| ------------------ | --------------------------------------------------------- | ------------------------------------------------------------ |
| relationExpression | [RelationExpression](/api/types/#type-relationexpression) | The relation expression describing which relations to fetch. |
| options            | [GraphOptions](/api/types/#type-graphoptions)             | Optional options.                                            |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

All examples in [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) also work with `withGraphJoined`. Remember to also study those. The following examples are only about the cases that don't work with [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched)

Using `withGraphJoined` all the relations are joined to the main query and you can reference them in any query building method. Note that nested relations are named by concatenating relation names using `:` as a separator. See the next example:

```js
const people = await Person.query()
  .withGraphJoined('children.[pets, movies]')
  .whereIn('children.firstName', ['Arnold', 'Jennifer'])
  .where('children:pets.name', 'Fluffy')
  .where('children:movies.name', 'like', 'Terminator%');

console.log(people[0].children[0].pets[0].name);
console.log(people[0].children[0].movies[0].id);
```

Using [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) you can refer to columns only by their name because the column names are unique in the query. With `withGraphJoined` you often need to also mention the table name. Consider the following example. We join the relation `pets` to a `persons` query. Both tables have the `id` column. We need to use `where('persons.id', '>', 100)` instead of `where('id', '>', 100)` so that objection knows which `id` you mean. If you don't do this, you get an `ambiguous column name` error.

```js
const people = await Person.query()
  .withGraphJoined('pets')
  .where('persons.id', '>', 100);
```

## graphExpressionObject()

```js
const builder = Person.query().withGraphFetched('children.pets(onlyId)');

const expr = builder.graphExpressionObject();
console.log(expr.children.pets.$modify);
// prints ["onlyId"]

expr.children.movies = true;
// You can modify the object and pass it back to the `withGraphFetched` method.
builder.withGraphFetched(expr);
```

Returns the object representation of the relation expression passed to either `withGraphFetched` or `withGraphJoined`.

See [this section](/api/types/#relationexpression-object-notation) for more examples and information about the structure of the returned object.

##### Return value

| Type   | Description                                                                                                        |
| ------ | ------------------------------------------------------------------------------------------------------------------ |
| object | Object representation of the current relation expression passed to either `withGraphFetched` or `withGraphJoined`. |

## allowGraph()

```js
queryBuilder = queryBuilder.allowGraph(relationExpression);
```

Sets the allowed tree of relations to fetch, insert or upsert using [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched), [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined), [insertGraph](/api/query-builder/mutate-methods.html#insertgraph) or [upsertGraph](/api/query-builder/mutate-methods.html#upsertgraph) methods.

When using [withGraphFetched](/api/query-builder/eager-methods.html#withgraphfetched) or [withGraphJoined](/api/query-builder/eager-methods.html#withgraphjoined) the query is rejected and an error is thrown if the [expression](/api/types/#type-relationexpression) passed to the methods is not a subset of the [expression](/api/types/#type-relationexpression) passed to `allowGraph`. This method is useful when the relation expression comes from an untrusted source like query parameters of a http request.

If the model tree given to the [insertGraph](/api/query-builder/mutate-methods.html#insertgraph) or the [upsertGraph](/api/query-builder/mutate-methods.html#upsertgraph) method isn't a subtree of the given [expression](/api/types/#type-relationexpression), the query is rejected and and error is thrown.

See the examples.

##### Arguments

| Argument           | Type                                                      | Description                     |
| ------------------ | --------------------------------------------------------- | ------------------------------- |
| relationExpression | [RelationExpression](/api/types/#type-relationexpression) | The allowed relation expression |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

This will throw because `actors` is not allowed.

```js
await Person.query()
  .allowGraph('[children.pets, movies]')
  .withGraphFetched('movies.actors');
```

This will not throw:

```js
await Person.query()
  .allowGraph('[children.pets, movies]')
  .withGraphFetched('children.pets');
```

Calling `allowGraph` multiple times merges the expressions. The following is equivalent to the previous example:

```js
await Person.query()
  .allowGraph('children.pets')
  .allowGraph('movies')
  .withGraphFetched(req.query.eager);
```

Usage in `insertGraph` and `upsertGraph` works the same way. The following will not throw.

```js
const insertedPerson = await Person.query()
  .allowGraph('[children.pets, movies]')
  .insertGraph({
    firstName: 'Sylvester',
    children: [
      {
        firstName: 'Sage',
        pets: [
          {
            name: 'Fluffy',
            species: 'dog'
          },
          {
            name: 'Scrappy',
            species: 'dog'
          }
        ]
      }
    ]
  });
```

This will throw because `cousins` is not allowed:

```js
const insertedPerson = await Person.query()
  .allowGraph('[children.pets, movies]')
  .upsertGraph({
    firstName: 'Sylvester',

    children: [
      {
        firstName: 'Sage',
        pets: [
          {
            name: 'Fluffy',
            species: 'dog'
          },
          {
            name: 'Scrappy',
            species: 'dog'
          }
        ]
      }
    ],

    cousins: [sylvestersCousin]
  });
```

You can use [clearAllowGraph](/api/query-builder/eager-methods.html#clearallowgraph) to clear any previous calls to `allowGraph`.

## clearAllowGraph()

Clears all calls to `allowGraph`.

## clearWithGraph()

Clears all calls to `withGraphFetched` and `withGraphJoined`.

## modifyGraph()

```js
queryBuilder = queryBuilder.modifyGraph(pathExpression, modifier);
```

Can be used to modify `withGraphFetched` and `withGraphJoined` queries.

The `pathExpression` is a relation expression that specifies the queries for which the modifier is given.

The following query would filter out the children's pets that are <= 10 years old:

##### Arguments

| Argument       | Type                                                                                           | Description                                                                                                                         |
| -------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| pathExpression | [RelationExpression](/api/types/#type-relationexpression)                                      | Expression that specifies the queries for which to give the filter.                                                                 |
| modifier       | function([QueryBuilder](/api/query-builder/)&nbsp;&#124;&nbsp;string&nbsp;&#124;&nbsp;string[] | A modifier function, [model modifier](/api/model/static-properties.html#static-modifiers) name or an array of model modifier names. |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

```js
Person.query()
  .withGraphFetched('[children.[pets, movies], movies]')
  .modifyGraph('children.pets', builder => {
    builder.where('age', '>', 10);
  });
```

The path expression can have multiple targets. The next example sorts both the pets and movies of the children by id:

```js
Person.query()
  .withGraphFetched('[children.[pets, movies], movies]')
  .modifyGraph('children.[pets, movies]', builder => {
    builder.orderBy('id');
  });
```

This example only selects movies whose name contains the word 'Predator':

```js
Person.query()
  .withGraphFetched('[children.[pets, movies], movies]')
  .modifyGraph('[children.movies, movies]', builder => {
    builder.where('name', 'like', '%Predator%');
  });
```

The modifier can also be a [Model modifier](/api/model/static-properties.html#static-modifiers) name, or an array of them:

```js
Person.query()
  .withGraphFetched('[children.[pets, movies], movies]')
  .modifyGraph('children.movies', 'selectId');
```

================================================
FILE: doc/api/query-builder/find-methods.md
================================================
# Find Methods

## findById()

```js
queryBuilder = queryBuilder.findById(id);
```

Finds a single item by id.

##### Arguments

| Argument | Type                       | Description     |
| -------- | -------------------------- | --------------- |
| id       | any&nbsp;&#124;&nbsp;any[] | The identifier. |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

```js
const person = await Person.query().findById(1);
```

Composite key:

```js
const person = await Person.query().findById([1, '10']);
```

`findById` can be used together with `patch`, `delete` and any other query method. All it does is adds the needed `where` clauses to the query.

```js
await Person.query()
  .findById(someId)
  .patch({ firstName: 'Jennifer' });
```

## findByIds()

```js
queryBuilder = queryBuilder.findByIds(ids);
```

Finds a list of items. The order of the returned items is not guaranteed to be the same as the order of the inputs.

##### Arguments

| Argument | Type  | Description            |
| -------- | ----- | ---------------------- |
| ids      | any[] | A List of identifiers. |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

```js
const [person1, person2] = await Person.query().findByIds([1, 2]);
```

Composite key:

```js
const [person1, person2] = await Person.query().findByIds([
  [1, '10'],
  [2, '10']
]);
```

## findOne()

```js
queryBuilder = queryBuilder.findOne(...whereArgs);
```

Shorthand for `where(...whereArgs).first()`.

NOTE: [`.first()`](https://vincit.github.io/objection.js/api/query-builder/other-methods.html#first) doesn't add `limit 1` to the query by default. You can override the [Model.useLimitInFirst](/api/model/static-properties.html#static-uselimitinfirst) property to change this behaviour.

##### Arguments

| Argument  | Type   | Description                                                                      |
| --------- | ------ | -------------------------------------------------------------------------------- |
| whereArgs | ...any | Anything the [where](/api/query-builder/find-methods.html#where) method accepts. |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

```js
const person = await Person.query().findOne({
  firstName: 'Jennifer',
  lastName: 'Lawrence'
});
```

```js
const person = await Person.query().findOne('age', '>', 20);
```

```js
const person = await Person.query().findOne(raw('random() < 0.5'));
```

## alias()

```js
queryBuilder = queryBuilder.alias(alias);
```

Give an alias for the table to be used in the query.

##### Arguments

| Argument | Type   | Description                |
| -------- | ------ | -------------------------- |
| alias    | string | Table alias for the query. |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

```js
await Person.query()
  .alias('p')
  .where('p.id', 1)
  .join('persons as parent', 'parent.id', 'p.parentId');
```

## aliasFor()

```js
queryBuilder = queryBuilder.aliasFor(tableNameOrModelClass, alias);
```

Give an alias for any table in the query.

##### Arguments

| Argument              | Type                               | Description                        |
| --------------------- | ---------------------------------- | ---------------------------------- |
| tableNameOrModelClass | string&nbsp;&#124;&nbsp;ModelClass | The table or model class to alias. |
| alias                 | string                             | The alias.                         |

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

```js
// This query uses joinRelated to join a many-to-many relation which also joins
// the join table `persons_movies`. We specify that the `persons_movies` table
// should be called `pm` instead of the default `movies_join`.
await Person.query()
  .aliasFor('persons_movies', 'pm')
  .joinRelated('movies')
  .where('pm.someProp', 100);
```

Model class can be used instead of table name

```js
await Person.query()
  .aliasFor(Movie, 'm')
  .joinRelated('movies')
  .where('m.name', 'The Room');
```

## select()

See [knex documentation](https://knexjs.org/guide/query-builder.html#select)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## forUpdate()

See [knex documentation](https://knexjs.org/guide/query-builder.html#forupdate)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## forShare()

See [knex documentation](https://knexjs.org/guide/query-builder.html#forshare)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## forNoKeyUpdate()

See [knex documentation](https://knexjs.org/guide/query-builder.html#fornokeyupdate)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## forKeyShare()

See [knex documentation](https://knexjs.org/guide/query-builder.html#forkeyshare)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## skipLocked()

See [knex documentation](https://knexjs.org/guide/query-builder.html#skiplocked)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## noWait()

See [knex documentation](https://knexjs.org/guide/query-builder.html#nowait)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## as()

See [knex documentation](https://knexjs.org/guide/query-builder.html#as)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## columns()

See [knex documentation](https://knexjs.org/guide/query-builder.html#column)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## column()

See [knex documentation](https://knexjs.org/guide/query-builder.html#column)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## from()

See [knex documentation](https://knexjs.org/guide/query-builder.html#from)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## fromRaw()

See [knex documentation](https://knexjs.org/guide/query-builder.html#fromRaw)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## updateFrom()

See [knex documentation](https://knexjs.org/guide/query-builder.html#updatefrom)
##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## into()

See [knex documentation](https://knexjs.org/guide/query-builder.html)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## with()

See [knex documentation](https://knexjs.org/guide/query-builder.html#with)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## withMaterialized()

See [knex documentation](https://knexjs.org/guide/query-builder.html#withmaterialized)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## withNotMaterialized()

See [knex documentation](https://knexjs.org/guide/query-builder.html#withnotmaterialized)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## withSchema()

See [knex documentation](https://knexjs.org/guide/query-builder.html#withschema)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## table()

See [knex documentation](https://knexjs.org/guide/query-builder.html)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## distinct()

See [knex documentation](https://knexjs.org/guide/query-builder.html#distinct)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## distinctOn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#distincton)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## where()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## andWhere()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhere()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereNot()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenot)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereNot()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenot)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereRaw()

See [knex documentation](https://knexjs.org/guide/query-builder.html#whereraw)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereWrapped()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## havingWrapped()

See [knex documentation](https://knexjs.org/guide/query-builder.html#having)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereRaw()

See [knex documentation](https://knexjs.org/guide/query-builder.html#whereraw)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereExists()

See [knex documentation](https://knexjs.org/guide/query-builder.html#whereexists)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereExists()

See [knex documentation](https://knexjs.org/guide/query-builder.html#whereexists)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereNotExists()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenotexists)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereNotExists()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenotexists)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereIn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherein)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereIn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherein)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereNotIn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenotin)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereNotIn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenotin)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereNull()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenull)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereNull()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenull)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereNotNull()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenotnull)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereNotNull()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenotnull)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereBetween()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherebetween)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereNotBetween()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenotbetween)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereBetween()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherebetween)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereNotBetween()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherenotbetween)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereColumn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## andWhereColumn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereColumn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereNotColumn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## andWhereNotColumn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orWhereNotColumn()

See [knex documentation](https://knexjs.org/guide/query-builder.html#where)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereLike()

See [knex documentation](https://knexjs.org/guide/query-builder.html#wherelike)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereILike()

See [knex documentation](https://knexjs.org/guide/query-builder.html#whereilike)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## groupBy()

See [knex documentation](https://knexjs.org/guide/query-builder.html#groupby)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## groupByRaw()

See [knex documentation](https://knexjs.org/guide/query-builder.html#groupbyraw)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orderBy()

See [knex documentation](https://knexjs.org/guide/query-builder.html#orderby)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orderByRaw()

See [knex documentation](https://knexjs.org/guide/query-builder.html#orderbyraw)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## union()

See [knex documentation](https://knexjs.org/guide/query-builder.html#union)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## unionAll()

See [knex documentation](https://knexjs.org/guide/query-builder.html#unionall)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## intersect()

See [knex documentation](https://knexjs.org/guide/query-builder.html#intersect)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |


## having()

See [knex documentation](https://knexjs.org/guide/query-builder.html#having)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## havingRaw()

See [knex documentation](https://knexjs.org/guide/query-builder.html#havingraw)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orHaving()

See [knex documentation](https://knexjs.org/guide/query-builder.html#having)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## orHavingRaw()

See [knex documentation](https://knexjs.org/guide/query-builder.html#havingraw)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## offset()

See [knex documentation](https://knexjs.org/guide/query-builder.html#offset)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## limit()

See [knex documentation](https://knexjs.org/guide/query-builder.html#limit)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## count()

See [knex documentation](https://knexjs.org/guide/query-builder.html#count)

Also see the [resultSize](/api/query-builder/other-methods.md#resultsize) method for a cleaner way to just get the number of rows a query would create.

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## countDistinct()

See [knex documentation](https://knexjs.org/guide/query-builder.html#count)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## min()

See [knex documentation](https://knexjs.org/guide/query-builder.html#min)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## max()

See [knex documentation](https://knexjs.org/guide/query-builder.html#max)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## sum()

See [knex documentation](https://knexjs.org/guide/query-builder.html#sum)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## avg()

See [knex documentation](https://knexjs.org/guide/query-builder.html#avg)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## avgDistinct()

See [knex documentation](https://knexjs.org/guide/query-builder.html#avg)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## returning()

See [knex documentation](https://knexjs.org/guide/query-builder.html#returning)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## columnInfo()

See [knex documentation](https://knexjs.org/guide/query-builder.html#columninfo)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## whereComposite()

```js
queryBuilder = queryBuilder.whereComposite(columns, operator, values);
```

[where](/api/query-builder/find-methods.html#where) for (possibly) composite keys.

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

```js
builder.whereComposite(['id', 'name'], '=', [1, 'Jennifer']);
```

This method also works with a single column - value pair:

```js
builder.whereComposite('id', 1);
```

## whereInComposite()

```js
queryBuilder = queryBuilder.whereInComposite(columns, values);
```

[whereIn](/api/query-builder/find-methods.html#wherein) for (possibly) composite keys.

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

##### Examples

```js
builder.whereInComposite(
  ['a', 'b'],
  [
    [1, 2],
    [3, 4],
    [1, 4]
  ]
);
```

```js
builder.whereInComposite('a', [[1], [3], [1]]);
```

```js
builder.whereInComposite('a', [1, 3, 1]);
```

```js
builder.whereInComposite(['a', 'b'], SomeModel.query().select('a', 'b'));
```

## jsonExtract()

See [knex documentation](https://knexjs.org/guide/query-builder.html#jsonextract)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## jsonSet()

See [knex documentation](https://knexjs.org/guide/query-builder.html#jsonset)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## jsonInsert()

See [knex documentation](https://knexjs.org/guide/query-builder.html#jsoninsert)

##### Return value

| Type                                | Description                        |
| ----------------------------------- | ---------------------------------- |
| [QueryBuilder](/api/query-builder/) | `this` query builder for chaining. |

## jsonRemove()

See [knex documentation](
Download .txt
gitextract_1w8nr7ov/

├── .eslintrc.json
├── .github/
│   ├── ISSUE_TEMPLATE.md
│   ├── dependabot.yml
│   └── workflows/
│       └── test.yml
├── .gitignore
├── .prettierrc.json
├── LICENSE
├── README.md
├── doc/
│   ├── .prettierrc.json
│   ├── .vuepress/
│   │   ├── config.js
│   │   ├── styles/
│   │   │   ├── index.styl
│   │   │   └── palette.styl
│   │   └── theme/
│   │       ├── components/
│   │       │   └── AlgoliaSearchBox.vue
│   │       └── index.js
│   ├── README.md
│   ├── api/
│   │   ├── README.md
│   │   ├── model/
│   │   │   ├── instance-methods.md
│   │   │   ├── instance-properties.md
│   │   │   ├── overview.md
│   │   │   ├── static-methods.md
│   │   │   └── static-properties.md
│   │   ├── objection/
│   │   │   └── README.md
│   │   ├── query-builder/
│   │   │   ├── README.md
│   │   │   ├── eager-methods.md
│   │   │   ├── find-methods.md
│   │   │   ├── join-methods.md
│   │   │   ├── mutate-methods.md
│   │   │   ├── other-methods.md
│   │   │   └── static-methods.md
│   │   └── types/
│   │       └── README.md
│   ├── guide/
│   │   ├── contributing.md
│   │   ├── documents.md
│   │   ├── getting-started.md
│   │   ├── hooks.md
│   │   ├── installation.md
│   │   ├── models.md
│   │   ├── plugins.md
│   │   ├── query-examples.md
│   │   ├── relations.md
│   │   ├── transactions.md
│   │   └── validation.md
│   ├── recipes/
│   │   ├── composite-keys.md
│   │   ├── custom-id-column.md
│   │   ├── custom-query-builder.md
│   │   ├── custom-validation.md
│   │   ├── default-values.md
│   │   ├── error-handling.md
│   │   ├── extra-properties.md
│   │   ├── indexing-postgresql-jsonb-columns.md
│   │   ├── joins.md
│   │   ├── json-queries.md
│   │   ├── modifiers.md
│   │   ├── multitenancy-using-multiple-databases.md
│   │   ├── paging.md
│   │   ├── plugins.md
│   │   ├── polymorphic-associations.md
│   │   ├── precedence-and-parentheses.md
│   │   ├── raw-queries.md
│   │   ├── relation-subqueries.md
│   │   ├── returning-tricks.md
│   │   ├── snake-case-to-camel-case-conversion.md
│   │   ├── subqueries.md
│   │   ├── ternary-relationships.md
│   │   └── timestamps.md
│   └── release-notes/
│       ├── changelog.md
│       └── migration.md
├── docker-compose.yml
├── examples/
│   ├── koa/
│   │   ├── .prettierrc.json
│   │   ├── README.md
│   │   ├── api.js
│   │   ├── app.js
│   │   ├── client.js
│   │   ├── knexfile.js
│   │   ├── migrations/
│   │   │   └── 20150613161239_initial_schema.js
│   │   ├── models/
│   │   │   ├── Animal.js
│   │   │   ├── Movie.js
│   │   │   └── Person.js
│   │   └── package.json
│   ├── koa-ts/
│   │   ├── .prettierrc.json
│   │   ├── README.md
│   │   ├── api.ts
│   │   ├── app.ts
│   │   ├── client.js
│   │   ├── knexfile.js
│   │   ├── migrations/
│   │   │   └── 20150613161239_initial_schema.js
│   │   ├── models/
│   │   │   ├── Animal.ts
│   │   │   ├── Movie.ts
│   │   │   └── Person.ts
│   │   ├── package.json
│   │   └── tsconfig.json
│   ├── minimal/
│   │   ├── README.md
│   │   ├── app.js
│   │   ├── knexfile.js
│   │   ├── migrations/
│   │   │   └── 20190330121219_initial_schema.js
│   │   ├── models/
│   │   │   └── Person.js
│   │   └── package.json
│   ├── plugin/
│   │   ├── README.md
│   │   ├── index.js
│   │   ├── package.json
│   │   └── tests.js
│   └── plugin-with-options/
│       ├── README.md
│       ├── index.js
│       ├── package.json
│       └── tests.js
├── lib/
│   ├── .eslintrc.json
│   ├── initialize.js
│   ├── model/
│   │   ├── AjvValidator.js
│   │   ├── Model.js
│   │   ├── ModifierNotFoundError.js
│   │   ├── NotFoundError.js
│   │   ├── RelationDoesNotExistError.js
│   │   ├── ValidationError.js
│   │   ├── Validator.js
│   │   ├── getModel.js
│   │   ├── graph/
│   │   │   ├── ModelGraph.js
│   │   │   ├── ModelGraphBuilder.js
│   │   │   ├── ModelGraphEdge.js
│   │   │   └── ModelGraphNode.js
│   │   ├── inheritModel.js
│   │   ├── modelBindKnex.js
│   │   ├── modelClone.js
│   │   ├── modelColPropMap.js
│   │   ├── modelId.js
│   │   ├── modelJsonAttributes.js
│   │   ├── modelParseRelations.js
│   │   ├── modelQueryProps.js
│   │   ├── modelSet.js
│   │   ├── modelTableMetadata.js
│   │   ├── modelToJson.js
│   │   ├── modelUtils.js
│   │   ├── modelValidate.js
│   │   ├── modelValues.js
│   │   └── modelVisitor.js
│   ├── objection.js
│   ├── queryBuilder/
│   │   ├── FunctionBuilder.js
│   │   ├── InternalOptions.js
│   │   ├── JoinBuilder.js
│   │   ├── QueryBuilder.js
│   │   ├── QueryBuilderBase.js
│   │   ├── QueryBuilderContext.js
│   │   ├── QueryBuilderContextBase.js
│   │   ├── QueryBuilderOperationSupport.js
│   │   ├── QueryBuilderUserContext.js
│   │   ├── RawBuilder.js
│   │   ├── ReferenceBuilder.js
│   │   ├── RelationExpression.js
│   │   ├── StaticHookArguments.js
│   │   ├── ValueBuilder.js
│   │   ├── graph/
│   │   │   ├── GraphAction.js
│   │   │   ├── GraphData.js
│   │   │   ├── GraphFetcher.js
│   │   │   ├── GraphNodeDbExistence.js
│   │   │   ├── GraphOperation.js
│   │   │   ├── GraphOptions.js
│   │   │   ├── GraphUpsert.js
│   │   │   ├── delete/
│   │   │   │   ├── GraphDelete.js
│   │   │   │   └── GraphDeleteAction.js
│   │   │   ├── insert/
│   │   │   │   ├── GraphInsert.js
│   │   │   │   ├── GraphInsertAction.js
│   │   │   │   └── JoinRowGraphInsertAction.js
│   │   │   ├── patch/
│   │   │   │   ├── GraphPatch.js
│   │   │   │   └── GraphPatchAction.js
│   │   │   └── recursiveUpsert/
│   │   │       ├── GraphRecursiveUpsert.js
│   │   │       └── GraphRecursiveUpsertAction.js
│   │   ├── join/
│   │   │   ├── JoinResultColumn.js
│   │   │   ├── JoinResultParser.js
│   │   │   ├── RelationJoiner.js
│   │   │   ├── TableNode.js
│   │   │   ├── TableTree.js
│   │   │   └── utils.js
│   │   ├── operations/
│   │   │   ├── DelegateOperation.js
│   │   │   ├── DeleteOperation.js
│   │   │   ├── FindByIdOperation.js
│   │   │   ├── FindByIdsOperation.js
│   │   │   ├── FindOperation.js
│   │   │   ├── FirstOperation.js
│   │   │   ├── FromOperation.js
│   │   │   ├── InsertAndFetchOperation.js
│   │   │   ├── InsertGraphAndFetchOperation.js
│   │   │   ├── InsertGraphOperation.js
│   │   │   ├── InsertOperation.js
│   │   │   ├── InstanceDeleteOperation.js
│   │   │   ├── InstanceFindOperation.js
│   │   │   ├── InstanceInsertOperation.js
│   │   │   ├── InstanceUpdateOperation.js
│   │   │   ├── JoinRelatedOperation.js
│   │   │   ├── KnexOperation.js
│   │   │   ├── MergeOperation.js
│   │   │   ├── ObjectionToKnexConvertingOperation.js
│   │   │   ├── OnBuildKnexOperation.js
│   │   │   ├── OnBuildOperation.js
│   │   │   ├── OnErrorOperation.js
│   │   │   ├── QueryBuilderOperation.js
│   │   │   ├── RangeOperation.js
│   │   │   ├── RelateOperation.js
│   │   │   ├── ReturningOperation.js
│   │   │   ├── RunAfterOperation.js
│   │   │   ├── RunBeforeOperation.js
│   │   │   ├── UnrelateOperation.js
│   │   │   ├── UpdateAndFetchOperation.js
│   │   │   ├── UpdateOperation.js
│   │   │   ├── UpsertGraphAndFetchOperation.js
│   │   │   ├── UpsertGraphOperation.js
│   │   │   ├── WhereCompositeOperation.js
│   │   │   ├── eager/
│   │   │   │   ├── EagerOperation.js
│   │   │   │   ├── JoinEagerOperation.js
│   │   │   │   ├── NaiveEagerOperation.js
│   │   │   │   └── WhereInEagerOperation.js
│   │   │   ├── jsonApi/
│   │   │   │   ├── WhereJsonHasPostgresOperation.js
│   │   │   │   ├── WhereJsonNotObjectPostgresOperation.js
│   │   │   │   ├── WhereJsonPostgresOperation.js
│   │   │   │   └── postgresJsonApi.js
│   │   │   ├── select/
│   │   │   │   ├── SelectOperation.js
│   │   │   │   └── Selection.js
│   │   │   └── whereInComposite/
│   │   │       ├── WhereInCompositeMsSqlOperation.js
│   │   │       ├── WhereInCompositeOperation.js
│   │   │       └── WhereInCompositeSqliteOperation.js
│   │   ├── parsers/
│   │   │   ├── jsonFieldExpressionParser.js
│   │   │   ├── jsonFieldExpressionParser.pegjs
│   │   │   ├── relationExpressionParser.js
│   │   │   └── relationExpressionParser.pegjs
│   │   └── transformations/
│   │       ├── CompositeQueryTransformation.js
│   │       ├── QueryTransformation.js
│   │       ├── WrapMysqlModifySubqueryTransformation.js
│   │       └── index.js
│   ├── relations/
│   │   ├── Relation.js
│   │   ├── RelationDeleteOperation.js
│   │   ├── RelationFindOperation.js
│   │   ├── RelationInsertOperation.js
│   │   ├── RelationOwner.js
│   │   ├── RelationProperty.js
│   │   ├── RelationUpdateOperation.js
│   │   ├── belongsToOne/
│   │   │   ├── BelongsToOneDeleteOperation.js
│   │   │   ├── BelongsToOneInsertOperation.js
│   │   │   ├── BelongsToOneRelateOperation.js
│   │   │   ├── BelongsToOneRelation.js
│   │   │   └── BelongsToOneUnrelateOperation.js
│   │   ├── hasMany/
│   │   │   ├── HasManyInsertOperation.js
│   │   │   ├── HasManyRelateOperation.js
│   │   │   ├── HasManyRelation.js
│   │   │   └── HasManyUnrelateOperation.js
│   │   ├── hasOne/
│   │   │   └── HasOneRelation.js
│   │   ├── hasOneThrough/
│   │   │   └── HasOneThroughRelation.js
│   │   └── manyToMany/
│   │       ├── ManyToManyModifyMixin.js
│   │       ├── ManyToManyRelation.js
│   │       ├── ManyToManySqliteModifyMixin.js
│   │       ├── delete/
│   │       │   ├── ManyToManyDeleteOperation.js
│   │       │   ├── ManyToManyDeleteOperationBase.js
│   │       │   └── ManyToManyDeleteSqliteOperation.js
│   │       ├── find/
│   │       │   └── ManyToManyFindOperation.js
│   │       ├── insert/
│   │       │   └── ManyToManyInsertOperation.js
│   │       ├── relate/
│   │       │   └── ManyToManyRelateOperation.js
│   │       ├── unrelate/
│   │       │   ├── ManyToManyUnrelateOperation.js
│   │       │   ├── ManyToManyUnrelateOperationBase.js
│   │       │   └── ManyToManyUnrelateSqliteOperation.js
│   │       └── update/
│   │           ├── ManyToManyUpdateOperation.js
│   │           ├── ManyToManyUpdateOperationBase.js
│   │           └── ManyToManyUpdateSqliteOperation.js
│   ├── transaction.js
│   └── utils/
│       ├── assert.js
│       ├── buildUtils.js
│       ├── classUtils.js
│       ├── clone.js
│       ├── createModifier.js
│       ├── deprecate.js
│       ├── identifierMapping.js
│       ├── internalPropUtils.js
│       ├── knexUtils.js
│       ├── mixin.js
│       ├── normalizeIds.js
│       ├── objectUtils.js
│       ├── parseFieldExpression.js
│       ├── promiseUtils/
│       │   ├── after.js
│       │   ├── afterReturn.js
│       │   ├── index.js
│       │   ├── isPromise.js
│       │   ├── map.js
│       │   ├── mapAfterAllReturn.js
│       │   └── try.js
│       ├── resolveModel.js
│       └── tmpColumnUtils.js
├── package.json
├── publish-docs.sh
├── reproduction-template.js
├── setup-test-db.js
├── testUtils/
│   ├── TestSession.js
│   ├── mockKnex.js
│   └── testUtils.js
├── tests/
│   ├── integration/
│   │   ├── compositeKeys.js
│   │   ├── crossDb/
│   │   │   ├── index.js
│   │   │   └── mysql.js
│   │   ├── delete.js
│   │   ├── find.js
│   │   ├── graph/
│   │   │   └── GraphInsert.js
│   │   ├── index.js
│   │   ├── insert.js
│   │   ├── insertGraph.js
│   │   ├── jsonQueries.js
│   │   ├── jsonRelations.js
│   │   ├── knexIdentifierMapping.js
│   │   ├── knexSnakeCase.js
│   │   ├── misc/
│   │   │   ├── #1074.js
│   │   │   ├── #1202.js
│   │   │   ├── #1215.js
│   │   │   ├── #1223.js
│   │   │   ├── #1227.js
│   │   │   ├── #1265.js
│   │   │   ├── #1455.js
│   │   │   ├── #1467.js
│   │   │   ├── #1489.js
│   │   │   ├── #1627.js
│   │   │   ├── #1718.js
│   │   │   ├── #1757.js
│   │   │   ├── #2105.js
│   │   │   ├── #292.js
│   │   │   ├── #325.js
│   │   │   ├── #403.js
│   │   │   ├── #517.js
│   │   │   ├── #712.js
│   │   │   ├── #733.js
│   │   │   ├── #760.js
│   │   │   ├── #844.js
│   │   │   ├── #909.js
│   │   │   ├── aggregateMethodsWithRelations.js
│   │   │   ├── concurrency.js
│   │   │   ├── defaultModelFieldValues.js
│   │   │   ├── generatedId.js
│   │   │   ├── hasOneTree.js
│   │   │   ├── index.js
│   │   │   ├── modelWithLengthProperty.js
│   │   │   ├── multipleResultsWithOneToOneRelation.js
│   │   │   ├── mysqlBinaryColumns.js
│   │   │   ├── nonMutatingRelatedQuery.js
│   │   │   ├── refAttack.js
│   │   │   ├── relatedQueryErrors.js
│   │   │   ├── relationHooks.js
│   │   │   ├── tableMetadata.js
│   │   │   ├── unhandledRejectionErrors.js
│   │   │   ├── usingUnboundModelsByPassingKnex.js
│   │   │   └── zeroValueInRelationColumn.js
│   │   ├── modifiers.js
│   │   ├── nonPrimaryKeyRelations.js
│   │   ├── patch.js
│   │   ├── queryContext.js
│   │   ├── relate.js
│   │   ├── relationModify.js
│   │   ├── schema.js
│   │   ├── snakeCase.js
│   │   ├── staticHooks.js
│   │   ├── toKnexQuery.js
│   │   ├── transactions.js
│   │   ├── unrelate.js
│   │   ├── update.js
│   │   ├── upsertGraph.js
│   │   ├── viewsAndAliases.js
│   │   └── withGraph.js
│   ├── main.js
│   ├── ts/
│   │   ├── custom-query-builder.ts
│   │   ├── documents.ts
│   │   ├── examples.ts
│   │   ├── fixtures/
│   │   │   ├── animal.ts
│   │   │   ├── movie.ts
│   │   │   ├── person.ts
│   │   │   └── review.ts
│   │   ├── model/
│   │   │   └── instance-methods.ts
│   │   ├── model-class.ts
│   │   ├── query-builder-api/
│   │   │   ├── eager-loading-methods.ts
│   │   │   ├── find-methods.ts
│   │   │   ├── join-methods.ts
│   │   │   ├── mutating-methods.ts
│   │   │   └── other-methods.ts
│   │   ├── query-examples/
│   │   │   ├── basic-queries/
│   │   │   │   ├── delete.ts
│   │   │   │   ├── find.ts
│   │   │   │   ├── insert.ts
│   │   │   │   └── update.ts
│   │   │   ├── eager-loading.ts
│   │   │   ├── graph-inserts.ts
│   │   │   ├── graph-upserts.ts
│   │   │   └── relation-queries/
│   │   │       ├── delete.ts
│   │   │       ├── find.ts
│   │   │       ├── insert.ts
│   │   │       ├── relate.ts
│   │   │       ├── unrelate.ts
│   │   │       └── update.ts
│   │   ├── transactions/
│   │   │   ├── creating.ts
│   │   │   └── using.ts
│   │   └── validation.ts
│   └── unit/
│       ├── model/
│       │   ├── AjvValidator.js
│       │   └── Model.js
│       ├── queryBuilder/
│       │   ├── JoinBuilder.js
│       │   ├── QueryBuilder.js
│       │   ├── ReferenceBuilder.js
│       │   ├── RelationExpression.js
│       │   ├── ValueBuilder.js
│       │   └── jsonFieldExpressionParser.js
│       ├── relations/
│       │   ├── BelongsToOneRelation.js
│       │   ├── HasManyRelation.js
│       │   ├── ManyToManyRelation.js
│       │   ├── Relation.js
│       │   └── files/
│       │       ├── InvalidModel.js
│       │       ├── InvalidModelManyNamedModels.js
│       │       ├── JoinModel.js
│       │       ├── ModelWithARandomError.js
│       │       ├── OwnerModel.js
│       │       ├── RelatedModel.js
│       │       └── RelatedModelNamedExport.js
│       ├── utils/
│       │   └── resolveModel.js
│       └── utils.js
├── tsconfig.json
└── typings/
    └── objection/
        └── index.d.ts
Download .txt
Showing preview only (225K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2826 symbols across 281 files)

FILE: doc/.vuepress/theme/index.js
  method alias (line 6) | alias() {

FILE: examples/koa-ts/api.ts
  function takeFirst (line 243) | function takeFirst<T>(item: T | ReadonlyArray<T>): T {

FILE: examples/koa-ts/app.ts
  function errorHandler (line 37) | async function errorHandler(ctx: Context, next: () => Promise<any>) {

FILE: examples/koa-ts/client.js
  function insertPersonWithRelations (line 50) | async function insertPersonWithRelations() {
  function fetchPeople (line 101) | async function fetchPeople() {
  function updatePerson (line 121) | async function updatePerson(person, patch) {
  function deletePerson (line 133) | async function deletePerson(person) {
  function insertChildForPerson (line 145) | async function insertChildForPerson(person, child) {
  function fetchChildren (line 158) | async function fetchChildren(person) {
  function insertPetForPerson (line 174) | async function insertPetForPerson(person, pet) {
  function fetchPersonsHamsters (line 186) | async function fetchPersonsHamsters(person) {
  function insertMovie (line 202) | async function insertMovie(movie) {
  function addPersonToMovieAsActor (line 215) | async function addPersonToMovieAsActor(movie, actor) {
  function removePersonFromMovie (line 227) | async function removePersonFromMovie(movie, actor) {

FILE: examples/koa-ts/models/Animal.ts
  class Animal (line 4) | class Animal extends Model {

FILE: examples/koa-ts/models/Movie.ts
  class Movie (line 4) | class Movie extends Model {

FILE: examples/koa-ts/models/Person.ts
  class Person (line 5) | class Person extends Model {
    method searchByName (line 50) | searchByName(query, name) {

FILE: examples/koa/app.js
  function errorHandler (line 37) | async function errorHandler(ctx, next) {

FILE: examples/koa/client.js
  function insertPersonWithRelations (line 46) | async function insertPersonWithRelations() {
  function fetchPeople (line 97) | async function fetchPeople() {
  function updatePerson (line 117) | async function updatePerson(person, patch) {
  function deletePerson (line 129) | async function deletePerson(person) {
  function insertChildForPerson (line 141) | async function insertChildForPerson(person, child) {
  function fetchChildren (line 154) | async function fetchChildren(person) {
  function insertPetForPerson (line 170) | async function insertPetForPerson(person, pet) {
  function fetchPersonsHamsters (line 182) | async function fetchPersonsHamsters(person) {
  function insertMovie (line 198) | async function insertMovie(movie) {
  function addPersonToMovieAsActor (line 211) | async function addPersonToMovieAsActor(movie, actor) {
  function removePersonFromMovie (line 223) | async function removePersonFromMovie(movie, actor) {

FILE: examples/koa/models/Animal.js
  class Animal (line 5) | class Animal extends Model {
    method tableName (line 7) | static get tableName() {
    method jsonSchema (line 14) | static get jsonSchema() {
    method relationMappings (line 29) | static get relationMappings() {

FILE: examples/koa/models/Movie.js
  class Movie (line 5) | class Movie extends Model {
    method tableName (line 7) | static get tableName() {
    method jsonSchema (line 14) | static get jsonSchema() {
    method relationMappings (line 26) | static get relationMappings() {

FILE: examples/koa/models/Person.js
  class Person (line 5) | class Person extends Model {
    method tableName (line 7) | static get tableName() {
    method jsonSchema (line 14) | static get jsonSchema() {
    method modifiers (line 39) | static get modifiers() {
    method relationMappings (line 60) | static get relationMappings() {

FILE: examples/minimal/app.js
  function main (line 17) | async function main() {

FILE: examples/minimal/models/Person.js
  class Person (line 5) | class Person extends Model {
    method tableName (line 7) | static get tableName() {

FILE: examples/plugin-with-options/index.js
  class SessionQueryBuilder (line 28) | class SessionQueryBuilder extends Model.QueryBuilder {
    method session (line 31) | session(session) {
  method QueryBuilder (line 48) | static get QueryBuilder() {
  method $beforeUpdate (line 52) | $beforeUpdate(opt, context) {
  method $beforeInsert (line 71) | $beforeInsert(context) {

FILE: examples/plugin-with-options/tests.js
  constant ISO_DATE_REGEX (line 8) | const ISO_DATE_REGEX = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d...
  class Person (line 53) | class Person extends sessionPlugin(Model) {
    method tableName (line 54) | static get tableName() {
    method tableName (line 72) | static get tableName() {
    method tableName (line 98) | static get tableName() {
  class Person (line 71) | class Person extends sessionPlugin(Model) {
    method tableName (line 54) | static get tableName() {
    method tableName (line 72) | static get tableName() {
    method tableName (line 98) | static get tableName() {
  class Person (line 97) | class Person extends sessionPlugin(Model) {
    method tableName (line 54) | static get tableName() {
    method tableName (line 72) | static get tableName() {
    method tableName (line 98) | static get tableName() {

FILE: examples/plugin/index.js
  class SessionQueryBuilder (line 11) | class SessionQueryBuilder extends Model.QueryBuilder {
    method session (line 14) | session(session) {
  method QueryBuilder (line 31) | static get QueryBuilder() {
  method $beforeUpdate (line 35) | $beforeUpdate(opt, context) {
  method $beforeInsert (line 49) | $beforeInsert(context) {

FILE: examples/plugin/tests.js
  constant ISO_DATE_REGEX (line 8) | const ISO_DATE_REGEX = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d...
  class Person (line 51) | class Person extends sessionPlugin(Model) {
    method tableName (line 52) | static get tableName() {
    method tableName (line 68) | static get tableName() {
  class Person (line 67) | class Person extends sessionPlugin(Model) {
    method tableName (line 52) | static get tableName() {
    method tableName (line 68) | static get tableName() {

FILE: lib/initialize.js
  function initialize (line 3) | async function initialize(knex, modelClasses) {

FILE: lib/model/AjvValidator.js
  class AjvValidator (line 9) | class AjvValidator extends Validator {
    method init (line 10) | static init(self, conf) {
    method beforeValidate (line 52) | beforeValidate({ json, model, options, ctx }) {
    method validate (line 68) | validate({ json, model, options, ctx }) {
    method getValidator (line 91) | getValidator(modelClass, jsonSchema, isPatchObject) {
    method compilePatchValidator (line 137) | compilePatchValidator(jsonSchema) {
    method compileNormalValidator (line 143) | compileNormalValidator(jsonSchema) {
  function parseValidationError (line 148) | function parseValidationError(errors, modelClass, options, ajvOptions) {
  function cloneDeep (line 212) | function cloneDeep(obj) {
  function setsDefaultValues (line 220) | function setsDefaultValues(jsonSchema) {
  function hasDefaults (line 224) | function hasDefaults(obj) {
  function arrayHasDefaults (line 232) | function arrayHasDefaults(arr) {
  function objectHasDefaults (line 244) | function objectHasDefaults(obj) {
  function jsonSchemaWithoutRequired (line 264) | function jsonSchemaWithoutRequired(jsonSchema) {
  function subSchemaWithoutRequired (line 284) | function subSchemaWithoutRequired(jsonSchema, prop) {
  function jsonSchemaArrayWithoutRequired (line 315) | function jsonSchemaArrayWithoutRequired(jsonSchemaArray) {
  function isNotEmptyObject (line 319) | function isNotEmptyObject(obj) {

FILE: lib/model/Model.js
  class Model (line 47) | class Model {
    method $modelClass (line 48) | get $modelClass() {
    method $id (line 52) | $id(maybeId) {
    method $hasId (line 56) | $hasId() {
    method $hasProps (line 60) | $hasProps(props) {
    method $query (line 64) | $query(trx) {
    method $relatedQuery (line 71) | $relatedQuery(relationName, trx) {
    method $fetchGraph (line 80) | $fetchGraph(relationExpression, options) {
    method $beforeValidate (line 84) | $beforeValidate(jsonSchema, json, options) {
    method $validate (line 89) | $validate(json, options) {
    method $afterValidate (line 93) | $afterValidate(json, options) {
    method $parseDatabaseJson (line 97) | $parseDatabaseJson(json) {
    method $formatDatabaseJson (line 107) | $formatDatabaseJson(json) {
    method $parseJson (line 119) | $parseJson(json, options) {
    method $formatJson (line 123) | $formatJson(json) {
    method $setJson (line 127) | $setJson(json, options) {
    method $setDatabaseJson (line 131) | $setDatabaseJson(json) {
    method $set (line 135) | $set(obj) {
    method $setRelated (line 139) | $setRelated(relation, models) {
    method $appendRelated (line 143) | $appendRelated(relation, models) {
    method $toJson (line 147) | $toJson(opt) {
    method toJSON (line 151) | toJSON(opt) {
    method $toDatabaseJson (line 155) | $toDatabaseJson(builder) {
    method $beforeInsert (line 159) | $beforeInsert(queryContext) {
    method $afterInsert (line 163) | $afterInsert(queryContext) {
    method $beforeUpdate (line 167) | $beforeUpdate(opt, queryContext) {
    method $afterUpdate (line 171) | $afterUpdate(opt, queryContext) {
    method $afterFind (line 175) | $afterFind(queryContext) {
    method $beforeDelete (line 179) | $beforeDelete(queryContext) {
    method $afterDelete (line 183) | $afterDelete(queryContext) {
    method $values (line 187) | $values(props) {
    method $propKey (line 191) | $propKey(props) {
    method $idKey (line 195) | $idKey() {
    method $clone (line 199) | $clone(opt) {
    method $traverse (line 203) | $traverse(filterConstructor, callback) {
    method $traverseAsync (line 213) | $traverseAsync(filterConstructor, callback) {
    method $omitFromJson (line 222) | $omitFromJson(...props) {
    method $omitFromDatabaseJson (line 234) | $omitFromDatabaseJson(...props) {
    method $knex (line 246) | $knex() {
    method $transaction (line 250) | $transaction(...args) {
    method $ref (line 254) | get $ref() {
    method objectionModelClass (line 258) | static get objectionModelClass() {
    method fromJson (line 262) | static fromJson(json, options) {
    method fromDatabaseJson (line 268) | static fromDatabaseJson(json) {
    method onCreateQuery (line 274) | static onCreateQuery(builder) {
    method beforeFind (line 278) | static beforeFind(args) {
    method afterFind (line 282) | static afterFind(args) {
    method beforeInsert (line 286) | static beforeInsert(args) {
    method afterInsert (line 290) | static afterInsert(args) {
    method beforeUpdate (line 294) | static beforeUpdate(args) {
    method afterUpdate (line 298) | static afterUpdate(args) {
    method beforeDelete (line 302) | static beforeDelete(args) {
    method afterDelete (line 306) | static afterDelete(args) {
    method omitImpl (line 310) | static omitImpl(obj, prop) {
    method joinTableAlias (line 314) | static joinTableAlias(relationPath) {
    method createValidator (line 318) | static createValidator() {
    method modifierNotFound (line 329) | static modifierNotFound(builder, modifier) {
    method createNotFoundError (line 333) | static createNotFoundError(queryContext, props) {
    method createValidationError (line 337) | static createValidationError(props) {
    method getTableName (line 341) | static getTableName() {
    method getIdColumn (line 355) | static getIdColumn() {
    method getValidator (line 365) | static getValidator() {
    method getJsonSchema (line 369) | static getJsonSchema() {
    method getJsonAttributes (line 373) | static getJsonAttributes() {
    method getColumnNameMappers (line 377) | static getColumnNameMappers() {
    method getConcurrency (line 381) | static getConcurrency(knex) {
    method getModifiers (line 404) | static getModifiers() {
    method columnNameToPropertyName (line 408) | static columnNameToPropertyName(columnName) {
    method propertyNameToColumnName (line 420) | static propertyNameToColumnName(propertyName) {
    method getReadOnlyAttributes (line 432) | static getReadOnlyAttributes() {
    method getIdRelationProperty (line 436) | static getIdRelationProperty() {
    method getIdColumnArray (line 440) | static getIdColumnArray() {
    method getIdPropertyArray (line 444) | static getIdPropertyArray() {
    method getIdProperty (line 448) | static getIdProperty() {
    method getRelationMappings (line 458) | static getRelationMappings() {
    method getRelations (line 462) | static getRelations() {
    method getRelationNames (line 472) | static getRelationNames() {
    method getVirtualAttributes (line 476) | static getVirtualAttributes() {
    method getDefaultGraphOptions (line 480) | static getDefaultGraphOptions() {
    method getRelatedFindQueryMutates (line 484) | static getRelatedFindQueryMutates() {
    method getRelatedInsertQueryMutates (line 488) | static getRelatedInsertQueryMutates() {
    method query (line 492) | static query(trx) {
    method relatedQuery (line 498) | static relatedQuery(relationName, trx) {
    method fetchTableMetadata (line 507) | static fetchTableMetadata(opt) {
    method tableMetadata (line 511) | static tableMetadata(opt) {
    method knex (line 515) | static knex(...args) {
    method transaction (line 523) | static transaction(knexOrTrx, cb) {
    method startTransaction (line 532) | static startTransaction(knexOrTrx) {
    method raw (line 537) | static get raw() {
    method ref (line 541) | static get ref() {
    method fn (line 547) | static get fn() {
    method knexQuery (line 551) | static knexQuery() {
    method uniqueTag (line 555) | static uniqueTag() {
    method bindKnex (line 563) | static bindKnex(knex) {
    method bindTransaction (line 567) | static bindTransaction(trx) {
    method ensureModel (line 571) | static ensureModel(model, options) {
    method ensureModelArray (line 585) | static ensureModelArray(input, options) {
    method getRelationUnsafe (line 603) | static getRelationUnsafe(name) {
    method getRelation (line 622) | static getRelation(name) {
    method fetchGraph (line 632) | static fetchGraph($models, expression, options = {}) {
    method traverse (line 640) | static traverse(...args) {
    method traverseAsync (line 658) | static traverseAsync(...args) {
  function instanceQuery (line 739) | function instanceQuery({ instance, transaction }) {
  function relatedQuery (line 770) | function relatedQuery({ modelClass, relationName, transaction, alwaysRet...
  function cachedGet (line 819) | function cachedGet(target, hiddenPropertyName, creator) {
  function getValidator (line 827) | function getValidator(modelClass) {
  function getJsonSchema (line 831) | function getJsonSchema(modelClass) {
  function getColumnNameMappers (line 835) | function getColumnNameMappers(modelClass) {
  function getIdRelationProperty (line 839) | function getIdRelationProperty(modelClass) {
  function getReadOnlyAttributes (line 848) | function getReadOnlyAttributes(modelClass) {
  function getReadOnlyAttributesRecursively (line 852) | function getReadOnlyAttributesRecursively(modelClass) {
  function getRelationMappings (line 869) | function getRelationMappings(modelClass) {
  function getRelationNames (line 879) | function getRelationNames(modelClass) {
  function getVirtualAttributes (line 883) | function getVirtualAttributes(modelClass) {
  function getTraverseArgs (line 887) | function getTraverseArgs(filterConstructor, models, traverser) {
  function asPropsArray (line 907) | function asPropsArray(props) {

FILE: lib/model/ModifierNotFoundError.js
  class ModifierNotFoundError (line 3) | class ModifierNotFoundError extends Error {
    method constructor (line 4) | constructor(modifierName) {

FILE: lib/model/NotFoundError.js
  class NotFoundError (line 3) | class NotFoundError extends Error {
    method constructor (line 4) | constructor({ modelClass, data = {}, statusCode = 404, ...rest } = {}) {

FILE: lib/model/RelationDoesNotExistError.js
  class RelationDoesNotExistError (line 3) | class RelationDoesNotExistError extends Error {
    method constructor (line 4) | constructor(relationName) {

FILE: lib/model/ValidationError.js
  class ValidationError (line 12) | class ValidationError extends Error {
    method Type (line 13) | static get Type() {
    method constructor (line 17) | constructor({ type, message, modelClass, data = {}, statusCode = 400 }) {
  function errorsToMessage (line 34) | function errorsToMessage(data) {
  function message (line 43) | function message(it) {

FILE: lib/model/Validator.js
  class Validator (line 3) | class Validator {
    method constructor (line 4) | constructor(...args) {
    method init (line 8) | static init() {}
    method beforeValidate (line 10) | beforeValidate({ model, json, options }) {
    method validate (line 14) | validate() {
    method afterValidate (line 19) | afterValidate({ model, json, options }) {

FILE: lib/model/graph/ModelGraph.js
  constant NOT_CALCULATED (line 4) | const NOT_CALCULATED = {};
  class ModelGraph (line 6) | class ModelGraph {
    method constructor (line 7) | constructor(nodes, edges) {
    method create (line 16) | static create(rootModelClass, roots) {
    method createEmpty (line 21) | static createEmpty() {
    method rootObjects (line 25) | get rootObjects() {
    method nodeForObject (line 29) | nodeForObject(obj) {
    method nodeForNode (line 41) | nodeForNode(node) {
  function createNodesByObjectsMap (line 54) | function createNodesByObjectsMap(nodes) {
  function createNodesByIdPathKeysMap (line 64) | function createNodesByIdPathKeysMap(nodes) {

FILE: lib/model/graph/ModelGraphBuilder.js
  class ModelGraphBuilder (line 8) | class ModelGraphBuilder {
    method constructor (line 9) | constructor() {
    method buildGraph (line 14) | static buildGraph(rootModelClass, roots) {
    method _buildGraph (line 21) | _buildGraph(rootModelClass, roots) {
    method _buildNodes (line 35) | _buildNodes(modelClass, objs, parentNode = null, relation = null) {
    method _buildNode (line 43) | _buildNode(modelClass, obj, parentNode = null, relation = null, index ...
    method _buildRelationNodes (line 69) | _buildRelationNodes(node) {
    method _buildReferences (line 87) | _buildReferences() {
    method _nodesByUid (line 94) | _nodesByUid() {
    method _buildObjectReferences (line 110) | _buildObjectReferences(nodesByUid) {
    method _buildPropertyReferences (line 131) | _buildPropertyReferences(nodesByUid) {
    method _addEdge (line 152) | _addEdge(ownerNode, relatedNode, edge) {
  function forEachPropertyReference (line 165) | function forEachPropertyReference(obj, callback) {
  function visitStrings (line 183) | function visitStrings(value, path, visit) {
  function visitStringsInArray (line 193) | function visitStringsInArray(value, path, visit) {
  function visitStringsInObject (line 201) | function visitStringsInObject(value, path, visit) {
  function forEachMatch (line 209) | function forEachMatch(regex, str, cb) {
  function createReferenceNotFoundError (line 218) | function createReferenceNotFoundError(ref) {
  function createNotModelError (line 230) | function createNotModelError(modelClass, value) {

FILE: lib/model/graph/ModelGraphEdge.js
  class ModelGraphEdge (line 13) | class ModelGraphEdge {
    method constructor (line 14) | constructor(type, ownerNode, relatedNode, relation = null, relationInd...
    method Type (line 29) | static get Type() {
    method ReferenceType (line 33) | static get ReferenceType() {
    method getOtherNode (line 37) | getOtherNode(node) {
    method isOwnerNode (line 41) | isOwnerNode(node) {
    method isRelatedNode (line 45) | isRelatedNode(node) {

FILE: lib/model/graph/ModelGraphNode.js
  constant NOT_CALCULATED (line 6) | const NOT_CALCULATED = {};
  class ModelGraphNode (line 8) | class ModelGraphNode {
    method constructor (line 9) | constructor(modelClass, obj) {
    method isReference (line 33) | get isReference() {
    method isDbReference (line 37) | get isDbReference() {
    method reference (line 41) | get reference() {
    method dbReference (line 45) | get dbReference() {
    method parentNode (line 49) | get parentNode() {
    method indexInRelation (line 57) | get indexInRelation() {
    method relationName (line 65) | get relationName() {
    method relationPath (line 73) | get relationPath() {
    method relationPathKey (line 81) | get relationPathKey() {
    method dataPath (line 89) | get dataPath() {
    method dataPathKey (line 97) | get dataPathKey() {
    method idPath (line 105) | get idPath() {
    method idPathKey (line 113) | get idPathKey() {
    method referencedNode (line 124) | get referencedNode() {
    method referencingNodes (line 137) | get referencingNodes() {
    method descendantRelationNodes (line 149) | get descendantRelationNodes() {
    method removeEdge (line 153) | removeEdge(edge) {
    method _collectDescendantRelationNodes (line 164) | _collectDescendantRelationNodes(nodes) {
    method _createRelationPath (line 175) | _createRelationPath() {
    method _createRelationPathKey (line 183) | _createRelationPathKey() {
    method _createDataPath (line 187) | _createDataPath() {
    method _createDataPathKey (line 197) | _createDataPathKey() {
    method _createIdPath (line 209) | _createIdPath() {
    method _createIdPathKey (line 227) | _createIdPathKey() {

FILE: lib/model/inheritModel.js
  function inheritModel (line 5) | function inheritModel(modelClass) {
  function createClassInheritor (line 16) | function createClassInheritor(className) {

FILE: lib/model/modelBindKnex.js
  function bindKnex (line 7) | function bindKnex(modelClass, knex) {
  function getBoundModelFromCache (line 23) | function getBoundModelFromCache(modelClass, knex) {
  function getCache (line 30) | function getCache(knex) {
  function createCache (line 38) | function createCache(knex) {
  function copyHiddenProperties (line 44) | function copyHiddenProperties(modelClass, BoundModelClass) {
  function putBoundModelToCache (line 55) | function putBoundModelToCache(modelClass, BoundModelClass, knex) {
  function bindRelations (line 63) | function bindRelations(modelClass, BoundModelClass, knex) {

FILE: lib/model/modelClone.js
  function clone (line 8) | function clone(model, shallow, stripInternal) {
  function cloneSimple (line 32) | function cloneSimple(model) {
  function cloneWithOpt (line 50) | function cloneWithOpt(model, shallow, stripInternal) {
  function cloneObject (line 79) | function cloneObject(value) {
  function cloneArray (line 91) | function cloneArray(value) {
  function copyHiddenProps (line 107) | function copyHiddenProps(model, clone) {

FILE: lib/model/modelColPropMap.js
  function columnNameToPropertyName (line 5) | function columnNameToPropertyName(modelClass, columnName) {
  function propertyNameToColumnName (line 18) | function propertyNameToColumnName(modelClass, propertyName) {

FILE: lib/model/modelId.js
  function getSetId (line 3) | function getSetId(model, maybeId) {
  function hasId (line 11) | function hasId(model) {
  function setId (line 15) | function setId(model, id) {
  function getId (line 48) | function getId(model) {

FILE: lib/model/modelJsonAttributes.js
  function parseJsonAttributes (line 5) | function parseJsonAttributes(json, modelClass) {
  function formatJsonAttributes (line 29) | function formatJsonAttributes(json, modelClass) {
  function getJsonAttributes (line 47) | function getJsonAttributes(modelClass) {
  function tryParseJson (line 80) | function tryParseJson(maybeJsonStr) {

FILE: lib/model/modelParseRelations.js
  function parseRelationsIntoModelInstances (line 5) | function parseRelationsIntoModelInstances(model, json, options = {}) {
  function parseRelation (line 30) | function parseRelation(json, relation, options) {
  function parseRelationArray (line 40) | function parseRelationArray(json, relation, options) {
  function parseRelationObject (line 61) | function parseRelationObject(json, relation, options) {

FILE: lib/model/modelQueryProps.js
  constant QUERY_PROPS_PROPERTY (line 7) | const QUERY_PROPS_PROPERTY = '$$queryProps';
  function splitQueryProps (line 11) | function splitQueryProps(model, json) {
  function hasQueryProps (line 37) | function hasQueryProps(json, keys) {
  function isQueryProp (line 47) | function isQueryProp(value) {
  function mergeQueryProps (line 61) | function mergeQueryProps(model, json, omitProps, builder) {
  function convertExistingQueryProps (line 71) | function convertExistingQueryProps(json, builder) {
  function convertAndMergeHiddenQueryProps (line 88) | function convertAndMergeHiddenQueryProps(model, json, omitProps, builder) {
  function queryPropToKnexRaw (line 112) | function queryPropToKnexRaw(queryProp, builder) {
  function buildObjectionQueryBuilder (line 126) | function buildObjectionQueryBuilder(builder, parentBuilder) {
  function buildKnexRawConvertable (line 130) | function buildKnexRawConvertable(convertable, builder) {
  function isKnexRawConvertable (line 140) | function isKnexRawConvertable(queryProp) {

FILE: lib/model/modelSet.js
  function setJson (line 8) | function setJson(model, json, options) {
  function setDatabaseJson (line 39) | function setDatabaseJson(model, json) {
  function setFast (line 54) | function setFast(model, obj) {
  function setRelated (line 80) | function setRelated(model, relation, models) {
  function appendRelated (line 106) | function appendRelated(model, relation, models) {
  function ensureRelation (line 122) | function ensureRelation(model, relation) {

FILE: lib/model/modelTableMetadata.js
  constant TABLE_METADATA (line 6) | const TABLE_METADATA = '$$tableMetadata';
  function fetchTableMetadata (line 8) | function fetchTableMetadata(
  function tableMetadata (line 66) | function tableMetadata(modelClass, { table } = {}) {

FILE: lib/model/modelToJson.js
  constant EMPTY_ARRAY (line 6) | const EMPTY_ARRAY = [];
  function toJson (line 8) | function toJson(model, optIn) {
  function toDatabaseJson (line 26) | function toDatabaseJson(model, builder) {
  function getVirtuals (line 44) | function getVirtuals(opt) {
  function isShallow (line 54) | function isShallow(opt) {
  function getOmit (line 58) | function getOmit(opt, modelClass) {
  function getPick (line 62) | function getPick(modelClass) {
  function toExternalJsonImpl (line 67) | function toExternalJsonImpl(model, opt) {
  function getVirtualAttributes (line 86) | function getVirtualAttributes(model, opt) {
  function toDatabaseJsonImpl (line 96) | function toDatabaseJsonImpl(model, opt) {
  function assignJsonValue (line 110) | function assignJsonValue(json, key, value, opt) {
  function shouldOmit (line 128) | function shouldOmit(opt, key) {
  function shouldPick (line 135) | function shouldPick(opt, key) {
  function assignVirtualAttributes (line 139) | function assignVirtualAttributes(json, model, vAttr, opt) {
  function toJsonObject (line 152) | function toJsonObject(value, opt) {
  function toJsonArray (line 168) | function toJsonArray(value, opt) {

FILE: lib/model/modelUtils.js
  function defineNonEnumerableProperty (line 22) | function defineNonEnumerableProperty(obj, prop, value) {
  function keyByProps (line 31) | function keyByProps(models, props) {

FILE: lib/model/modelValidate.js
  function validate (line 5) | function validate(model, json, options = {}) {

FILE: lib/model/modelValues.js
  constant PROP_KEY_PREFIX (line 7) | const PROP_KEY_PREFIX = 'k_';
  function values (line 9) | function values(model, args) {
  function propKey (line 22) | function propKey(model, props) {
  function hasProps (line 35) | function hasProps(model, props) {
  function values1 (line 47) | function values1(model, args) {
  function values2 (line 51) | function values2(model, args) {
  function values3 (line 55) | function values3(model, args) {
  function valuesN (line 59) | function valuesN(model, args) {
  function propKey1 (line 69) | function propKey1(model, props) {
  function propKey2 (line 73) | function propKey2(model, props) {
  function propKey3 (line 77) | function propKey3(model, props) {
  function propKeyN (line 88) | function propKeyN(model, props) {
  function propToStr (line 102) | function propToStr(value) {
  function isNullOrUndefined (line 116) | function isNullOrUndefined(val) {

FILE: lib/model/modelVisitor.js
  function visitModels (line 3) | function visitModels(models, modelClass, visitor) {
  function doVisit (line 7) | function doVisit(models, modelClass, parent, rel, visitor) {
  function visitMany (line 15) | function visitMany(models, modelClass, parent, rel, visitor) {
  function visitOne (line 21) | function visitOne(model, modelClass, parent, rel, visitor) {

FILE: lib/objection.js
  function Model (line 47) | function Model() {
  function QueryBuilder (line 51) | function QueryBuilder(...args) {
  function Validator (line 55) | function Validator(...args) {
  function AjvValidator (line 59) | function AjvValidator(...args) {

FILE: lib/queryBuilder/FunctionBuilder.js
  class FunctionBuilder (line 6) | class FunctionBuilder extends RawBuilder {}
  function fn (line 8) | function fn(...argsIn) {

FILE: lib/queryBuilder/InternalOptions.js
  class InternalOptions (line 3) | class InternalOptions {
    method constructor (line 4) | constructor() {
    method clone (line 13) | clone() {

FILE: lib/queryBuilder/JoinBuilder.js
  class JoinBuilder (line 6) | class JoinBuilder extends QueryBuilderOperationSupport {
    method using (line 7) | using(...args) {
    method on (line 11) | on(...args) {
    method orOn (line 15) | orOn(...args) {
    method onBetween (line 19) | onBetween(...args) {
    method onNotBetween (line 23) | onNotBetween(...args) {
    method orOnBetween (line 27) | orOnBetween(...args) {
    method orOnNotBetween (line 31) | orOnNotBetween(...args) {
    method onIn (line 35) | onIn(...args) {
    method onNotIn (line 39) | onNotIn(...args) {
    method orOnIn (line 43) | orOnIn(...args) {
    method orOnNotIn (line 47) | orOnNotIn(...args) {
    method onNull (line 51) | onNull(...args) {
    method orOnNull (line 55) | orOnNull(...args) {
    method onNotNull (line 59) | onNotNull(...args) {
    method orOnNotNull (line 63) | orOnNotNull(...args) {
    method onExists (line 67) | onExists(...args) {
    method orOnExists (line 71) | orOnExists(...args) {
    method onNotExists (line 75) | onNotExists(...args) {
    method orOnNotExists (line 79) | orOnNotExists(...args) {
    method type (line 83) | type(...args) {
    method andOn (line 87) | andOn(...args) {
    method andOnIn (line 91) | andOnIn(...args) {
    method andOnNotIn (line 95) | andOnNotIn(...args) {
    method andOnNull (line 99) | andOnNull(...args) {
    method andOnNotNull (line 103) | andOnNotNull(...args) {
    method andOnExists (line 107) | andOnExists(...args) {
    method andOnNotExists (line 111) | andOnNotExists(...args) {
    method andOnBetween (line 115) | andOnBetween(...args) {
    method andOnNotBetween (line 119) | andOnNotBetween(...args) {
    method andOnJsonPathEquals (line 123) | andOnJsonPathEquals(...args) {
    method onVal (line 127) | onVal(...args) {
    method andOnVal (line 131) | andOnVal(...args) {
    method orOnVal (line 135) | orOnVal(...args) {

FILE: lib/queryBuilder/QueryBuilder.js
  class QueryBuilder (line 49) | class QueryBuilder extends QueryBuilderBase {
    method init (line 50) | static init(self, modelClass) {
    method QueryBuilderContext (line 71) | static get QueryBuilderContext() {
    method parseRelationExpression (line 75) | static parseRelationExpression(expr) {
    method tableNameFor (line 79) | tableNameFor(modelClassOrTableName, newTableName) {
    method tableName (line 83) | tableName(newTableName) {
    method tableRef (line 87) | tableRef() {
    method aliasFor (line 91) | aliasFor(modelClassOrTableName, alias) {
    method alias (line 95) | alias(alias) {
    method fullIdColumnFor (line 99) | fullIdColumnFor(modelClass) {
    method fullIdColumn (line 110) | fullIdColumn() {
    method modifiers (line 114) | modifiers(modifiers) {
    method modify (line 123) | modify(modifier, ...args) {
    method reject (line 138) | reject(error) {
    method resolve (line 143) | resolve(value) {
    method isExplicitlyResolvedOrRejected (line 148) | isExplicitlyResolvedOrRejected() {
    method isExecutable (line 152) | isExecutable() {
    method findOperationFactory (line 156) | findOperationFactory(factory) {
    method insertOperationFactory (line 161) | insertOperationFactory(factory) {
    method updateOperationFactory (line 166) | updateOperationFactory(factory) {
    method patchOperationFactory (line 171) | patchOperationFactory(factory) {
    method deleteOperationFactory (line 176) | deleteOperationFactory(factory) {
    method relateOperationFactory (line 181) | relateOperationFactory(factory) {
    method unrelateOperationFactory (line 186) | unrelateOperationFactory(factory) {
    method withGraphFetched (line 191) | withGraphFetched(exp, options = {}) {
    method withGraphJoined (line 195) | withGraphJoined(exp, options = {}) {
    method _withGraph (line 199) | _withGraph(exp, options, algorithm) {
    method allowGraph (line 210) | allowGraph(exp) {
    method allowedGraphExpression (line 221) | allowedGraphExpression() {
    method graphExpressionObject (line 225) | graphExpressionObject() {
    method graphModifiersAtPath (line 235) | graphModifiersAtPath() {
    method modifyGraph (line 245) | modifyGraph(path, modifier) {
    method findOptions (line 251) | findOptions(opt) {
    method resultModelClass (line 260) | resultModelClass() {
    method isFind (line 264) | isFind() {
    method isInsert (line 274) | isInsert() {
    method isUpdate (line 278) | isUpdate() {
    method isDelete (line 282) | isDelete() {
    method isRelate (line 286) | isRelate() {
    method isUnrelate (line 290) | isUnrelate() {
    method hasWheres (line 294) | hasWheres() {
    method hasSelects (line 299) | hasSelects() {
    method hasWithGraph (line 303) | hasWithGraph() {
    method isSelectAll (line 308) | isSelectAll() {
    method toString (line 336) | toString() {
    method clone (line 340) | clone() {
    method emptyInstance (line 359) | emptyInstance() {
    method clearWithGraph (line 374) | clearWithGraph() {
    method clearWithGraphFetched (line 379) | clearWithGraphFetched() {
    method clearAllowGraph (line 384) | clearAllowGraph() {
    method clearModifiers (line 389) | clearModifiers() {
    method clearReject (line 394) | clearReject() {
    method clearResolve (line 399) | clearResolve() {
    method castTo (line 404) | castTo(modelClass) {
    method then (line 409) | then(...args) {
    method catch (line 414) | catch(...args) {
    method resultSize (line 419) | async resultSize() {
    method toKnexQuery (line 435) | toKnexQuery(knexBuilder = this.knex().queryBuilder()) {
    method execute (line 440) | async execute() {
    method throwIfNotFound (line 453) | throwIfNotFound(data = {}) {
    method findSelection (line 468) | findSelection(selection, explicit = false) {
    method findAllSelections (line 500) | findAllSelections() {
    method hasSelection (line 512) | hasSelection(selection, explicit) {
    method hasSelectionAs (line 516) | hasSelectionAs(selection, alias, explicit) {
    method traverse (line 532) | traverse(modelClass, traverser) {
    method page (line 544) | page(page, pageSize) {
    method columnInfo (line 548) | columnInfo({ table = null } = {}) {
    method withSchema (line 569) | withSchema(schema) {
    method debug (line 582) | debug /* istanbul ignore next */() {
    method insert (line 591) | insert(modelsOrObjects) {
    method insertAndFetch (line 599) | insertAndFetch(modelsOrObjects) {
    method insertGraph (line 611) | insertGraph(modelsOrObjects, opt) {
    method insertGraphAndFetch (line 624) | insertGraphAndFetch(modelsOrObjects, opt) {
    method update (line 641) | update(modelOrObject) {
    method updateAndFetch (line 649) | updateAndFetch(modelOrObject) {
    method updateAndFetchById (line 669) | updateAndFetchById(id, modelOrObject) {
    method upsertGraph (line 681) | upsertGraph(modelsOrObjects, upsertOptions) {
    method upsertGraphAndFetch (line 691) | upsertGraphAndFetch(modelsOrObjects, upsertOptions) {
    method patch (line 705) | patch(modelOrObject) {
    method patchAndFetch (line 713) | patchAndFetch(modelOrObject) {
    method patchAndFetchById (line 733) | patchAndFetchById(id, modelOrObject) {
    method delete (line 745) | delete(...args) {
    method del (line 758) | del(...args) {
    method relate (line 762) | relate(...args) {
    method unrelate (line 770) | unrelate(...args) {
    method increment (line 783) | increment(propertyName, howMuch) {
    method decrement (line 791) | decrement(propertyName, howMuch) {
    method findOne (line 799) | findOne(...args) {
    method range (line 803) | range(...args) {
    method first (line 807) | first(...args) {
    method joinRelated (line 811) | joinRelated(expression, options) {
    method innerJoinRelated (line 820) | innerJoinRelated(expression, options) {
    method outerJoinRelated (line 829) | outerJoinRelated(expression, options) {
    method fullOuterJoinRelated (line 838) | fullOuterJoinRelated(expression, options) {
    method leftJoinRelated (line 847) | leftJoinRelated(expression, options) {
    method leftOuterJoinRelated (line 856) | leftOuterJoinRelated(expression, options) {
    method rightJoinRelated (line 865) | rightJoinRelated(expression, options) {
    method rightOuterJoinRelated (line 874) | rightOuterJoinRelated(expression, options) {
    method deleteById (line 883) | deleteById(id) {
    method findById (line 893) | findById(...args) {
    method findByIds (line 897) | findByIds(...args) {
    method runBefore (line 901) | runBefore(...args) {
    method onBuild (line 905) | onBuild(...args) {
    method onBuildKnex (line 909) | onBuildKnex(...args) {
    method runAfter (line 913) | runAfter(...args) {
    method onError (line 917) | onError(...args) {
    method from (line 921) | from(...args) {
    method updateFrom (line 925) | updateFrom(...args) {
    method table (line 929) | table(...args) {
    method for (line 933) | for(relatedQueryFor) {
  function getTableName (line 951) | function getTableName(modelClassOrTableName) {
  function ensureEagerOperation (line 959) | function ensureEagerOperation(builder, algorithm = null) {
  function getWhereInEagerAlgorithm (line 1003) | function getWhereInEagerAlgorithm(builder) {
  function getJoinEagerAlgorithm (line 1007) | function getJoinEagerAlgorithm(builder) {
  function getNaiveEagerAlgorithm (line 1011) | function getNaiveEagerAlgorithm(builder) {
  function getOperationClassForEagerAlgorithm (line 1015) | function getOperationClassForEagerAlgorithm(builder, algorithm) {
  function parseRelationExpression (line 1025) | function parseRelationExpression(modelClass, exp) {
  function checkEager (line 1043) | function checkEager(builder) {
  function findQueryExecutorOperation (line 1065) | function findQueryExecutorOperation(builder) {
  function beforeExecute (line 1069) | function beforeExecute(builder) {
  function doExecute (line 1087) | function doExecute(builder) {
  function afterExecute (line 1112) | function afterExecute(builder, result) {
  class ReturnImmediatelyException (line 1126) | class ReturnImmediatelyException {
    method constructor (line 1127) | constructor(value) {
  function handleReturnImmediatelyValue (line 1132) | function handleReturnImmediatelyValue(builder) {
  function handleExecuteError (line 1139) | function handleExecuteError(builder, err) {
  function chainOperationHooks (line 1157) | function chainOperationHooks(promise, builder, hookName) {
  function ensureJoinRelatedOperation (line 1175) | function ensureJoinRelatedOperation(builder, joinOperation) {
  function prebuildQuery (line 1187) | function prebuildQuery(builder) {
  function addImplicitOperations (line 1200) | function addImplicitOperations(builder) {
  function addFindOperation (line 1214) | function addFindOperation(builder) {
  function moveEagerOperationToEnd (line 1221) | function moveEagerOperationToEnd(builder) {
  function callOnBuildHooks (line 1228) | function callOnBuildHooks(builder) {
  function callOnBuildFuncs (line 1236) | function callOnBuildFuncs(builder, func) {
  function buildKnexQuery (line 1244) | function buildKnexQuery(builder, knexBuilder = builder.knex().queryBuild...
  function setDefaultTable (line 1265) | function setDefaultTable(builder, knexBuilder) {
  function setDefaultSelect (line 1276) | function setDefaultSelect(builder, knexBuilder) {
  function chainHooks (line 1282) | async function chainHooks(promise, builder, func) {
  function createModels (line 1302) | function createModels(result, builder) {
  function shouldBeConvertedToModel (line 1327) | function shouldBeConvertedToModel(obj, modelClass) {
  function writeOperation (line 1331) | function writeOperation(builder, cb) {
  function findOperationFactory (line 1351) | function findOperationFactory() {
  function insertOperationFactory (line 1355) | function insertOperationFactory() {
  function updateOperationFactory (line 1359) | function updateOperationFactory() {
  function patchOperationFactory (line 1363) | function patchOperationFactory() {
  function relateOperationFactory (line 1369) | function relateOperationFactory() {
  function unrelateOperationFactory (line 1373) | function unrelateOperationFactory() {
  function deleteOperationFactory (line 1377) | function deleteOperationFactory() {

FILE: lib/queryBuilder/QueryBuilderBase.js
  class QueryBuilderBase (line 29) | class QueryBuilderBase extends QueryBuilderOperationSupport {
    method modify (line 30) | modify(...args) {
    method transacting (line 47) | transacting(trx) {
    method select (line 52) | select(...args) {
    method insert (line 56) | insert(...args) {
    method update (line 60) | update(...args) {
    method delete (line 64) | delete(...args) {
    method del (line 68) | del(...args) {
    method forUpdate (line 72) | forUpdate(...args) {
    method forShare (line 76) | forShare(...args) {
    method forNoKeyUpdate (line 80) | forNoKeyUpdate(...args) {
    method forKeyShare (line 84) | forKeyShare(...args) {
    method skipLocked (line 88) | skipLocked(...args) {
    method noWait (line 92) | noWait(...args) {
    method as (line 96) | as(...args) {
    method columns (line 100) | columns(...args) {
    method column (line 104) | column(...args) {
    method from (line 108) | from(...args) {
    method fromJS (line 112) | fromJS(...args) {
    method fromRaw (line 116) | fromRaw(...args) {
    method into (line 120) | into(...args) {
    method withSchema (line 124) | withSchema(...args) {
    method table (line 128) | table(...args) {
    method distinct (line 132) | distinct(...args) {
    method distinctOn (line 136) | distinctOn(...args) {
    method join (line 140) | join(...args) {
    method joinRaw (line 144) | joinRaw(...args) {
    method innerJoin (line 148) | innerJoin(...args) {
    method leftJoin (line 152) | leftJoin(...args) {
    method leftOuterJoin (line 156) | leftOuterJoin(...args) {
    method rightJoin (line 160) | rightJoin(...args) {
    method rightOuterJoin (line 164) | rightOuterJoin(...args) {
    method outerJoin (line 168) | outerJoin(...args) {
    method fullOuterJoin (line 172) | fullOuterJoin(...args) {
    method crossJoin (line 176) | crossJoin(...args) {
    method where (line 180) | where(...args) {
    method andWhere (line 184) | andWhere(...args) {
    method orWhere (line 188) | orWhere(...args) {
    method whereNot (line 192) | whereNot(...args) {
    method andWhereNot (line 196) | andWhereNot(...args) {
    method orWhereNot (line 200) | orWhereNot(...args) {
    method whereRaw (line 204) | whereRaw(...args) {
    method andWhereRaw (line 208) | andWhereRaw(...args) {
    method orWhereRaw (line 212) | orWhereRaw(...args) {
    method whereWrapped (line 216) | whereWrapped(...args) {
    method havingWrapped (line 220) | havingWrapped(...args) {
    method whereExists (line 224) | whereExists(...args) {
    method orWhereExists (line 228) | orWhereExists(...args) {
    method whereNotExists (line 232) | whereNotExists(...args) {
    method orWhereNotExists (line 236) | orWhereNotExists(...args) {
    method whereIn (line 240) | whereIn(...args) {
    method orWhereIn (line 244) | orWhereIn(...args) {
    method whereNotIn (line 248) | whereNotIn(...args) {
    method orWhereNotIn (line 252) | orWhereNotIn(...args) {
    method whereNull (line 256) | whereNull(...args) {
    method orWhereNull (line 260) | orWhereNull(...args) {
    method whereNotNull (line 264) | whereNotNull(...args) {
    method orWhereNotNull (line 268) | orWhereNotNull(...args) {
    method whereBetween (line 272) | whereBetween(...args) {
    method andWhereBetween (line 276) | andWhereBetween(...args) {
    method whereNotBetween (line 280) | whereNotBetween(...args) {
    method andWhereNotBetween (line 284) | andWhereNotBetween(...args) {
    method orWhereBetween (line 288) | orWhereBetween(...args) {
    method orWhereNotBetween (line 292) | orWhereNotBetween(...args) {
    method whereLike (line 296) | whereLike(...args) {
    method andWhereLike (line 300) | andWhereLike(...args) {
    method orWhereLike (line 304) | orWhereLike(...args) {
    method whereILike (line 308) | whereILike(...args) {
    method andWhereILike (line 312) | andWhereILike(...args) {
    method orWhereILike (line 316) | orWhereILike(...args) {
    method groupBy (line 320) | groupBy(...args) {
    method groupByRaw (line 324) | groupByRaw(...args) {
    method orderBy (line 328) | orderBy(...args) {
    method orderByRaw (line 332) | orderByRaw(...args) {
    method union (line 336) | union(...args) {
    method unionAll (line 340) | unionAll(...args) {
    method intersect (line 344) | intersect(...args) {
    method except (line 348) | except(...args) {
    method having (line 352) | having(...args) {
    method clearHaving (line 356) | clearHaving(...args) {
    method clearGroup (line 360) | clearGroup(...args) {
    method orHaving (line 364) | orHaving(...args) {
    method havingIn (line 368) | havingIn(...args) {
    method orHavingIn (line 372) | orHavingIn(...args) {
    method havingNotIn (line 376) | havingNotIn(...args) {
    method orHavingNotIn (line 380) | orHavingNotIn(...args) {
    method havingNull (line 384) | havingNull(...args) {
    method orHavingNull (line 388) | orHavingNull(...args) {
    method havingNotNull (line 392) | havingNotNull(...args) {
    method orHavingNotNull (line 396) | orHavingNotNull(...args) {
    method havingExists (line 400) | havingExists(...args) {
    method orHavingExists (line 404) | orHavingExists(...args) {
    method havingNotExists (line 408) | havingNotExists(...args) {
    method orHavingNotExists (line 412) | orHavingNotExists(...args) {
    method havingBetween (line 416) | havingBetween(...args) {
    method orHavingBetween (line 420) | orHavingBetween(...args) {
    method havingNotBetween (line 424) | havingNotBetween(...args) {
    method orHavingNotBetween (line 428) | orHavingNotBetween(...args) {
    method havingRaw (line 432) | havingRaw(...args) {
    method orHavingRaw (line 436) | orHavingRaw(...args) {
    method offset (line 440) | offset(...args) {
    method limit (line 444) | limit(...args) {
    method count (line 448) | count(...args) {
    method countDistinct (line 452) | countDistinct(...args) {
    method min (line 456) | min(...args) {
    method max (line 460) | max(...args) {
    method sum (line 464) | sum(...args) {
    method sumDistinct (line 468) | sumDistinct(...args) {
    method avg (line 472) | avg(...args) {
    method avgDistinct (line 476) | avgDistinct(...args) {
    method debug (line 480) | debug(...args) {
    method returning (line 484) | returning(...args) {
    method truncate (line 488) | truncate(...args) {
    method connection (line 492) | connection(...args) {
    method options (line 496) | options(...args) {
    method columnInfo (line 500) | columnInfo(...args) {
    method off (line 504) | off(...args) {
    method timeout (line 508) | timeout(...args) {
    method with (line 512) | with(...args) {
    method withWrapped (line 516) | withWrapped(...args) {
    method withRecursive (line 520) | withRecursive(...args) {
    method withMaterialized (line 524) | withMaterialized(...args) {
    method withNotMaterialized (line 528) | withNotMaterialized(...args) {
    method whereComposite (line 532) | whereComposite(...args) {
    method whereInComposite (line 536) | whereInComposite(...args) {
    method whereNotInComposite (line 550) | whereNotInComposite(...args) {
    method jsonExtract (line 564) | jsonExtract(...args) {
    method jsonSet (line 568) | jsonSet(...args) {
    method jsonInsert (line 572) | jsonInsert(...args) {
    method jsonRemove (line 576) | jsonRemove(...args) {
    method whereJsonObject (line 580) | whereJsonObject(...args) {
    method orWhereJsonObject (line 584) | orWhereJsonObject(...args) {
    method andWhereJsonObject (line 588) | andWhereJsonObject(...args) {
    method whereNotJsonObject (line 592) | whereNotJsonObject(...args) {
    method orWhereNotJsonObject (line 596) | orWhereNotJsonObject(...args) {
    method andWhereNotJsonObject (line 600) | andWhereNotJsonObject(...args) {
    method whereJsonPath (line 604) | whereJsonPath(...args) {
    method orWhereJsonPath (line 608) | orWhereJsonPath(...args) {
    method andWhereJsonPath (line 612) | andWhereJsonPath(...args) {
    method whereJsonSupersetOf (line 619) | whereJsonSupersetOf(...args) {
    method andWhereJsonSupersetOf (line 626) | andWhereJsonSupersetOf(...args) {
    method orWhereJsonSupersetOf (line 630) | orWhereJsonSupersetOf(...args) {
    method whereJsonNotSupersetOf (line 637) | whereJsonNotSupersetOf(...args) {
    method andWhereJsonNotSupersetOf (line 648) | andWhereJsonNotSupersetOf(...args) {
    method orWhereJsonNotSupersetOf (line 652) | orWhereJsonNotSupersetOf(...args) {
    method whereJsonSubsetOf (line 663) | whereJsonSubsetOf(...args) {
    method andWhereJsonSubsetOf (line 670) | andWhereJsonSubsetOf(...args) {
    method orWhereJsonSubsetOf (line 674) | orWhereJsonSubsetOf(...args) {
    method whereJsonNotSubsetOf (line 681) | whereJsonNotSubsetOf(...args) {
    method andWhereJsonNotSubsetOf (line 692) | andWhereJsonNotSubsetOf(...args) {
    method orWhereJsonNotSubsetOf (line 696) | orWhereJsonNotSubsetOf(...args) {
    method whereJsonNotArray (line 707) | whereJsonNotArray(...args) {
    method orWhereJsonNotArray (line 717) | orWhereJsonNotArray(...args) {
    method whereJsonNotObject (line 727) | whereJsonNotObject(...args) {
    method orWhereJsonNotObject (line 737) | orWhereJsonNotObject(...args) {
    method whereJsonHasAny (line 747) | whereJsonHasAny(...args) {
    method orWhereJsonHasAny (line 754) | orWhereJsonHasAny(...args) {
    method whereJsonHasAll (line 761) | whereJsonHasAll(...args) {
    method orWhereJsonHasAll (line 768) | orWhereJsonHasAll(...args) {
    method whereJsonIsArray (line 775) | whereJsonIsArray(fieldExpression) {
    method orWhereJsonIsArray (line 779) | orWhereJsonIsArray(fieldExpression) {
    method whereJsonIsObject (line 783) | whereJsonIsObject(fieldExpression) {
    method orWhereJsonIsObject (line 787) | orWhereJsonIsObject(fieldExpression) {
    method whereColumn (line 791) | whereColumn(...args) {
    method andWhereColumn (line 795) | andWhereColumn(...args) {
    method orWhereColumn (line 799) | orWhereColumn(...args) {
    method whereNotColumn (line 803) | whereNotColumn(...args) {
    method andWhereNotColumn (line 807) | andWhereNotColumn(...args) {
    method orWhereNotColumn (line 811) | orWhereNotColumn(...args) {
    method onConflict (line 815) | onConflict(...args) {
    method ignore (line 819) | ignore(...args) {
    method merge (line 823) | merge(...args) {

FILE: lib/queryBuilder/QueryBuilderContext.js
  class QueryBuilderContext (line 5) | class QueryBuilderContext extends QueryBuilderContextBase {
    method constructor (line 6) | constructor(builder) {
    method clone (line 14) | clone() {

FILE: lib/queryBuilder/QueryBuilderContextBase.js
  class QueryBuilderContextBase (line 5) | class QueryBuilderContextBase {
    method constructor (line 6) | constructor(builder) {
    method InternalOptions (line 15) | static get InternalOptions() {
    method clone (line 19) | clone() {

FILE: lib/queryBuilder/QueryBuilderOperationSupport.js
  class QueryBuilderOperationSupport (line 17) | class QueryBuilderOperationSupport {
    method constructor (line 18) | constructor(...args) {
    method init (line 22) | static init(self, modelClass) {
    method forClass (line 31) | static forClass(modelClass) {
    method AllSelector (line 35) | static get AllSelector() {
    method QueryBuilderContext (line 39) | static get QueryBuilderContext() {
    method QueryBuilderUserContext (line 43) | static get QueryBuilderUserContext() {
    method SelectSelector (line 47) | static get SelectSelector() {
    method WhereSelector (line 51) | static get WhereSelector() {
    method OnSelector (line 55) | static get OnSelector() {
    method JoinSelector (line 59) | static get JoinSelector() {
    method FromSelector (line 63) | static get FromSelector() {
    method OrderBySelector (line 67) | static get OrderBySelector() {
    method modelClass (line 71) | modelClass() {
    method context (line 75) | context(obj) {
    method clearContext (line 86) | clearContext() {
    method internalContext (line 92) | internalContext(ctx) {
    method internalOptions (line 101) | internalOptions(opt) {
    method isPartial (line 111) | isPartial(isPartial) {
    method isInternal (line 120) | isInternal() {
    method tableNameFor (line 124) | tableNameFor(tableName, newTableName) {
    method aliasFor (line 137) | aliasFor(tableName, alias) {
    method tableRefFor (line 150) | tableRefFor(tableName) {
    method childQueryOf (line 154) | childQueryOf(query, { fork, isInternalQuery } = {}) {
    method subqueryOf (line 180) | subqueryOf(query) {
    method parentQuery (line 200) | parentQuery() {
    method knex (line 204) | knex(...args) {
    method unsafeKnex (line 221) | unsafeKnex() {
    method clear (line 225) | clear(operationSelector) {
    method toFindQuery (line 243) | toFindQuery() {
    method clearSelect (line 272) | clearSelect() {
    method clearWhere (line 276) | clearWhere() {
    method clearOrder (line 280) | clearOrder() {
    method copyFrom (line 284) | copyFrom(queryBuilder, operationSelector) {
    method has (line 311) | has(operationSelector) {
    method forEachOperation (line 315) | forEachOperation(operationSelector, callback, match = true) {
    method findOperation (line 337) | findOperation(operationSelector) {
    method findLastOperation (line 348) | findLastOperation(operationSelector) {
    method everyOperation (line 358) | everyOperation(operationSelector) {
    method callOperationMethod (line 373) | callOperationMethod(operation, hookName, args) {
    method callAsyncOperationMethod (line 388) | async callAsyncOperationMethod(operation, hookName, args) {
    method addOperation (line 403) | addOperation(operation, args) {
    method addOperationToFront (line 408) | addOperationToFront(operation, args) {
    method addOperationUsingMethod (line 412) | addOperationUsingMethod(arrayMethod, operation, args) {
    method removeOperation (line 427) | removeOperation(operation) {
    method replaceOperation (line 441) | replaceOperation(operation, newOperation) {
    method clone (line 455) | clone() {
    method baseCloneInto (line 459) | baseCloneInto(builder) {
    method toKnexQuery (line 473) | toKnexQuery(knexBuilder = this.knex().queryBuilder()) {
    method executeOnBuild (line 478) | executeOnBuild() {
    method executeOnBuildKnex (line 486) | executeOnBuildKnex(knexBuilder) {
    method toString (line 499) | toString() {
    method toSql (line 503) | toSql() {
    method skipUndefined (line 507) | skipUndefined() {
  function buildFunctionForOperationSelector (line 514) | function buildFunctionForOperationSelector(operationSelector) {

FILE: lib/queryBuilder/QueryBuilderUserContext.js
  constant SYMBOL_BUILDER (line 3) | const SYMBOL_BUILDER = Symbol();
  class QueryBuilderUserContext (line 5) | class QueryBuilderUserContext {
    method constructor (line 6) | constructor(builder) {
    method transaction (line 12) | get transaction() {
    method newFromObject (line 16) | newFromObject(builder, obj) {
    method newMerge (line 22) | newMerge(builder, obj) {

FILE: lib/queryBuilder/RawBuilder.js
  class RawBuilder (line 6) | class RawBuilder {
    method constructor (line 7) | constructor(sql, args) {
    method alias (line 13) | get alias() {
    method as (line 17) | as(as) {
    method toKnexRaw (line 22) | toKnexRaw(builder) {
  function buildArray (line 54) | function buildArray(arr, builder) {
  function buildObject (line 58) | function buildObject(obj, builder) {
  function normalizeRawArgs (line 65) | function normalizeRawArgs(argsIn) {
  function raw (line 81) | function raw(...argsIn) {

FILE: lib/queryBuilder/ReferenceBuilder.js
  class ReferenceBuilder (line 6) | class ReferenceBuilder {
    method constructor (line 7) | constructor(expr) {
    method parsedExpr (line 25) | get parsedExpr() {
    method column (line 29) | get column() {
    method column (line 33) | set column(column) {
    method alias (line 37) | get alias() {
    method alias (line 41) | set alias(alias) {
    method tableName (line 45) | get tableName() {
    method tableName (line 49) | set tableName(table) {
    method modelClass (line 53) | get modelClass() {
    method modelClass (line 57) | set modelClass(modelClass) {
    method isPlainColumnRef (line 61) | get isPlainColumnRef() {
    method expression (line 67) | get expression() {
    method cast (line 71) | get cast() {
    method fullColumn (line 75) | fullColumn(builder) {
    method castText (line 89) | castText() {
    method castInt (line 93) | castInt() {
    method castBigInt (line 97) | castBigInt() {
    method castFloat (line 101) | castFloat() {
    method castDecimal (line 105) | castDecimal() {
    method castReal (line 109) | castReal() {
    method castBool (line 113) | castBool() {
    method castJson (line 117) | castJson() {
    method castTo (line 122) | castTo(sqlType) {
    method from (line 127) | from(table) {
    method table (line 132) | table(table) {
    method model (line 137) | model(modelClass) {
    method as (line 142) | as(alias) {
    method clone (line 147) | clone() {
    method toKnexRaw (line 162) | toKnexRaw(builder) {
    method _parseExpression (line 166) | _parseExpression(expr) {
    method _createRawArgs (line 172) | _createRawArgs(builder) {
    method _createReferenceSql (line 183) | _createReferenceSql(builder, bindings) {
    method _maybeCast (line 195) | _maybeCast(sql) {
    method _maybeToJsonb (line 203) | _maybeToJsonb(sql) {
    method _maybeAlias (line 211) | _maybeAlias(sql, bindings) {
    method _shouldAlias (line 220) | _shouldAlias() {

FILE: lib/queryBuilder/RelationExpression.js
  class RelationExpressionParseError (line 7) | class RelationExpressionParseError extends Error {}
  class DuplicateRelationError (line 8) | class DuplicateRelationError extends RelationExpressionParseError {
    method constructor (line 9) | constructor(relationName) {
  class RelationExpression (line 15) | class RelationExpression {
    method constructor (line 16) | constructor(node = newNode(), recursionDepth = 0) {
    method create (line 23) | static create(expr) {
    method fromModelGraph (line 50) | static fromModelGraph(graph) {
    method maxRecursionDepth (line 58) | get maxRecursionDepth() {
    method numChildren (line 66) | get numChildren() {
    method isEmpty (line 70) | get isEmpty() {
    method merge (line 76) | merge(expr) {
    method isSubExpression (line 89) | isSubExpression(expr) {
    method childExpression (line 124) | childExpression(childName) {
    method forEachChildExpression (line 142) | forEachChildExpression(modelClass, cb) {
    method expressionsAtPath (line 174) | expressionsAtPath(path) {
    method clone (line 178) | clone() {
    method toString (line 182) | toString() {
    method toPojo (line 186) | toPojo() {
    method toJSON (line 190) | toJSON() {
  function parse (line 196) | function parse(str) {
  function getChildNames (line 210) | function getChildNames(node) {
  function toString (line 226) | function toString(node) {
  function cloneNode (line 267) | function cloneNode(node) {
  function modelGraphToNode (line 271) | function modelGraphToNode(models, node) {
  function modelToNode (line 287) | function modelToNode(model, node) {
  function newNode (line 308) | function newNode(name = null, allRecusive = false) {
  function normalizeNode (line 312) | function normalizeNode(node = null, name = null, allRecusive = false) {
  function normalizeName (line 333) | function normalizeName(node, name) {
  function normalizeRelation (line 337) | function normalizeRelation(node, name) {
  function normalizeModify (line 341) | function normalizeModify(node) {
  function normalizeRecursive (line 349) | function normalizeRecursive(node) {
  function normalizeAllRecursive (line 353) | function normalizeAllRecursive(node, allRecusive) {
  function normalizeChildNames (line 357) | function normalizeChildNames(node) {
  function findExpressionsAtPath (line 361) | function findExpressionsAtPath(target, path, results) {
  function mergeNodes (line 379) | function mergeNodes(node1, node2) {
  function mergeRecursion (line 409) | function mergeRecursion(rec1, rec2) {

FILE: lib/queryBuilder/StaticHookArguments.js
  constant BUILDER_SYMBOL (line 5) | const BUILDER_SYMBOL = Symbol();
  class StaticHookArguments (line 7) | class StaticHookArguments {
    method constructor (line 8) | constructor({ builder, result = null }) {
    method create (line 21) | static create(args) {
    method asFindQuery (line 25) | get asFindQuery() {
    method context (line 31) | get context() {
    method transaction (line 35) | get transaction() {
    method relation (line 39) | get relation() {
    method modelOptions (line 49) | get modelOptions() {
    method items (line 59) | get items() {
    method inputItems (line 69) | get inputItems() {
    method cancelQuery (line 79) | get cancelQuery() {
  function getRelation (line 100) | function getRelation(op) {
  function hasRelation (line 104) | function hasRelation(op) {
  function getModelOptions (line 108) | function getModelOptions(op) {
  function hasModelOptions (line 112) | function hasModelOptions(op) {
  function getItems (line 116) | function getItems(op) {
  function hasItems (line 120) | function hasItems(op) {
  function getInputItems (line 124) | function getInputItems(op) {
  function hasInputItems (line 128) | function hasInputItems(op) {

FILE: lib/queryBuilder/ValueBuilder.js
  class ValueBuilder (line 6) | class ValueBuilder {
    method constructor (line 7) | constructor(value) {
    method cast (line 16) | get cast() {
    method castText (line 20) | castText() {
    method castInt (line 24) | castInt() {
    method castBigInt (line 28) | castBigInt() {
    method castFloat (line 32) | castFloat() {
    method castDecimal (line 36) | castDecimal() {
    method castReal (line 40) | castReal() {
    method castBool (line 44) | castBool() {
    method castJson (line 48) | castJson() {
    method castTo (line 55) | castTo(sqlType) {
    method asArray (line 60) | asArray() {
    method as (line 66) | as(alias) {
    method toKnexRaw (line 71) | toKnexRaw(builder) {
    method _createRawArgs (line 75) | _createRawArgs(builder) {
  function val (line 104) | function val(val) {

FILE: lib/queryBuilder/graph/GraphAction.js
  constant POSTGRES_MAX_INSERT_BATCH_SIZE (line 5) | const POSTGRES_MAX_INSERT_BATCH_SIZE = 100;
  constant MAX_CONCURRENCY (line 6) | const MAX_CONCURRENCY = 100;
  class GraphAction (line 8) | class GraphAction {
    method constructor (line 9) | constructor(graphData) {
    method ReturningAllSelector (line 13) | static get ReturningAllSelector() {
    method getConcurrency (line 20) | static getConcurrency(builder, nodes) {
    method graph (line 26) | get graph() {
    method currentGraph (line 30) | get currentGraph() {
    method graphOptions (line 34) | get graphOptions() {
    method run (line 38) | run(builder) {
    method _getConcurrency (line 42) | _getConcurrency(builder, nodes) {
    method _getBatchSize (line 46) | _getBatchSize(builder) {
    method _resolveReferences (line 50) | _resolveReferences(node) {
    method _resolveReference (line 56) | _resolveReference(node) {

FILE: lib/queryBuilder/graph/GraphData.js
  class GraphData (line 3) | class GraphData {
    method constructor (line 4) | constructor({ graph, currentGraph, graphOptions, nodeDbExistence }) {

FILE: lib/queryBuilder/graph/GraphFetcher.js
  class GraphFetcher (line 8) | class GraphFetcher {
    method fetchCurrentGraph (line 13) | static async fetchCurrentGraph({ builder, graph, graphOptions }) {
  function getRootIds (line 37) | function getRootIds(rootObjects) {
  function propagateMethodCallsFromQuery (line 43) | function propagateMethodCallsFromQuery(builder) {
  function buildFetchQuerySelects (line 54) | function buildFetchQuerySelects(graph, graphOptions, eagerExpr) {
  function groupNodesByRelationPath (line 70) | function groupNodesByRelationPath(graph, eagerExpr) {
  function createFetchSelectModifier (line 85) | function createFetchSelectModifier(nodes, graphOptions) {
  function createIdentifierSelector (line 96) | function createIdentifierSelector() {
  function createInputColumnSelector (line 103) | function createInputColumnSelector(nodes) {
  function shouldSelectColumn (line 137) | function shouldSelectColumn(column, selects, node) {
  function createManyToManyExtraSelectionIfNeeded (line 148) | function createManyToManyExtraSelectionIfNeeded(builder, column, node) {
  function createSelection (line 163) | function createSelection(builder, column, node) {
  function childQueryOptions (line 167) | function childQueryOptions() {
  function fetchQueryInternalOptions (line 174) | function fetchQueryInternalOptions() {
  function forEachPath (line 180) | function forEachPath(eagerExprNode, cb, path = []) {

FILE: lib/queryBuilder/graph/GraphNodeDbExistence.js
  class GraphNodeDbExistence (line 14) | class GraphNodeDbExistence {
    method createEveryNodeExistsExistence (line 15) | static createEveryNodeExistsExistence() {
    method create (line 25) | static async create({ builder, graph, graphOptions, currentGraph }) {
    method constructor (line 55) | constructor(dontExist) {
    method doesNodeExistInDb (line 59) | doesNodeExistInDb(node) {
  function createMayNotExistMap (line 70) | function createMayNotExistMap(graphData) {
  function hasNodeById (line 107) | function hasNodeById(currentGraph, nodeToFind) {
  function createDontExistMap (line 121) | async function createDontExistMap({ builder, mayNotExist, mayNotExistNod...
  function createExistenceCheckQueries (line 144) | function createExistenceCheckQueries({ builder, mayNotExist }) {
  function childQueryOptions (line 165) | function childQueryOptions() {
  function cloneExistenceMap (line 172) | function cloneExistenceMap(exixtenseMap) {

FILE: lib/queryBuilder/graph/GraphOperation.js
  class GraphOperation (line 3) | class GraphOperation {
    method constructor (line 4) | constructor(graphData) {
    method graph (line 8) | get graph() {
    method currentGraph (line 12) | get currentGraph() {
    method graphOptions (line 16) | get graphOptions() {
    method createActions (line 20) | createActions() {

FILE: lib/queryBuilder/graph/GraphOptions.js
  constant NO_RELATE (line 3) | const NO_RELATE = 'noRelate';
  constant NO_UNRELATE (line 4) | const NO_UNRELATE = 'noUnrelate';
  constant NO_INSERT (line 5) | const NO_INSERT = 'noInsert';
  constant NO_UPDATE (line 6) | const NO_UPDATE = 'noUpdate';
  constant NO_DELETE (line 7) | const NO_DELETE = 'noDelete';
  constant UPDATE (line 9) | const UPDATE = 'update';
  constant RELATE (line 10) | const RELATE = 'relate';
  constant UNRELATE (line 11) | const UNRELATE = 'unrelate';
  constant INSERT_MISSING (line 12) | const INSERT_MISSING = 'insertMissing';
  constant FETCH_STRATEGY (line 13) | const FETCH_STRATEGY = 'fetchStrategy';
  constant ALLOW_REFS (line 14) | const ALLOW_REFS = 'allowRefs';
  class GraphOptions (line 22) | class GraphOptions {
    method constructor (line 23) | constructor(options) {
    method isFetchStrategy (line 31) | isFetchStrategy(strategy) {
    method isInsertOnly (line 43) | isInsertOnly() {
    method shouldRelateIgnoreDisable (line 53) | shouldRelateIgnoreDisable(node, graphData) {
    method shouldRelate (line 68) | shouldRelate(node, graphData) {
    method shouldInsertIgnoreDisable (line 73) | shouldInsertIgnoreDisable(node, graphData) {
    method shouldInsert (line 81) | shouldInsert(node, graphData) {
    method shouldInsertMissing (line 85) | shouldInsertMissing(node) {
    method shouldPatchOrUpdateIgnoreDisable (line 91) | shouldPatchOrUpdateIgnoreDisable(node, graphData) {
    method shouldPatch (line 102) | shouldPatch(node, graphData) {
    method shouldUpdate (line 110) | shouldUpdate(node, graphData) {
    method shouldUnrelateIgnoreDisable (line 119) | shouldUnrelateIgnoreDisable(currentNode) {
    method shouldUnrelate (line 123) | shouldUnrelate(currentNode, graphData) {
    method shouldDelete (line 131) | shouldDelete(currentNode, graphData) {
    method shouldInsertOrRelate (line 139) | shouldInsertOrRelate(node, graphData) {
    method shouldDeleteOrUnrelate (line 143) | shouldDeleteOrUnrelate(currentNode, graphData) {
    method allowRefs (line 147) | allowRefs() {
    method rebasedOptions (line 151) | rebasedOptions(newRoot) {
    method _hasOption (line 171) | _hasOption(node, optionName) {
  function getCurrentNode (line 188) | function getCurrentNode(node, graphData) {
  function getNode (line 196) | function getNode(currentNode, graph) {

FILE: lib/queryBuilder/graph/GraphUpsert.js
  class GraphUpsert (line 18) | class GraphUpsert {
    method constructor (line 19) | constructor({ rootModelClass, objects, upsertOptions }) {
    method modelOptions (line 27) | static get modelOptions() {
    method run (line 31) | run(builder) {
  function checkCanBeConvertedToModels (line 46) | function checkCanBeConvertedToModels(modelClass, objects) {
  function assignDbRefsAsRelateProps (line 54) | function assignDbRefsAsRelateProps(graph) {
  function createGraphData (line 64) | async function createGraphData(builder, graphOptions, graph) {
  function fetchCurrentGraph (line 77) | function fetchCurrentGraph(builder, graphOptions, graph) {
  function pruneGraphs (line 88) | function pruneGraphs() {
  function pruneRelatedBranches (line 100) | function pruneRelatedBranches(graphData) {
  function pruneDeletedBranches (line 111) | function pruneDeletedBranches(graphData) {
  function findRoots (line 139) | function findRoots(nodes) {
  function removeBranchesFromGraph (line 159) | function removeBranchesFromGraph(branchRoots, graph) {
  function removeNodesFromGraph (line 170) | function removeNodesFromGraph(nodesToRemove, graph) {
  function checkForErrors (line 190) | function checkForErrors(builder) {
  function checkForNotFoundErrors (line 204) | function checkForNotFoundErrors(graphData, builder) {
  function checkForUnallowedRelationErrors (line 229) | function checkForUnallowedRelationErrors(graphData, builder) {
  function checkForUnallowedReferenceErrors (line 246) | function checkForUnallowedReferenceErrors(graphData, builder) {
  function checkForHasManyRelateErrors (line 262) | function checkForHasManyRelateErrors(graphData) {
  function executeOperations (line 277) | function executeOperations(builder) {
  function executeActions (line 292) | function executeActions(builder, actions) {
  function returnResult (line 299) | function returnResult(objects, isArray) {

FILE: lib/queryBuilder/graph/delete/GraphDelete.js
  class GraphDelete (line 6) | class GraphDelete extends GraphOperation {
    method createActions (line 7) | createActions() {

FILE: lib/queryBuilder/graph/delete/GraphDeleteAction.js
  class GraphDeleteAction (line 7) | class GraphDeleteAction extends GraphAction {
    method constructor (line 8) | constructor(graphData, { nodes }) {
    method run (line 14) | run(builder) {
    method _filterOutBelongsToOneRelationUnrelates (line 23) | _filterOutBelongsToOneRelationUnrelates(nodes) {
    method _createDeleteBuilders (line 35) | _createDeleteBuilders(parentBuilder, nodesTodelete) {
  function getRelation (line 64) | function getRelation(node) {
  function getParent (line 68) | function getParent(node) {

FILE: lib/queryBuilder/graph/insert/GraphInsert.js
  class GraphInsert (line 8) | class GraphInsert extends GraphOperation {
    method constructor (line 9) | constructor(...args) {
    method createActions (line 14) | createActions() {
    method _createDependencyMap (line 18) | _createDependencyMap() {
    method _createRelationDependency (line 32) | _createRelationDependency(edge, dependencies) {
    method _createReferenceDependency (line 44) | _createReferenceDependency(edge, dependencies) {
    method _addDependency (line 48) | _addDependency(node, edge, dependencies) {
    method _createNormalActions (line 59) | _createNormalActions() {
    method _isHandled (line 95) | _isHandled(node, handledNodes) {
    method _hasDependencies (line 99) | _hasDependencies(node, handledNodes) {
    method _markHandled (line 115) | _markHandled(node, handledNodes) {
    method _createJoinRowActions (line 128) | _createJoinRowActions() {

FILE: lib/queryBuilder/graph/insert/GraphInsertAction.js
  class GraphInsertAction (line 16) | class GraphInsertAction extends GraphAction {
    method constructor (line 17) | constructor(graphData, { nodes, dependencies }) {
    method run (line 25) | run(builder) {
    method _createInsertBatches (line 32) | _createInsertBatches(builder) {
    method _insertBatch (line 46) | async _insertBatch(parentBuilder, nodes) {
    method _beforeInsert (line 52) | _beforeInsert(nodes) {
    method _resolveDependencies (line 60) | _resolveDependencies(nodes) {
    method _resolveDependency (line 75) | _resolveDependency(dependencyNode, edge) {
    method _resolveRelationDependency (line 83) | _resolveRelationDependency(dependencyNode, edge) {
    method _resolvePropertyReferenceNode (line 104) | _resolvePropertyReferenceNode(dependencyNode, edge) {
    method _omitManyToManyExtraProps (line 128) | _omitManyToManyExtraProps(nodes) {
    method _copyRelationPropsFromCurrentIfNeeded (line 140) | _copyRelationPropsFromCurrentIfNeeded(nodes) {
    method _insert (line 168) | _insert(parentBuilder, nodes) {
    method _runRelationBeforeInsertMethods (line 198) | _runRelationBeforeInsertMethods(parentBuilder, nodes) {
    method _afterInsert (line 210) | _afterInsert(nodes) {
  function getModelClass (line 219) | function getModelClass(node) {

FILE: lib/queryBuilder/graph/insert/JoinRowGraphInsertAction.js
  class JoinRowGraphInsertAction (line 7) | class JoinRowGraphInsertAction extends GraphAction {
    method constructor (line 8) | constructor(graphData, { nodes }) {
    method run (line 13) | run(builder) {
    method _createInsertBatches (line 20) | _createInsertBatches(builder) {
    method _createBatch (line 34) | _createBatch(joinTableModelClass, nodes) {
    method _createJoinTableObj (line 46) | _createJoinTableObj(joinTableModelClass, node) {
    method _insertBatch (line 57) | _insertBatch(parentBuilder, batch) {
    method _beforeInsert (line 61) | _beforeInsert(parentBuilder, batch) {
    method _insert (line 76) | _insert(parentBuilder, batch) {
  function getJoinTableModel (line 86) | function getJoinTableModel(builder, node) {

FILE: lib/queryBuilder/graph/patch/GraphPatch.js
  class GraphPatch (line 6) | class GraphPatch extends GraphOperation {
    method createActions (line 7) | createActions() {

FILE: lib/queryBuilder/graph/patch/GraphPatchAction.js
  class GraphPatchAction (line 9) | class GraphPatchAction extends GraphAction {
    method constructor (line 10) | constructor(graphData, { nodes }) {
    method run (line 16) | run(builder) {
    method _runForNode (line 22) | _runForNode(builder, node) {
    method _handleBelongsToOneInserts (line 116) | _handleBelongsToOneInserts(node) {
    method _handleBelongsToOneDeletes (line 144) | _handleBelongsToOneDeletes(node) {
    method _findChanges (line 175) | _findChanges(node) {
    method _hasNonIdPropertyChanges (line 214) | _hasNonIdPropertyChanges(node) {
    method _createBuilder (line 219) | _createBuilder(node) {
    method _createRelatedBuilder (line 227) | _createRelatedBuilder(node) {
    method _createRootBuilder (line 233) | _createRootBuilder(node) {
  function childQueryOptions (line 241) | function childQueryOptions() {
  function nonStrictEquals (line 248) | function nonStrictEquals(val1, val2) {

FILE: lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsert.js
  class GraphRecursiveUpsert (line 6) | class GraphRecursiveUpsert extends GraphOperation {
    method createActions (line 7) | createActions() {
  function hasRelations (line 19) | function hasRelations(obj) {

FILE: lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsertAction.js
  class GraphRecursiveUpsertAction (line 8) | class GraphRecursiveUpsertAction extends GraphAction {
    method constructor (line 9) | constructor(graphData, { nodes }) {
    method run (line 15) | run(builder) {
    method _createUpsertBuilders (line 23) | _createUpsertBuilders(parentBuilder, nodesToUpsert) {
    method _resolveReferences (line 60) | _resolveReferences(node) {
    method _resolveReferencesForObject (line 64) | _resolveReferencesForObject(obj) {
    method _resolveObjectReference (line 69) | _resolveObjectReference(obj) {
    method _resolvePropertyReferences (line 96) | _resolvePropertyReferences(obj) {
  function getRelation (line 116) | function getRelation(node) {
  function getParent (line 120) | function getParent(node) {

FILE: lib/queryBuilder/join/JoinResultColumn.js
  class JoinResultColumn (line 3) | class JoinResultColumn {
    method constructor (line 4) | constructor({ columnAlias, tableNode, name }) {
    method create (line 10) | static create({ tableTree, columnAlias }) {

FILE: lib/queryBuilder/join/JoinResultParser.js
  class JoinResultParser (line 6) | class JoinResultParser {
    method constructor (line 7) | constructor({ tableTree, omitColumnAliases = [] }) {
    method create (line 16) | static create(args) {
    method parse (line 20) | parse(flatRows) {
    method _parseNode (line 36) | _parseNode(tableNode, flatRow, parentModel = null, parentKey = null) {
    method _createModel (line 58) | _createModel(tableNode, flatRow) {
    method _addToParent (line 83) | _addToParent(tableNode, model, parentModel) {
    method _createColumns (line 96) | _createColumns(row) {
  function getTableNode (line 105) | function getTableNode(column) {
  function getKey (line 109) | function getKey(parentKey, id, tableNode) {

FILE: lib/queryBuilder/join/RelationJoiner.js
  class RelationJoiner (line 16) | class RelationJoiner {
    method constructor (line 17) | constructor({ modelClass }) {
    method setExpression (line 31) | setExpression(expression) {
    method setModifiers (line 39) | setModifiers(modifiers) {
    method setOptions (line 47) | setOptions(options) {
    method fetchColumnInfo (line 58) | fetchColumnInfo(builder) {
    method build (line 71) | build(builder, buildSelects = true) {
    method parseResult (line 84) | parseResult(builder, flatRows) {
    method _getTableTree (line 93) | _getTableTree(builder) {
    method _buildJoinsForNode (line 107) | _buildJoinsForNode({ builder, tableNode, userSelectQueries }) {
    method _buildSelects (line 142) | _buildSelects({ builder, tableNode, userSelectQueries }) {
  function defaultOptions (line 162) | function defaultOptions() {
  function createSubqueryToJoin (line 171) | function createSubqueryToJoin({ builder, tableNode, modifiers }) {
  function ensureIdAndRelationPropsAreSelected (line 199) | function ensureIdAndRelationPropsAreSelected({ builder, tableNode }) {
  function getSelectionsForNode (line 218) | function getSelectionsForNode({ builder, tableNode, userSelectQueries }) {
  function mapUserSelectionsFromSubqueryToMainQuery (line 262) | function mapUserSelectionsFromSubqueryToMainQuery({ userSelections, tabl...
  function getJoinTableExtraSelectionsForNode (line 272) | function getJoinTableExtraSelectionsForNode({ builder, tableNode }) {
  function getAllColumnSelectionsForNode (line 282) | function getAllColumnSelectionsForNode({ builder, tableNode }) {
  function getIdSelectionsForNode (line 301) | function getIdSelectionsForNode({ tableNode }) {
  function selectionsToStrings (line 311) | function selectionsToStrings(selections) {
  function isSelectAll (line 318) | function isSelectAll(selection) {
  function isNotSelectAll (line 322) | function isNotSelectAll(selection) {
  function isSelectAllSelectionSet (line 326) | function isSelectAllSelectionSet(selections) {
  function checkAliasLength (line 330) | function checkAliasLength(modelClass, alias) {

FILE: lib/queryBuilder/join/TableNode.js
  class TableNode (line 3) | class TableNode {
    method constructor (line 4) | constructor({ tableTree, modelClass, expression, parentNode = null, re...
    method create (line 16) | static create(args) {
    method options (line 26) | get options() {
    method relationProperty (line 30) | get relationProperty() {
    method getReferenceForColumn (line 34) | getReferenceForColumn(column) {
    method getColumnAliasForColumn (line 38) | getColumnAliasForColumn(column) {
    method getColumnForColumnAlias (line 46) | getColumnForColumnAlias(columnAlias) {
    method getIdFromFlatRow (line 56) | getIdFromFlatRow(flatRow) {
    method getJoinTableAlias (line 60) | getJoinTableAlias(builder) {
    method _calculateAlias (line 71) | _calculateAlias() {
    method _createIdGetter (line 88) | _createIdGetter() {
  function createIdGetter (line 100) | function createIdGetter(columnAliases) {
  function createCompositeIdGetter (line 114) | function createCompositeIdGetter(columnAliases) {
  function createTwoIdGetter (line 122) | function createTwoIdGetter(columnAliases) {
  function createMultiIdGetter (line 138) | function createMultiIdGetter(columnAliases) {

FILE: lib/queryBuilder/join/TableTree.js
  class TableTree (line 6) | class TableTree {
    method constructor (line 7) | constructor({ expression, rootModelClass, rootTableAlias, options }) {
    method create (line 18) | static create(args) {
    method rootNode (line 22) | get rootNode() {
    method getNodeForColumnAlias (line 26) | getNodeForColumnAlias(columnAlias) {
    method createNextUid (line 37) | createNextUid() {
    method _createNodes (line 41) | _createNodes({ expression, modelClass }) {
    method _createRootNode (line 50) | _createRootNode({ expression, modelClass }) {
    method _createChildNodes (line 61) | _createChildNodes({ expression, modelClass, parentNode }) {

FILE: lib/queryBuilder/join/utils.js
  constant ID_LENGTH_LIMIT (line 5) | const ID_LENGTH_LIMIT = 63;
  constant RELATION_RECURSION_LIMIT (line 6) | const RELATION_RECURSION_LIMIT = 64;
  function forEachChildExpression (line 9) | function forEachChildExpression(expr, modelClass, callback) {

FILE: lib/queryBuilder/operations/DelegateOperation.js
  class DelegateOperation (line 7) | class DelegateOperation extends QueryBuilderOperation {
    method constructor (line 8) | constructor(name, opt) {
    method modelOptions (line 14) | get modelOptions() {
    method is (line 18) | is(OperationClass) {
    method onAdd (line 22) | onAdd(builder, args) {
    method onBefore1 (line 26) | onBefore1(builder, result) {
    method hasOnBefore1 (line 30) | hasOnBefore1() {
    method onBefore2 (line 34) | onBefore2(builder, result) {
    method hasOnBefore2 (line 38) | hasOnBefore2() {
    method onBefore3 (line 42) | onBefore3(builder, result) {
    method hasOnBefore3 (line 46) | hasOnBefore3() {
    method onBuild (line 50) | onBuild(builder) {
    method hasOnBuild (line 54) | hasOnBuild() {
    method onBuildKnex (line 58) | onBuildKnex(knexBuilder, builder) {
    method hasOnBuildKnex (line 62) | hasOnBuildKnex() {
    method onRawResult (line 68) | onRawResult(builder, result) {
    method hasOnRawResult (line 72) | hasOnRawResult() {
    method onAfter1 (line 78) | onAfter1(builder, result) {
    method hasOnAfter1 (line 82) | hasOnAfter1() {
    method onAfter2 (line 86) | onAfter2(builder, result) {
    method hasOnAfter2 (line 90) | hasOnAfter2() {
    method onAfter3 (line 94) | onAfter3(builder, result) {
    method hasOnAfter3 (line 98) | hasOnAfter3() {
    method queryExecutor (line 102) | queryExecutor(builder) {
    method hasQueryExecutor (line 106) | hasQueryExecutor() {
    method onError (line 113) | onError(builder, error) {
    method hasOnError (line 117) | hasOnError() {
    method toFindOperation (line 121) | toFindOperation(builder) {
    method hasToFindOperation (line 125) | hasToFindOperation() {
    method clone (line 132) | clone() {

FILE: lib/queryBuilder/operations/DeleteOperation.js
  class DeleteOperation (line 6) | class DeleteOperation extends QueryBuilderOperation {
    method onBefore2 (line 7) | async onBefore2(builder, result) {
    method onBuildKnex (line 12) | onBuildKnex(knexBuilder) {
    method onAfter2 (line 16) | onAfter2(builder, result) {
    method toFindOperation (line 20) | toFindOperation() {
  function callBeforeDelete (line 25) | function callBeforeDelete(builder) {
  function callStaticBeforeDelete (line 29) | function callStaticBeforeDelete(builder) {
  function callAfterDelete (line 34) | function callAfterDelete(builder, result) {
  function callStaticAfterDelete (line 38) | async function callStaticAfterDelete(builder, result) {

FILE: lib/queryBuilder/operations/FindByIdOperation.js
  class FindByIdOperation (line 6) | class FindByIdOperation extends QueryBuilderOperation {
    method constructor (line 7) | constructor(name, opt) {
    method onAdd (line 12) | onAdd(builder, args) {
    method onBuild (line 20) | onBuild(builder) {
    method clone (line 28) | clone() {

FILE: lib/queryBuilder/operations/FindByIdsOperation.js
  class FindByIdsOperation (line 5) | class FindByIdsOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 11) | onAdd(builder, args) {
    method onBuild (line 16) | onBuild(builder) {
    method clone (line 20) | clone() {

FILE: lib/queryBuilder/operations/FindOperation.js
  class FindOperation (line 8) | class FindOperation extends QueryBuilderOperation {
    method onBefore2 (line 9) | onBefore2(builder, result) {
    method onAfter3 (line 13) | onAfter3(builder, results) {
  function callStaticBeforeFind (line 24) | function callStaticBeforeFind(builder) {
  function callAfterFind (line 29) | function callAfterFind(builder, result) {
  function callStaticAfterFind (line 36) | function callStaticAfterFind(builder, result) {
  function callInstanceAfterFind (line 49) | function callInstanceAfterFind(ctx, results, deep) {
  function callAfterFindArray (line 61) | function callAfterFindArray(ctx, results, deep) {
  function callAfterFindForOne (line 84) | function callAfterFindForOne(ctx, model, result, deep) {
  function callAfterFindForRelations (line 105) | function callAfterFindForRelations(ctx, model, results) {
  function isRelation (line 127) | function isRelation(value) {
  function isNonEmptyObjectArray (line 134) | function isNonEmptyObjectArray(value) {
  function doCallAfterFind (line 138) | function doCallAfterFind(ctx, model, result) {
  function getAfterFindHook (line 154) | function getAfterFindHook(model) {

FILE: lib/queryBuilder/operations/FirstOperation.js
  class FirstOperation (line 5) | class FirstOperation extends QueryBuilderOperation {
    method onBuildKnex (line 6) | onBuildKnex(knexBuilder, builder) {
    method onAfter3 (line 16) | onAfter3(_, result) {

FILE: lib/queryBuilder/operations/FromOperation.js
  constant ALIAS_REGEX (line 6) | const ALIAS_REGEX = /\s+as\s+/i;
  class FromOperation (line 12) | class FromOperation extends ObjectionToKnexConvertingOperation {
    method constructor (line 13) | constructor(name, opt) {
    method onAdd (line 20) | onAdd(builder, args) {
    method onBuildKnex (line 37) | onBuildKnex(knexBuilder, builder) {
    method clone (line 42) | clone() {
  function parseTableAndAlias (line 52) | function parseTableAndAlias(arg, builder) {
  function parseTableAndAliasFromString (line 66) | function parseTableAndAliasFromString(arg) {
  function parseTableAndAliasFromObject (line 82) | function parseTableAndAliasFromObject(arg, builder) {

FILE: lib/queryBuilder/operations/InsertAndFetchOperation.js
  class InsertAndFetchOperation (line 8) | class InsertAndFetchOperation extends DelegateOperation {
    method constructor (line 9) | constructor(name, opt) {
    method models (line 17) | get models() {
    method onAfter2 (line 21) | async onAfter2(builder, inserted) {

FILE: lib/queryBuilder/operations/InsertGraphAndFetchOperation.js
  class InsertGraphAndFetchOperation (line 7) | class InsertGraphAndFetchOperation extends DelegateOperation {
    method constructor (line 8) | constructor(name, opt) {
    method models (line 16) | get models() {
    method isArray (line 20) | get isArray() {
    method onAfter2 (line 24) | async onAfter2(builder) {

FILE: lib/queryBuilder/operations/InsertGraphOperation.js
  class InsertGraphOperation (line 7) | class InsertGraphOperation extends DelegateOperation {
    method constructor (line 8) | constructor(name, opt = null) {
    method models (line 20) | get models() {
    method isArray (line 24) | get isArray() {
    method relation (line 28) | get relation() {
    method onAdd (line 32) | onAdd(builder, args) {
    method onBefore1 (line 54) | onBefore1(_, result) {
    method onBefore2 (line 59) | onBefore2(builder, result) {
    method onBefore3 (line 72) | onBefore3(_, result) {
    method onBuild (line 77) | onBuild() {
    method onBuildKnex (line 81) | onBuildKnex(knexBuilder) {
    method onAfter1 (line 88) | async onAfter1(builder, ...restArgs) {
    method onAfter2 (line 93) | onAfter2() {
    method clone (line 99) | clone() {

FILE: lib/queryBuilder/operations/InsertOperation.js
  class InsertOperation (line 10) | class InsertOperation extends QueryBuilderOperation {
    method constructor (line 11) | constructor(name, opt) {
    method onAdd (line 19) | onAdd(builder, args) {
    method onBefore2 (line 29) | async onBefore2(builder, result) {
    method onBuildKnex (line 38) | onBuildKnex(knexBuilder, builder) {
    method onAfter1 (line 48) | onAfter1(_, ret) {
    method onAfter2 (line 76) | onAfter2(builder, models) {
    method toFindOperation (line 81) | toFindOperation() {
    method clone (line 85) | clone() {
  function callBeforeInsert (line 95) | function callBeforeInsert(builder, models) {
  function callInstanceBeforeInsert (line 100) | function callInstanceBeforeInsert(builder, models) {
  function callStaticBeforeInsert (line 104) | function callStaticBeforeInsert(builder) {
  function callAfterInsert (line 109) | function callAfterInsert(builder, models, result) {
  function callInstanceAfterInsert (line 114) | function callInstanceAfterInsert(builder, models) {
  function callStaticAfterInsert (line 118) | function callStaticAfterInsert(builder, result) {

FILE: lib/queryBuilder/operations/InstanceDeleteOperation.js
  class InstanceDeleteOperation (line 7) | class InstanceDeleteOperation extends DeleteOperation {
    method constructor (line 8) | constructor(name, opt) {
    method onBefore2 (line 13) | async onBefore2(builder, result) {
    method onBuild (line 19) | onBuild(builder) {
    method onAfter2 (line 26) | async onAfter2(builder, result) {
    method toFindOperation (line 36) | toFindOperation() {

FILE: lib/queryBuilder/operations/InstanceFindOperation.js
  class InstanceFindOperation (line 6) | class InstanceFindOperation extends FindOperation {
    method constructor (line 7) | constructor(name, opt) {
    method onBuild (line 12) | onBuild(builder) {

FILE: lib/queryBuilder/operations/InstanceInsertOperation.js
  class InstanceInsertOperation (line 5) | class InstanceInsertOperation extends InsertOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 11) | onAdd(builder, args) {

FILE: lib/queryBuilder/operations/InstanceUpdateOperation.js
  class InstanceUpdateOperation (line 8) | class InstanceUpdateOperation extends UpdateOperation {
    method constructor (line 9) | constructor(name, opt) {
    method onAdd (line 16) | onAdd(builder, args) {
    method onBuild (line 26) | onBuild(builder) {
    method onAfter2 (line 33) | async onAfter2(builder, result) {
    method toFindOperation (line 49) | toFindOperation() {

FILE: lib/queryBuilder/operations/JoinRelatedOperation.js
  class JoinRelatedOperation (line 8) | class JoinRelatedOperation extends QueryBuilderOperation {
    method constructor (line 9) | constructor(name, opt) {
    method joinOperation (line 14) | get joinOperation() {
    method addCall (line 18) | addCall(call) {
    method onBuild (line 22) | onBuild(builder) {
    method clone (line 53) | clone() {
  function applyAlias (line 60) | function applyAlias(expr, modelClass, builder, options) {
  function applyAliases (line 79) | function applyAliases(expr, modelClass, options) {
  function renameRelationExpressionNode (line 93) | function renameRelationExpressionNode(expr, oldName, newName) {

FILE: lib/queryBuilder/operations/KnexOperation.js
  class KnexOperation (line 6) | class KnexOperation extends ObjectionToKnexConvertingOperation {
    method onBuildKnex (line 7) | onBuildKnex(knexBuilder, builder) {

FILE: lib/queryBuilder/operations/MergeOperation.js
  class MergeOperation (line 7) | class MergeOperation extends QueryBuilderOperation {
    method constructor (line 8) | constructor(name, opt) {
    method onAdd (line 14) | onAdd(builder, args) {
    method onBuildKnex (line 27) | onBuildKnex(knexBuilder, builder) {
    method toFindOperation (line 42) | toFindOperation() {
    method clone (line 46) | clone() {

FILE: lib/queryBuilder/operations/ObjectionToKnexConvertingOperation.js
  class ObjectionToKnexConvertingOperation (line 12) | class ObjectionToKnexConvertingOperation extends QueryBuilderOperation {
    method constructor (line 13) | constructor(name, opt) {
    method getKnexArgs (line 18) | getKnexArgs(builder) {
    method onAdd (line 22) | onAdd(builder, args) {
    method clone (line 27) | clone() {
  function shouldBeAdded (line 34) | function shouldBeAdded(opName, builder, args) {
  function convertArgs (line 54) | function convertArgs(opName, builder, args) {
  function isUndefined (line 76) | function isUndefined(item) {
  function hasToKnexRawMethod (line 80) | function hasToKnexRawMethod(item) {
  function convertToKnexRaw (line 84) | function convertToKnexRaw(item, builder) {
  function isObjectionQueryBuilderBase (line 88) | function isObjectionQueryBuilderBase(item) {
  function convertQueryBuilderBase (line 92) | function convertQueryBuilderBase(item, builder) {
  function isArray (line 97) | function isArray(item) {
  function convertArray (line 101) | function convertArray(arr, builder, i, opName, skipUndefined) {
  function convertFunction (line 119) | function convertFunction(func, builder) {
  function convertQueryBuilderFunction (line 131) | function convertQueryBuilderFunction(knexQueryBuilder, func, builder) {
  function convertJoinBuilderFunction (line 140) | function convertJoinBuilderFunction(knexJoinBuilder, func, builder) {
  function isModel (line 150) | function isModel(item) {
  function convertModel (line 154) | function convertModel(model) {
  function convertPlainObject (line 158) | function convertPlainObject(obj, builder, i, opName, skipUndefined) {

FILE: lib/queryBuilder/operations/OnBuildKnexOperation.js
  class OnBuildKnexOperation (line 5) | class OnBuildKnexOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 11) | onAdd(_, args) {
    method onBuildKnex (line 16) | onBuildKnex(knexBuilder, builder) {
    method clone (line 20) | clone() {

FILE: lib/queryBuilder/operations/OnBuildOperation.js
  class OnBuildOperation (line 5) | class OnBuildOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 11) | onAdd(_, args) {
    method onBuild (line 16) | onBuild(builder) {
    method clone (line 20) | clone() {

FILE: lib/queryBuilder/operations/OnErrorOperation.js
  class OnErrorOperation (line 5) | class OnErrorOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 11) | onAdd(_, args) {
    method onError (line 16) | onError(builder, error) {
    method clone (line 20) | clone() {

FILE: lib/queryBuilder/operations/QueryBuilderOperation.js
  class QueryBuilderOperation (line 30) | class QueryBuilderOperation {
    method constructor (line 31) | constructor(name = null, opt = {}) {
    method is (line 46) | is(OperationClass) {
    method hasHook (line 50) | hasHook(hookName) {
    method onAdd (line 58) | onAdd(builder, args) {
    method hasOnAdd (line 61) | hasOnAdd() {
    method onBefore1 (line 70) | onBefore1(builder, result) {}
    method hasOnBefore1 (line 71) | hasOnBefore1() {
    method onBefore2 (line 80) | onBefore2(builder, result) {}
    method hasOnBefore2 (line 81) | hasOnBefore2() {
    method onBefore3 (line 90) | onBefore3(builder, result) {}
    method hasOnBefore3 (line 91) | hasOnBefore3() {
    method onBuild (line 102) | onBuild(builder) {}
    method hasOnBuild (line 103) | hasOnBuild() {
    method onBuildKnex (line 114) | onBuildKnex(knexBuilder, builder) {
    method hasOnBuildKnex (line 117) | hasOnBuildKnex() {
    method onRawResult (line 127) | onRawResult(builder, rows) {
    method hasOnRawResult (line 130) | hasOnRawResult() {
    method onAfter1 (line 138) | onAfter1(builder, result) {
    method hasOnAfter1 (line 141) | hasOnAfter1() {
    method onAfter2 (line 149) | onAfter2(builder, result) {
    method hasOnAfter2 (line 152) | hasOnAfter2() {
    method onAfter3 (line 160) | onAfter3(builder, result) {
    method hasOnAfter3 (line 163) | hasOnAfter3() {
    method queryExecutor (line 172) | queryExecutor(builder) {}
    method hasQueryExecutor (line 173) | hasQueryExecutor() {
    method onError (line 180) | onError(builder, error) {}
    method hasOnError (line 181) | hasOnError() {
    method toFindOperation (line 191) | toFindOperation(builder) {
    method hasToFindOperation (line 194) | hasToFindOperation() {
    method isAncestorInSet (line 200) | isAncestorInSet(operationSet) {
    method clone (line 215) | clone() {
    method addChildOperation (line 233) | addChildOperation(hookName, operation) {
    method removeChildOperation (line 241) | removeChildOperation(operation) {
    method replaceChildOperation (line 251) | replaceChildOperation(operation, newOperation) {
    method removeChildOperationsByHookName (line 263) | removeChildOperationsByHookName(hookName) {
    method forEachDescendantOperation (line 268) | forEachDescendantOperation(callback) {

FILE: lib/queryBuilder/operations/RangeOperation.js
  class RangeOperation (line 5) | class RangeOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 11) | onAdd(builder, args) {
    method onBefore1 (line 24) | onBefore1(builder, result) {
    method onAfter3 (line 29) | async onAfter3(_, results) {
    method clone (line 38) | clone() {

FILE: lib/queryBuilder/operations/RelateOperation.js
  class RelateOperation (line 5) | class RelateOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method clone (line 15) | clone() {

FILE: lib/queryBuilder/operations/ReturningOperation.js
  class ReturningOperation (line 10) | class ReturningOperation extends ObjectionToKnexConvertingOperation {
    method onAdd (line 11) | onAdd(builder, args) {
    method onBuildKnex (line 22) | onBuildKnex(knexBuilder, builder) {

FILE: lib/queryBuilder/operations/RunAfterOperation.js
  class RunAfterOperation (line 5) | class RunAfterOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 11) | onAdd(_, args) {
    method onAfter3 (line 16) | onAfter3(builder, result) {
    method clone (line 20) | clone() {

FILE: lib/queryBuilder/operations/RunBeforeOperation.js
  class RunBeforeOperation (line 5) | class RunBeforeOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 11) | onAdd(_, args) {
    method onBefore1 (line 16) | onBefore1(builder, result) {
    method clone (line 20) | clone() {

FILE: lib/queryBuilder/operations/UnrelateOperation.js
  class UnrelateOperation (line 5) | class UnrelateOperation extends QueryBuilderOperation {
    method constructor (line 6) | constructor(name, opt) {
    method clone (line 14) | clone() {

FILE: lib/queryBuilder/operations/UpdateAndFetchOperation.js
  class UpdateAndFetchOperation (line 7) | class UpdateAndFetchOperation extends DelegateOperation {
    method constructor (line 8) | constructor(name, opt) {
    method model (line 19) | get model() {
    method onAdd (line 23) | onAdd(builder, args) {
    method onBuild (line 28) | onBuild(builder) {
    method onAfter2 (line 36) | async onAfter2(builder, numUpdated) {
    method toFindOperation (line 61) | toFindOperation() {
    method clone (line 67) | clone() {

FILE: lib/queryBuilder/operations/UpdateOperation.js
  class UpdateOperation (line 9) | class UpdateOperation extends QueryBuilderOperation {
    method constructor (line 10) | constructor(name, opt) {
    method onAdd (line 17) | onAdd(builder, args) {
    method onBefore2 (line 25) | async onBefore2(builder, result) {
    method onBefore3 (line 30) | onBefore3(builder) {
    method onBuildKnex (line 39) | onBuildKnex(knexBuilder, builder) {
    method onAfter2 (line 46) | onAfter2(builder, numUpdated) {
    method toFindOperation (line 50) | toFindOperation() {
    method clone (line 54) | clone() {
  function callBeforeUpdate (line 61) | async function callBeforeUpdate(builder, model, modelOptions) {
  function callInstanceBeforeUpdate (line 66) | function callInstanceBeforeUpdate(builder, model, modelOptions) {
  function callStaticBeforeUpdate (line 70) | function callStaticBeforeUpdate(builder) {
  function callAfterUpdate (line 75) | async function callAfterUpdate(builder, model, modelOptions, result) {
  function callInstanceAfterUpdate (line 80) | function callInstanceAfterUpdate(builder, model, modelOptions) {
  function callStaticAfterUpdate (line 84) | async function callStaticAfterUpdate(builder, result) {
  function convertFieldExpressionsToRaw (line 95) | function convertFieldExpressionsToRaw(builder, model, json) {

FILE: lib/queryBuilder/operations/UpsertGraphAndFetchOperation.js
  class UpsertGraphAndFetchOperation (line 7) | class UpsertGraphAndFetchOperation extends DelegateOperation {
    method constructor (line 8) | constructor(name, opt) {
    method models (line 16) | get models() {
    method isArray (line 20) | get isArray() {
    method onAfter3 (line 24) | async onAfter3(builder) {

FILE: lib/queryBuilder/operations/UpsertGraphOperation.js
  class UpsertGraphOperation (line 7) | class UpsertGraphOperation extends QueryBuilderOperation {
    method constructor (line 8) | constructor(name, opt) {
    method models (line 20) | get models() {
    method isArray (line 24) | get isArray() {
    method onAdd (line 28) | onAdd(builder, args) {
    method onAfter1 (line 43) | onAfter1(builder) {
    method clone (line 53) | clone() {
  function hasOtherSqlModifyingQueryBuilderCalls (line 60) | function hasOtherSqlModifyingQueryBuilderCalls(builder) {

FILE: lib/queryBuilder/operations/WhereCompositeOperation.js
  class WhereCompositeOperation (line 6) | class WhereCompositeOperation extends ObjectionToKnexConvertingOperation {
    method onBuildKnex (line 7) | onBuildKnex(knexBuilder, builder) {
  function buildWhereArgs (line 21) | function buildWhereArgs(cols, op, values) {
  function isNormalWhere (line 31) | function isNormalWhere(cols, values) {
  function buildNormalWhereArgs (line 37) | function buildNormalWhereArgs(cols, op, values) {
  function isCompositeWhere (line 41) | function isCompositeWhere(cols, values) {
  function buildCompositeWhereArgs (line 45) | function buildCompositeWhereArgs(cols, op, values) {

FILE: lib/queryBuilder/operations/eager/EagerOperation.js
  class EagerOperation (line 6) | class EagerOperation extends QueryBuilderOperation {
    method constructor (line 7) | constructor(name, opt) {
    method buildFinalExpression (line 15) | buildFinalExpression() {
    method buildFinalModifiers (line 29) | buildFinalModifiers(builder) {
    method cloneFrom (line 42) | cloneFrom(eagerOp) {
    method clone (line 48) | clone() {
  function getModifierName (line 55) | function getModifierName(index) {

FILE: lib/queryBuilder/operations/eager/JoinEagerOperation.js
  class JoinEagerOperation (line 6) | class JoinEagerOperation extends EagerOperation {
    method constructor (line 7) | constructor(name, opt) {
    method onAdd (line 12) | onAdd(builder) {
    method onBefore3 (line 22) | onBefore3(builder) {
    method onBuild (line 30) | onBuild(builder) {
    method onRawResult (line 38) | onRawResult(builder, rows) {
    method clone (line 42) | clone() {

FILE: lib/queryBuilder/operations/eager/NaiveEagerOperation.js
  class NaiveEagerOperation (line 5) | class NaiveEagerOperation extends WhereInEagerOperation {
    method batchSize (line 6) | batchSize() {

FILE: lib/queryBuilder/operations/eager/WhereInEagerOperation.js
  class WhereInEagerOperation (line 13) | class WhereInEagerOperation extends EagerOperation {
    method constructor (line 14) | constructor(name, opt) {
    method batchSize (line 21) | batchSize(knex) {
    method onBuild (line 41) | onBuild(builder) {
    method onAfter2 (line 57) | async onAfter2(builder, result) {
    method fetchRelation (line 96) | async fetchRelation(builder, models, relation, expr) {
    method fetchRelationBatch (line 112) | fetchRelationBatch(builder, models, relation, expr) {
    method shouldSkipFetched (line 152) | shouldSkipFetched(models, relation, expr) {
    method createSkippedQuery (line 184) | createSkippedQuery(builder, models, relation, expr) {
    method createRelationQuery (line 195) | createRelationQuery(builder, relation, expr) {
    method clone (line 203) | clone() {
  function findRelationsToFetch (line 213) | function findRelationsToFetch(modelClass, eagerExpression) {
  function findRelationPropsToSelect (line 236) | function findRelationPropsToSelect(builder, relationsToFetch) {
  function getRelatedModels (line 263) | function getRelatedModels(models, expr) {

FILE: lib/queryBuilder/operations/jsonApi/WhereJsonHasPostgresOperation.js
  class WhereJsonHasPostgresOperation (line 6) | class WhereJsonHasPostgresOperation extends ObjectionToKnexConvertingOpe...
    method onBuildKnex (line 7) | onBuildKnex(knexBuilder, builder) {

FILE: lib/queryBuilder/operations/jsonApi/WhereJsonNotObjectPostgresOperation.js
  class WhereJsonNotObjectPostgresOperation (line 6) | class WhereJsonNotObjectPostgresOperation extends ObjectionToKnexConvert...
    method onBuildKnex (line 7) | onBuildKnex(knexBuilder, builder) {
    method whereJsonNotObject (line 11) | whereJsonNotObject(knexBuilder, knex, fieldExpression) {

FILE: lib/queryBuilder/operations/jsonApi/WhereJsonPostgresOperation.js
  class WhereJsonPostgresOperation (line 6) | class WhereJsonPostgresOperation extends ObjectionToKnexConvertingOperat...
    method onBuildKnex (line 7) | onBuildKnex(knexBuilder, builder) {

FILE: lib/queryBuilder/operations/jsonApi/postgresJsonApi.js
  function parseFieldExpression (line 45) | function parseFieldExpression(expression, extractAsText) {
  function whereJsonbRefOnLeftJsonbValOrRefOnRight (line 53) | function whereJsonbRefOnLeftJsonbValOrRefOnRight(
  function whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams (line 69) | function whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams(
  function whereJsonFieldRightStringArrayOnLeftQuery (line 103) | function whereJsonFieldRightStringArrayOnLeftQuery(knex, fieldExpression...
  function whereJsonFieldQuery (line 120) | function whereJsonFieldQuery(knex, fieldExpression, operator, value) {
  function normalizeOperator (line 145) | function normalizeOperator(knex, operator) {

FILE: lib/queryBuilder/operations/select/SelectOperation.js
  constant COUNT_REGEX (line 7) | const COUNT_REGEX = /count/i;
  class SelectOperation (line 9) | class SelectOperation extends ObjectionToKnexConvertingOperation {
    method constructor (line 10) | constructor(name, opt) {
    method onAdd (line 15) | onAdd(builder, args) {
    method onBuildKnex (line 37) | onBuildKnex(knexBuilder, builder) {
    method findSelection (line 41) | findSelection(builder, selectionToFind) {
    method clone (line 57) | clone() {

FILE: lib/queryBuilder/operations/select/Selection.js
  constant ALIAS_REGEX (line 5) | const ALIAS_REGEX = /\s+as\s+/i;
  class Selection (line 7) | class Selection {
    method constructor (line 8) | constructor(table, column, alias) {
    method name (line 14) | get name() {
    method create (line 18) | static create(selection) {
    method doesSelect (line 46) | static doesSelect(builder, selectionInBuilder, selectionToTest) {
  function createSelectionFromReference (line 85) | function createSelectionFromReference(ref) {
  function createSelectionFromRaw (line 89) | function createSelectionFromRaw(raw) {
  function createSelectionFromString (line 97) | function createSelectionFromString(selection) {

FILE: lib/queryBuilder/operations/whereInComposite/WhereInCompositeMsSqlOperation.js
  class WhereInCompositeMsSqlOperation (line 7) | class WhereInCompositeMsSqlOperation extends ObjectionToKnexConvertingOp...
    method constructor (line 8) | constructor(name, opt) {
    method onBuildKnex (line 13) | onBuildKnex(knexBuilder, builder) {
    method build (line 18) | build(knex, knexBuilder, columns, values) {
    method buildComposite (line 28) | buildComposite(knex, knexBuilder, columns, values) {
    method buildCompositeValue (line 44) | buildCompositeValue(knex, knexBuilder, columns, helperColumns, values) {
    method buildCompositeSubquery (line 59) | buildCompositeSubquery(knex, knexBuilder, columns, helperColumns, subQ...
    method buildNonComposite (line 74) | buildNonComposite(knexBuilder, columns, values) {
    method whereIn (line 86) | whereIn(knexBuilder, col, val) {
    method clone (line 94) | clone() {
  function pickNonNull (line 101) | function pickNonNull(values, output) {

FILE: lib/queryBuilder/operations/whereInComposite/WhereInCompositeOperation.js
  class WhereInCompositeOperation (line 7) | class WhereInCompositeOperation extends ObjectionToKnexConvertingOperati...
    method constructor (line 8) | constructor(name, opt) {
    method onBuildKnex (line 13) | onBuildKnex(knexBuilder, builder) {
    method clone (line 23) | clone() {
  function buildWhereInArgs (line 30) | function buildWhereInArgs(knex, columns, values) {
  function isCompositeKey (line 38) | function isCompositeKey(columns) {
  function buildCompositeArgs (line 42) | function buildCompositeArgs(knex, columns, values) {
  function buildCompositeValueArgs (line 50) | function buildCompositeValueArgs(columns, values) {
  function buildCompositeSubqueryArgs (line 58) | function buildCompositeSubqueryArgs(knex, columns, subquery) {
  function buildNonCompositeArgs (line 74) | function buildNonCompositeArgs(columns, values) {
  function pickNonNull (line 84) | function pickNonNull(values, output) {

FILE: lib/queryBuilder/operations/whereInComposite/WhereInCompositeSqliteOperation.js
  class WhereInCompositeSqliteOperation (line 7) | class WhereInCompositeSqliteOperation extends ObjectionToKnexConvertingO...
    method constructor (line 8) | constructor(name, opt) {
    method onBuildKnex (line 13) | onBuildKnex(knexBuilder, builder) {
    method clone (line 31) | clone() {
  function buildWhereArgs (line 38) | function buildWhereArgs(columns, values) {
  function isCompositeKey (line 46) | function isCompositeKey(columns) {
  function buildCompositeArgs (line 50) | function buildCompositeArgs(columns, values) {
  function buildNonCompositeArgs (line 75) | function buildNonCompositeArgs(columns, values) {
  function pickNonNull (line 88) | function pickNonNull(values, output) {

FILE: lib/queryBuilder/parsers/jsonFieldExpressionParser.js
  function peg$subclass (line 9) | function peg$subclass(child, parent) {
  function peg$SyntaxError (line 17) | function peg$SyntaxError(message, expected, found, location) {
  function hex (line 64) | function hex(ch) {
  function literalEscape (line 68) | function literalEscape(s) {
  function classEscape (line 84) | function classEscape(s) {
  function describeExpectation (line 102) | function describeExpectation(expectation) {
  function describeExpected (line 106) | function describeExpected(expected) {
  function describeFound (line 141) | function describeFound(found) {
  function peg$parse (line 148) | function peg$parse(input, options) {

FILE: lib/queryBuilder/parsers/relationExpressionParser.js
  function peg$subclass (line 9) | function peg$subclass(child, parent) {
  function peg$SyntaxError (line 17) | function peg$SyntaxError(message, expected, found, location) {
  function hex (line 64) | function hex(ch) {
  function literalEscape (line 68) | function literalEscape(s) {
  function classEscape (line 84) | function classEscape(s) {
  function describeExpectation (line 102) | function describeExpectation(expectation) {
  function describeExpected (line 106) | function describeExpected(expected) {
  function describeFound (line 141) | function describeFound(found) {
  function peg$parse (line 148) | function peg$parse(input, options) {

FILE: lib/queryBuilder/transformations/CompositeQueryTransformation.js
  class CompositeQueryTransformation (line 5) | class CompositeQueryTransformation extends QueryTransformation {
    method constructor (line 6) | constructor(transformations) {
    method onConvertQueryBuilderBase (line 11) | onConvertQueryBuilderBase(item, builder) {

FILE: lib/queryBuilder/transformations/QueryTransformation.js
  class QueryTransformation (line 3) | class QueryTransformation {
    method onConvertQueryBuilderBase (line 4) | onConvertQueryBuilderBase(item, builder) {

FILE: lib/queryBuilder/transformations/WrapMysqlModifySubqueryTransformation.js
  class WrapMysqlModifySubqueryTransformation (line 18) | class WrapMysqlModifySubqueryTransformation extends QueryTransformation {
    method onConvertQueryBuilderBase (line 19) | onConvertQueryBuilderBase(query, parentQuery) {
  function hasJoinsToTable (line 51) | function hasJoinsToTable(query, tableName) {

FILE: lib/relations/Relation.js
  class Relation (line 14) | class Relation {
    method constructor (line 15) | constructor(relationName, OwnerClass) {
    method setMapping (line 33) | setMapping(mapping) {
    method forbiddenMappingProperties (line 63) | get forbiddenMappingProperties() {
    method joinTable (line 67) | get joinTable() {
    method joinModelClass (line 71) | get joinModelClass() {
    method getJoinModelClass (line 75) | getJoinModelClass(knex) {
    method isOneToOne (line 81) | isOneToOne() {
    method clone (line 85) | clone() {
    method bindKnex (line 103) | bindKnex(knex) {
    method findQuery (line 116) | findQuery(builder, owner) {
    method applyModify (line 123) | applyModify(builder) {
    method join (line 135) | join(
    method find (line 165) | find(_, owner) {
    method insert (line 172) | insert(_, owner) {
    method update (line 177) | update(_, owner) {
    method patch (line 184) | patch(_, owner) {
    method delete (line 192) | delete(_, owner) {
    method relate (line 199) | relate() {
    method unrelate (line 204) | unrelate() {
    method hasRelateProp (line 209) | hasRelateProp(model) {
    method setRelateProp (line 213) | setRelateProp(model, values) {
    method executeBeforeInsert (line 219) | executeBeforeInsert(models, queryContext, result) {
    method createError (line 223) | createError(message) {
  function checkForbiddenProperties (line 248) | function checkForbiddenProperties(ctx) {
  function checkOwnerModelClass (line 258) | function checkOwnerModelClass(ctx) {
  function checkRelatedModelClass (line 266) | function checkRelatedModelClass(ctx) {
  function resolveRelatedModelClass (line 274) | function resolveRelatedModelClass(ctx) {
  function checkRelation (line 290) | function checkRelation(ctx) {
  function createJoinProperties (line 302) | function createJoinProperties(ctx) {
  function createRelationProperty (line 340) | function createRelationProperty(ctx, refString, propName) {
  function parseModify (line 360) | function parseModify(ctx) {
  function parseBeforeInsert (line 373) | function parseBeforeInsert(ctx) {
  function aliasedTableName (line 385) | function aliasedTableName(tableName, alias) {

FILE: lib/relations/RelationDeleteOperation.js
  class RelationDeleteOperation (line 6) | class RelationDeleteOperation extends DeleteOperation {
    method constructor (line 7) | constructor(name, opt) {
    method onBuild (line 14) | onBuild(builder) {
    method toFindOperation (line 19) | toFindOperation() {

FILE: lib/relations/RelationFindOperation.js
  class RelationFindOperation (line 5) | class RelationFindOperation extends FindOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onBuild (line 18) | onBuild(builder) {
    method onAfter2 (line 27) | onAfter2(_, related) {
    method onAfter3 (line 63) | onAfter3(builder, related) {
    method selectMissingJoinColumns (line 78) | selectMissingJoinColumns(builder) {
    method maybeApplyAlias (line 98) | maybeApplyAlias(builder) {
    method omitImplicitJoinProps (line 104) | omitImplicitJoinProps(related) {
    method omitImplicitJoinPropsFromOne (line 126) | omitImplicitJoinPropsFromOne(relatedModelClass, model) {
    method clone (line 134) | clone() {

FILE: lib/relations/RelationInsertOperation.js
  class RelationInsertOperation (line 5) | class RelationInsertOperation extends InsertOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onBefore2 (line 14) | async onBefore2(builder, result) {
    method clone (line 20) | clone() {

FILE: lib/relations/RelationOwner.js
  class RelationOwner (line 13) | class RelationOwner {
    method constructor (line 14) | constructor(owner) {
    method create (line 19) | static create(owner) {
    method createParentReference (line 23) | static createParentReference(builder, relation) {
    method isModels (line 27) | get isModels() {
    method isReference (line 31) | get isReference() {
    method isQueryBuilder (line 35) | get isQueryBuilder() {
    method isIdentifiers (line 39) | get isIdentifiers() {
    method modelArray (line 43) | get modelArray() {
    method model (line 47) | get model() {
    method reference (line 51) | get reference() {
    method queryBuilder (line 55) | get queryBuilder() {
    method identifiers (line 59) | get identifiers() {
    method buildFindQuery (line 63) | buildFindQuery(builder, relation, relatedRefs) {
    method getProps (line 83) | getProps(relation, ownerProp = relation.ownerProp) {
    method getSplitProps (line 93) | getSplitProps(builder, relation, ownerProp = relation.ownerProp) {
    method getNormalizedIdentifiers (line 113) | getNormalizedIdentifiers(ownerProp) {
    method _getPropsFromModels (line 119) | _getPropsFromModels(ownerProp) {
    method _getPropsFromIdentifiers (line 129) | _getPropsFromIdentifiers(relation, ownerProp) {
    method _getPropsFromQuery (line 144) | _getPropsFromQuery(relation, ownerProp) {
  function detectType (line 156) | function detectType(owner) {
  function isModel (line 168) | function isModel(item) {
  function isModelArray (line 172) | function isModelArray(item) {
  function isReference (line 176) | function isReference(item) {
  function isReferenceArray (line 180) | function isReferenceArray(item) {
  function isQueryBuilder (line 184) | function isQueryBuilder(item) {
  function findFirstNonPartialAncestorQuery (line 188) | function findFirstNonPartialAncestorQuery(builder) {
  function containsNonNull (line 205) | function containsNonNull(arr) {
  function join (line 221) | function join(id) {
  function isIdProp (line 225) | function isIdProp(relationProp) {
  function isOwnerModelClassQuery (line 230) | function isOwnerModelClassQuery(query, relation) {

FILE: lib/relations/RelationProperty.js
  class ModelNotFoundError (line 7) | class ModelNotFoundError extends Error {
    method constructor (line 8) | constructor(tableName) {
  class InvalidReferenceError (line 15) | class InvalidReferenceError extends Error {
    method constructor (line 16) | constructor() {
  class RelationProperty (line 28) | class RelationProperty {
    method constructor (line 34) | constructor(references, modelClassResolver) {
    method ModelNotFoundError (line 48) | static get ModelNotFoundError() {
    method InvalidReferenceError (line 52) | static get InvalidReferenceError() {
    method size (line 57) | get size() {
    method modelClass (line 62) | get modelClass() {
    method props (line 70) | get props() {
    method cols (line 78) | get cols() {
    method forEach (line 82) | forEach(callback) {
    method propKey (line 89) | propKey(obj) {
    method getProps (line 105) | getProps(obj) {
    method hasProps (line 117) | hasProps(obj) {
    method getProp (line 132) | getProp(obj, index) {
    method setProp (line 137) | setProp(obj, index, value) {
    method ref (line 143) | ref(builder, index) {
    method refs (line 150) | refs(builder) {
    method patch (line 161) | patch(patch, index, value) {
    method propDescription (line 166) | propDescription(index) {
  function createRefs (line 171) | function createRefs(refs) {
  function createPaths (line 185) | function createPaths(refs, modelClassResolver) {
  function resolveModelClass (line 207) | function resolveModelClass(paths) {
  function createGetter (line 218) | function createGetter(path) {
  function createSetter (line 227) | function createSetter(path) {
  function createPatcher (line 236) | function createPatcher(ref, path) {

FILE: lib/relations/RelationUpdateOperation.js
  class RelationUpdateOperation (line 6) | class RelationUpdateOperation extends UpdateOperation {
    method constructor (line 7) | constructor(name, opt) {
    method onBuild (line 14) | onBuild(builder) {
    method toFindOperation (line 20) | toFindOperation() {

FILE: lib/relations/belongsToOne/BelongsToOneDeleteOperation.js
  class BelongsToOneDeleteOperation (line 5) | class BelongsToOneDeleteOperation extends RelationDeleteOperation {
    method onAfter1 (line 6) | onAfter1(_, result) {

FILE: lib/relations/belongsToOne/BelongsToOneInsertOperation.js
  class BelongsToOneInsertOperation (line 6) | class BelongsToOneInsertOperation extends RelationInsertOperation {
    method onAdd (line 7) | onAdd(builder, args) {
    method onAfter1 (line 17) | async onAfter1(builder, ret) {

FILE: lib/relations/belongsToOne/BelongsToOneRelateOperation.js
  class BelongsToOneRelateOperation (line 6) | class BelongsToOneRelateOperation extends RelateOperation {
    method onAdd (line 7) | onAdd(_, args) {
    method queryExecutor (line 15) | queryExecutor(builder) {
  function assertOneId (line 42) | function assertOneId(ids) {

FILE: lib/relations/belongsToOne/BelongsToOneRelation.js
  class BelongsToOneRelation (line 9) | class BelongsToOneRelation extends Relation {
    method isOneToOne (line 10) | isOneToOne() {
    method insert (line 14) | insert(_, owner) {
    method delete (line 21) | delete(_, owner) {
    method relate (line 28) | relate(_, owner) {
    method unrelate (line 35) | unrelate(_, owner) {

FILE: lib/relations/belongsToOne/BelongsToOneUnrelateOperation.js
  class BelongsToOneUnrelateOperation (line 5) | class BelongsToOneUnrelateOperation extends UnrelateOperation {
    method onAdd (line 6) | onAdd() {
    method queryExecutor (line 17) | queryExecutor(builder) {

FILE: lib/relations/hasMany/HasManyInsertOperation.js
  class HasManyInsertOperation (line 5) | class HasManyInsertOperation extends RelationInsertOperation {
    method onAdd (line 6) | onAdd(builder, args) {
    method onAfter1 (line 22) | async onAfter1(builder, ret) {
  function assertOwnerIsSingleItem (line 39) | function assertOwnerIsSingleItem(owner, relation) {

FILE: lib/relations/hasMany/HasManyRelateOperation.js
  class HasManyRelateOperation (line 6) | class HasManyRelateOperation extends RelateOperation {
    method onAdd (line 7) | onAdd(_, args) {
    method queryExecutor (line 18) | queryExecutor(builder) {
  function assertOwnerIsSingleItem (line 38) | function assertOwnerIsSingleItem(owner, relation) {

FILE: lib/relations/hasMany/HasManyRelation.js
  class HasManyRelation (line 8) | class HasManyRelation extends Relation {
    method insert (line 9) | insert(_, owner) {
    method relate (line 16) | relate(_, owner) {
    method unrelate (line 23) | unrelate(_, owner) {
    method hasRelateProp (line 30) | hasRelateProp(model) {
    method setRelateProp (line 34) | setRelateProp(model, values) {

FILE: lib/relations/hasMany/HasManyUnrelateOperation.js
  class HasManyUnrelateOperation (line 5) | class HasManyUnrelateOperation extends UnrelateOperation {
    method queryExecutor (line 6) | queryExecutor(builder) {

FILE: lib/relations/hasOne/HasOneRelation.js
  class HasOneRelation (line 5) | class HasOneRelation extends HasManyRelation {
    method isOneToOne (line 6) | isOneToOne() {

FILE: lib/relations/hasOneThrough/HasOneThroughRelation.js
  class HasOneThroughRelation (line 5) | class HasOneThroughRelation extends ManyToManyRelation {
    method isOneToOne (line 6) | isOneToOne() {

FILE: lib/relations/manyToMany/ManyToManyModifyMixin.js
  method constructor (line 15) | constructor(...args) {
  method modifyMainQuery (line 20) | get modifyMainQuery() {
  method onBuild (line 26) | onBuild(builder) {
  method createModifyFilterSubquery (line 40) | createModifyFilterSubquery(builder) {
  method removeFiltersFromMainQuery (line 59) | removeFiltersFromMainQuery(builder) {
  method applyModifyFilterForRelatedTable (line 66) | applyModifyFilterForRelatedTable(builder) {
  method applyModifyFilterForJoinTable (line 73) | applyModifyFilterForJoinTable(builder) {
  method toFindOperation (line 87) | toFindOperation() {
  method clone (line 94) | clone() {

FILE: lib/relations/manyToMany/ManyToManyRelation.js
  class ManyToManyRelation (line 29) | class ManyToManyRelation extends Relation {
    method setMapping (line 30) | setMapping(mapping) {
    method forbiddenMappingProperties (line 67) | get forbiddenMappingProperties() {
    method findQuery (line 71) | findQuery(builder, owner) {
    method join (line 98) | join(
    method find (line 148) | find(_, owner) {
    method insert (line 155) | insert(_, owner) {
    method update (line 162) | update(builder, owner) {
    method patch (line 176) | patch(builder, owner) {
    method delete (line 192) | delete(builder, owner) {
    method relate (line 206) | relate(builder, owner) {
    method unrelate (line 213) | unrelate(builder, owner) {
    method createJoinModels (line 227) | createJoinModels(ownerId, related) {
    method createJoinModel (line 231) | createJoinModel(ownerId, rel) {
    method omitExtraProps (line 261) | omitExtraProps(models) {
    method executeJoinTableBeforeInsert (line 273) | executeJoinTableBeforeInsert(models, queryContext, result) {
  function defaultJoinOperation (line 290) | function defaultJoinOperation() {
  function defaultRelatedTableAlias (line 294) | function defaultRelatedTableAlias(relation, builder) {
  function defaultRelatedJoinSelectQuery (line 298) | function defaultRelatedJoinSelectQuery(relation, builder) {
  function defaultRelatedTable (line 302) | function defaultRelatedTable(relation, builder) {
  function defaultOwnerTable (line 306) | function defaultOwnerTable(relation, builder) {
  function defaultJoinTableAlias (line 310) | function defaultJoinTableAlias(relation, relatedTableAlias, builder) {
  function aliasedTableName (line 320) | function aliasedTableName(tableName, alias) {
  function checkThroughObject (line 328) | function checkThroughObject(ctx) {
  function resolveJoinModelClassIfDefined (line 344) | function resolveJoinModelClassIfDefined(ctx) {
  function createJoinProperties (line 362) | function createJoinProperties(ctx) {
  function createRelationProperty (line 397) | function createRelationProperty(ctx, refString, messagePrefix) {
  function parseExtras (line 434) | function parseExtras(ctx) {
  function parseModify (line 466) | function parseModify(ctx) {
  function parseBeforeInsert (line 479) | function parseBeforeInsert(ctx) {
  function finalizeJoinModelClass (line 491) | function finalizeJoinModelClass(ctx) {

FILE: lib/relations/manyToMany/ManyToManySqliteModifyMixin.js
  constant SQLITE_BUILTIN_ROW_ID (line 4) | const SQLITE_BUILTIN_ROW_ID = '_rowid_';
  method applyModifyFilterForRelatedTable (line 11) | applyModifyFilterForRelatedTable(builder) {
  method applyModifyFilterForJoinTable (line 19) | applyModifyFilterForJoinTable(builder) {

FILE: lib/relations/manyToMany/delete/ManyToManyDeleteOperation.js
  class ManyToManyDeleteOperation (line 6) | class ManyToManyDeleteOperation extends ManyToManyModifyMixin(ManyToMany...

FILE: lib/relations/manyToMany/delete/ManyToManyDeleteOperationBase.js
  class ManyToManyDeleteOperationBase (line 5) | class ManyToManyDeleteOperationBase extends DeleteOperation {
    method constructor (line 6) | constructor(name, opt) {
    method applyModifyFilterForRelatedTable (line 14) | applyModifyFilterForRelatedTable(builder) {
    method applyModifyFilterForJoinTable (line 19) | applyModifyFilterForJoinTable(builder) {

FILE: lib/relations/manyToMany/delete/ManyToManyDeleteSqliteOperation.js
  class ManyToManyDeleteSqliteOperation (line 6) | class ManyToManyDeleteSqliteOperation extends ManyToManySqliteModifyMixin(

FILE: lib/relations/manyToMany/find/ManyToManyFindOperation.js
  class ManyToManyFindOperation (line 6) | class ManyToManyFindOperation extends RelationFindOperation {
    method constructor (line 7) | constructor(name, opt) {
    method onBuild (line 17) | onBuild(builder) {
    method onAfter2 (line 42) | onAfter2(_, related) {
    method clone (line 79) | clone() {
    method selectMissingJoinColumns (line 85) | selectMissingJoinColumns(builder) {

FILE: lib/relations/manyToMany/insert/ManyToManyInsertOperation.js
  class ManyToManyInsertOperation (line 6) | class ManyToManyInsertOperation extends RelationInsertOperation {
    method onAdd (line 7) | onAdd(builder, args) {
    method onAfter1 (line 19) | async onAfter1(builder, ret) {

FILE: lib/relations/manyToMany/relate/ManyToManyRelateOperation.js
  class ManyToManyRelateOperation (line 7) | class ManyToManyRelateOperation extends RelateOperation {
    method onAdd (line 8) | onAdd(builder, args) {
    method queryExecutor (line 16) | queryExecutor(builder) {
  function assertOwnerIsSingleItem (line 51) | function assertOwnerIsSingleItem(builder, owner, relation) {

FILE: lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperation.js
  class ManyToManyUnrelateOperation (line 6) | class ManyToManyUnrelateOperation extends ManyToManyModifyMixin(ManyToMa...
    method modifyMainQuery (line 7) | get modifyMainQuery() {

FILE: lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperationBase.js
  class ManyToManyUnrelateOperationBase (line 5) | class ManyToManyUnrelateOperationBase extends UnrelateOperation {
    method queryExecutor (line 6) | queryExecutor(builder) {
    method applyModifyFilterForRelatedTable (line 17) | applyModifyFilterForRelatedTable(builder) {
    method applyModifyFilterForJoinTable (line 22) | applyModifyFilterForJoinTable(builder) {

FILE: lib/relations/manyToMany/unrelate/ManyToManyUnrelateSqliteOperation.js
  class ManyToManyUnrelateSqliteOperation (line 6) | class ManyToManyUnrelateSqliteOperation extends ManyToManySqliteModifyMi...
    method modifyMainQuery (line 9) | get modifyMainQuery() {

FILE: lib/relations/manyToMany/update/ManyToManyUpdateOperation.js
  class ManyToManyUpdateOperation (line 6) | class ManyToManyUpdateOperation extends ManyToManyModifyMixin(ManyToMany...

FILE: lib/relations/manyToMany/update/ManyToManyUpdateOperationBase.js
  class ManyToManyUpdateOperationBase (line 5) | class ManyToManyUpdateOperationBase extends UpdateOperation {
    method constructor (line 6) | constructor(name, opt) {
    method onAdd (line 17) | onAdd(builder, args) {
    method onAfter1 (line 39) | async onAfter1(builder, result) {
    method applyModifyFilterForRelatedTable (line 57) | applyModifyFilterForRelatedTable(builder) {
    method applyModifyFilterForJoinTable (line 62) | applyModifyFilterForJoinTable(builder) {
    method clone (line 66) | clone() {

FILE: lib/relations/manyToMany/update/ManyToManyUpdateSqliteOperation.js
  class ManyToManyUpdateSqliteOperation (line 6) | class ManyToManyUpdateSqliteOperation extends ManyToManySqliteModifyMixin(

FILE: lib/transaction.js
  function transaction (line 6) | function transaction() {
  function isModelClass (line 90) | function isModelClass(maybeModel) {

FILE: lib/utils/assert.js
  function assertHasId (line 3) | function assertHasId(model) {
  function assertIdNotUndefined (line 14) | function assertIdNotUndefined(id, message) {

FILE: lib/utils/buildUtils.js
  function buildArg (line 5) | function buildArg(arg, builder) {

FILE: lib/utils/classUtils.js
  function inherit (line 3) | function inherit(Constructor, BaseConstructor) {

FILE: lib/utils/clone.js
  function arrayEach (line 179) | function arrayEach(array, iteratee) {
  function arrayFilter (line 200) | function arrayFilter(array, predicate) {
  function arrayPush (line 223) | function arrayPush(array, values) {
  function baseTimes (line 243) | function baseTimes(n, iteratee) {
  function baseUnary (line 260) | function baseUnary(func) {
  function getValue (line 274) | function getValue(object, key) {
  function overArg (line 286) | function overArg(func, transform) {
  function lodash (line 496) | function lodash() {
  function object (line 509) | function object() {}
  function Hash (line 533) | function Hash(entries) {
  function hashClear (line 551) | function hashClear() {
  function hashDelete (line 566) | function hashDelete(key) {
  function hashGet (line 581) | function hashGet(key) {
  function hashHas (line 599) | function hashHas(key) {
  function hashSet (line 614) | function hashSet(key, value) {
  function ListCache (line 637) | function ListCache(entries) {
  function listCacheClear (line 655) | function listCacheClear() {
  function listCacheDelete (line 669) | function listCacheDelete(key) {
  function listCacheGet (line 695) | function listCacheGet(key) {
  function listCacheHas (line 711) | function listCacheHas(key) {
  function listCacheSet (line 725) | function listCacheSet(key, value) {
  function MapCache (line 754) | function MapCache(entries) {
  function mapCacheClear (line 772) | function mapCacheClear() {
  function mapCacheDelete (line 790) | function mapCacheDelete(key) {
  function mapCacheGet (line 805) | function mapCacheGet(key) {
  function mapCacheHas (line 818) | function mapCacheHas(key) {
  function mapCacheSet (line 832) | function mapCacheSet(key, value) {
  function Stack (line 857) | function Stack(entries) {
  function stackClear (line 869) | function stackClear() {
  function stackDelete (line 883) | function stackDelete(key) {
  function stackGet (line 900) | function stackGet(key) {
  function stackHas (line 913) | function stackHas(key) {
  function stackSet (line 927) | function stackSet(key, value) {
  function arrayLikeKeys (line 960) | function arrayLikeKeys(value, inherited) {
  function assignValue (line 1000) | function assignValue(object, key, value) {
  function assocIndexOf (line 1018) | function assocIndexOf(array, key) {
  function baseAssign (line 1037) | function baseAssign(object, source) {
  function baseAssignIn (line 1050) | function baseAssignIn(object, source) {
  function baseAssignValue (line 1063) | function baseAssignValue(object, key, value) {
  function baseClone (line 1092) | function baseClone(value, bitmask, customizer, key, object, stack) {
  function baseGetAllKeys (line 1183) | function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  function baseGetTag (line 1195) | function baseGetTag(value) {
  function baseIsArguments (line 1211) | function baseIsArguments(value) {
  function baseIsMap (line 1222) | function baseIsMap(value) {
  function baseIsNative (line 1234) | function baseIsNative(value) {
  function baseIsSet (line 1249) | function baseIsSet(value) {
  function baseIsTypedArray (line 1260) | function baseIsTypedArray(value) {
  function baseKeys (line 1271) | function baseKeys(object) {
  function baseKeysIn (line 1291) | function baseKeysIn(object) {
  function cloneBuffer (line 1314) | function cloneBuffer(buffer, isDeep) {
  function cloneArrayBuffer (line 1332) | function cloneArrayBuffer(arrayBuffer) {
  function cloneDataView (line 1346) | function cloneDataView(dataView, isDeep) {
  function cloneRegExp (line 1358) | function cloneRegExp(regexp) {
  function cloneSymbol (line 1371) | function cloneSymbol(symbol) {
  function cloneTypedArray (line 1383) | function cloneTypedArray(typedArray, isDeep) {
  function copyArray (line 1396) | function copyArray(source, array) {
  function copyObject (line 1417) | function copyObject(source, props, object, customizer) {
  function copySymbols (line 1451) | function copySymbols(source, object) {
  function copySymbolsIn (line 1463) | function copySymbolsIn(source, object) {
  function getAllKeys (line 1474) | function getAllKeys(object) {
  function getAllKeysIn (line 1486) | function getAllKeysIn(object) {
  function getMapData (line 1498) | function getMapData(map, key) {
  function getNative (line 1511) | function getNative(object, key) {
  function getRawTag (line 1523) | function getRawTag(value) {
  function initCloneArray (line 1627) | function initCloneArray(array) {
  function initCloneObject (line 1646) | function initCloneObject(object) {
  function initCloneByTag (line 1664) | function initCloneByTag(object, tag, isDeep) {
  function isIndex (line 1714) | function isIndex(value, length) {
  function isKeyable (line 1734) | function isKeyable(value) {
  function isMasked (line 1748) | function isMasked(func) {
  function isPrototype (line 1759) | function isPrototype(value) {
  function nativeKeysIn (line 1775) | function nativeKeysIn(object) {
  function objectToString (line 1792) | function objectToString(value) {
  function toSource (line 1803) | function toSource(func) {
  function clone (line 1843) | function clone(value) {
  function cloneDeep (line 1865) | function cloneDeep(value) {
  function eq (line 1901) | function eq(value, other) {
  function isArrayLike (line 1987) | function isArrayLike(value) {
  function isFunction (line 2027) | function isFunction(value) {
  function isLength (line 2063) | function isLength(value) {
  function isObject (line 2092) | function isObject(value) {
  function isObjectLike (line 2121) | function isObjectLike(value) {
  function keys (line 2212) | function keys(object) {
  function keysIn (line 2239) | function keysIn(object) {
  function stubArray (line 2263) | function stubArray() {
  function stubFalse (line 2280) | function stubFalse() {

FILE: lib/utils/createModifier.js
  function createModifier (line 5) | function createModifier({ modelClass, modifier, modifiers }) {

FILE: lib/utils/deprecate.js
  constant LOGGED_DEPRECATIONS (line 3) | const LOGGED_DEPRECATIONS = new Set();
  function deprecate (line 5) | function deprecate(message) {

FILE: lib/utils/identifierMapping.js
  function memoize (line 6) | function memoize(func) {
  function snakeCase (line 24) | function snakeCase(
  function camelCase (line 87) | function camelCase(str, { upperCase = false } = {}) {
  function isAllUpperCaseSnakeCase (line 117) | function isAllUpperCaseSnakeCase(str) {
  function isDigit (line 129) | function isDigit(char) {
  function mapLastPart (line 136) | function mapLastPart(mapper, separator) {
  function keyMapper (line 147) | function keyMapper(mapper) {
  function snakeCaseMappers (line 165) | function snakeCaseMappers(opt = {}) {
  function knexIdentifierMappers (line 172) | function knexIdentifierMappers({ parse, format, idSeparator = ':' } = {}) {
  function knexSnakeCaseMappers (line 198) | function knexSnakeCaseMappers(opt = {}) {
  function knexIdentifierMapping (line 205) | function knexIdentifierMapping(colToProp) {

FILE: lib/utils/internalPropUtils.js
  constant INTERNAL_PROP_PREFIX (line 3) | const INTERNAL_PROP_PREFIX = '$';
  function isInternalProp (line 5) | function isInternalProp(propName) {

FILE: lib/utils/knexUtils.js
  function getDialect (line 5) | function getDialect(knex) {
  function isPostgres (line 17) | function isPostgres(knex) {
  function isOracle (line 21) | function isOracle(knex) {
  function isMySql (line 26) | function isMySql(knex) {
  function isSqlite (line 31) | function isSqlite(knex) {
  function isMsSql (line 35) | function isMsSql(knex) {
  function isKnexQueryBuilder (line 39) | function isKnexQueryBuilder(value) {
  function isKnexJoinBuilder (line 49) | function isKnexJoinBuilder(value) {
  function isKnexRaw (line 53) | function isKnexRaw(value) {
  function isKnexTransaction (line 57) | function isKnexTransaction(knex) {
  function hasConstructor (line 61) | function hasConstructor(value) {

FILE: lib/utils/mixin.js
  function mixin (line 5) | function mixin() {
  function compose (line 14) | function compose() {

FILE: lib/utils/normalizeIds.js
  function normalizeIds (line 6) | function normalizeIds(ids, prop, opt) {
  function convertIdArrayToObject (line 90) | function convertIdArrayToObject(ids, prop) {
  function ensureObject (line 108) | function ensureObject(ids) {
  function checkProperties (line 116) | function checkProperties(ret, prop) {
  function normalizedToArray (line 132) | function normalizedToArray(ret, prop) {

FILE: lib/utils/objectUtils.js
  constant SMALL_ARRAY_SIZE (line 4) | const SMALL_ARRAY_SIZE = 10;
  function isEmpty (line 6) | function isEmpty(item) {
  function isObject (line 16) | function isObject(value) {
  function isPlainObject (line 22) | function isPlainObject(value) {
  function isFunction (line 30) | function isFunction(value) {
  function isRegExp (line 34) | function isRegExp(value) {
  function isString (line 38) | function isString(value) {
  function isNumber (line 42) | function isNumber(value) {
  function asArray (line 46) | function asArray(value) {
  function asSingle (line 50) | function asSingle(value) {
  function uniqBy (line 54) | function uniqBy(items, keyGetter = null) {
  function groupBy (line 67) | function groupBy(items, keyGetter = null) {
  function omit (line 85) | function omit(obj, keysToOmit) {
  function difference (line 102) | function difference(arr1, arr2) {
  function union (line 117) | function union(arr1, arr2) {
  function unionSmall (line 125) | function unionSmall(arr1, arr2) {
  function unionGeneric (line 139) | function unionGeneric(arr1, arr2) {
  function last (line 153) | function last(arr) {
  function upperFirst (line 157) | function upperFirst(str) {
  function values (line 161) | function values(obj) {
  function once (line 176) | function once(func) {
  function flatten (line 190) | function flatten(arrays) {
  function get (line 208) | function get(obj, path) {
  function set (line 222) | function set(obj, path, value) {
  function zipObject (line 260) | function zipObject(keys, values) {
  function chunk (line 274) | function chunk(arr, chunkSize) {
  function jsonEquals (line 290) | function jsonEquals(val1, val2) {
  function jsonEqualsBase (line 294) | function jsonEqualsBase(val1, val2, compare) {
  function jsonEqualsSlowPath (line 302) | function jsonEqualsSlowPath(val1, val2, compare) {
  function jsonEqualsArray (line 327) | function jsonEqualsArray(arr1, arr2, compare) {
  function jsonEqualsObject (line 341) | function jsonEqualsObject(obj1, obj2, compare) {
  function equalsDate (line 364) | function equalsDate(date1, date2) {
  function compareStrict (line 368) | function compareStrict(val1, val2) {
  function isSafeKey (line 372) | function isSafeKey(key) {
  function mergeMaps (line 376) | function mergeMaps(map1, map2) {

FILE: lib/utils/parseFieldExpression.js
  function parseFieldExpression (line 6) | function parseFieldExpression(expr) {
  function preprocessParsedExpression (line 25) | function preprocessParsedExpression(parsedExpr) {
  function freezeParsedExpr (line 38) | function freezeParsedExpr(parsedExpr) {

FILE: lib/utils/promiseUtils/after.js
  function after (line 7) | function after(obj, func) {

FILE: lib/utils/promiseUtils/afterReturn.js
  function afterReturn (line 7) | function afterReturn(obj, returnValue) {

FILE: lib/utils/promiseUtils/isPromise.js
  function isPromise (line 5) | function isPromise(obj) {

FILE: lib/utils/promiseUtils/map.js
  function promiseMap (line 6) | function promiseMap(items, mapper, opt) {
  function mapZero (line 17) | function mapZero() {
  function mapOne (line 21) | function mapOne(items, mapper) {
  function wrapArray (line 35) | function wrapArray(item) {
  function mapMany (line 39) | function mapMany(items, mapper, opt = {}) {
  function executeNext (line 60) | function executeNext(ctx) {
  function afterExecute (line 84) | function afterExecute(ctx, result, index) {
  function onError (line 103) | function onError(ctx, err) {

FILE: lib/utils/promiseUtils/mapAfterAllReturn.js
  function mapAfterAllReturn (line 8) | function mapAfterAllReturn(arr, mapper, returnValue) {

FILE: lib/utils/promiseUtils/try.js
  function promiseTry (line 6) | function promiseTry(callback) {

FILE: lib/utils/resolveModel.js
  class ResolveError (line 6) | class ResolveError extends Error {}
  function resolveModel (line 8) | function resolveModel(modelRef, modelPaths, errorPrefix) {
  function requireUsingModelPaths (line 38) | function requireUsingModelPaths(modelRef, modelPaths) {
  function requireModel (line 58) | function requireModel(modelPath) {
  function isAbsolutePath (line 96) | function isAbsolutePath(pth) {
  function isModelClass (line 100) | function isModelClass(maybeModel) {

FILE: lib/utils/tmpColumnUtils.js
  constant OWNER_JOIN_COLUMN_ALIAS_PREFIX (line 3) | const OWNER_JOIN_COLUMN_ALIAS_PREFIX = 'objectiontmpjoin';
  function getTempColumn (line 5) | function getTempColumn(index) {
  function isTempColumn (line 9) | function isTempColumn(col) {

FILE: reproduction-template.js
  function main (line 24) | async function main() {
  class Person (line 69) | class Person extends Model {
    method tableName (line 70) | static get tableName() {
    method jsonSchema (line 74) | static get jsonSchema() {
    method relationMappings (line 98) | static get relationMappings() {
  class Animal (line 143) | class Animal extends Model {
    method tableName (line 144) | static get tableName() {
    method jsonSchema (line 148) | static get jsonSchema() {
    method relationMappings (line 162) | static get relationMappings() {
  class Movie (line 176) | class Movie extends Model {
    method tableName (line 177) | static get tableName() {
    method jsonSchema (line 181) | static get jsonSchema() {
    method relationMappings (line 193) | static get relationMappings() {
  function createSchema (line 215) | async function createSchema() {

FILE: setup-test-db.js
  constant DATABASES (line 5) | const DATABASES = (process.env.DATABASES && process.env.DATABASES.split(...
  function setup (line 10) | async function setup() {
  function createKnex (line 50) | async function createKnex(config) {

FILE: testUtils/TestSession.js
  class TestSession (line 10) | class TestSession {
    method init (line 11) | static init() {
    method constructor (line 21) | constructor(opt) {
    method createKnex (line 30) | createKnex() {
    method createModels (line 34) | createModels() {
    method createDb (line 210) | createDb() {
    method populate (line 332) | populate(data) {
    method destroy (line 376) | destroy() {
    method addUnhandledRejectionHandler (line 380) | addUnhandledRejectionHandler(handler) {
    method removeUnhandledRejectionHandler (line 385) | removeUnhandledRejectionHandler(handler) {
    method isPostgres (line 390) | isPostgres() {
    method isMySql (line 394) | isMySql() {
    method isSqlite (line 398) | isSqlite() {
  function createHook (line 411) | function createHook(name, delay, extraAction) {
  function inc (line 431) | function inc(obj, key) {
  function registerUnhandledRejectionHandler (line 435) | function registerUnhandledRejectionHandler() {

FILE: testUtils/mockKnex.js
  method get (line 44) | get() {
  method set (line 48) | set(value) {
  function wrapBuilder (line 55) | function wrapBuilder(builder) {

FILE: testUtils/testUtils.js
  function expectPartialEqual (line 20) | function expectPartialEqual(result, partial) {
  function createRejectionReflection (line 39) | function createRejectionReflection(err) {

FILE: tests/integration/compositeKeys.js
  class ModelA (line 57) | class ModelA extends Model {
    method tableName (line 58) | static get tableName() {
    method idColumn (line 62) | static get idColumn() {
    method relationMappings (line 66) | static get relationMappings() {
  class ModelB (line 92) | class ModelB extends Model {
    method tableName (line 93) | static get tableName() {
    method idColumn (line 97) | static get idColumn() {
    method relationMappings (line 101) | static get relationMappings() {

FILE: tests/integration/crossDb/mysql.js
  class T1Model (line 47) | class T1Model extends Model {
    method tableName (line 48) | static get tableName() {
    method relationMappings (line 51) | static get relationMappings() {
  class T2Model (line 65) | class T2Model extends Model {
    method tableName (line 66) | static get tableName() {
    method relationMappings (line 69) | static get relationMappings() {

FILE: tests/integration/find.js
  method toKnexRaw (line 255) | toKnexRaw(builder) {
  method toKnexRaw (line 268) | toKnexRaw(builder) {
  class CustomError (line 712) | class CustomError extends Error {
    method constructor (line 713) | constructor(ctx) {
  class TestModel (line 719) | class TestModel extends Model1 {
    method createNotFoundError (line 720) | static createNotFoundError(ctx) {
  class TestModel (line 974) | class TestModel extends Model1 {}
    method createNotFoundError (line 720) | static createNotFoundError(ctx) {
  class TestModel2 (line 2271) | class TestModel2 extends Model2 {
    method modifiers (line 2272) | static get modifiers() {
  class TestModel1 (line 2280) | class TestModel1 extends Model1 {
    method relationMappings (line 2281) | static get relationMappings() {

FILE: tests/integration/graph/GraphInsert.js
  method check (line 443) | check(graph) {
  method check (line 782) | check(graphOut) {
  function test (line 1023) | function test({
  function assignDbRefsAsRelateProps (line 1073) | function assignDbRefsAsRelateProps(graph) {
  function createSchema (line 1085) | function createSchema() {
  function dropSchema (line 1113) | function dropSchema() {
  function createModels (line 1117) | function createModels() {

FILE: tests/integration/index.js
  constant DATABASES (line 11) | const DATABASES = (process.env.DATABASES && process.env.DATABASES.split(...

FILE: tests/integration/insert.js
  class MyError (line 338) | class MyError extends Error {
    method constructor (line 339) | constructor({ data }) {
  function subClassWithSchema (line 1735) | function subClassWithSchema(Model, schema) {

FILE: tests/integration/insertGraph.js
  function check (line 777) | function check(model, shouldCheckHooks) {
  function checkHooks (line 825) | function checkHooks(model) {

FILE: tests/integration/jsonQueries.js
  function expectIdsEqual (line 6) | function expectIdsEqual(resultArray, expectedIds) {
  function expectArraysEqual (line 10) | function expectArraysEqual(arr1, arr2) {
  class ModelJson (line 16) | class ModelJson extends Model {
    method tableName (line 17) | static get tableName() {
    method jsonSchema (line 21) | static get jsonSchema() {

FILE: tests/integration/jsonRelations.js
  class BaseModel (line 8) | class BaseModel extends Model {
    method modifiers (line 9) | static get modifiers() {
  class Person (line 17) | class Person extends BaseModel {
    method tableName (line 18) | static get tableName() {
    method relationMappings (line 22) | static get relationMappings() {
  class Animal (line 49) | class Animal extends BaseModel {
    method tableName (line 50) | static get tableName() {
    method relationMappings (line 54) | static get relationMappings() {
  class Movie (line 77) | class Movie extends BaseModel {
    method tableName (line 78) | static get tableName() {
  function sortRelations (line 571) | function sortRelations(obj) {

FILE: tests/integration/knexIdentifierMapping.js
  class Person (line 10) | class Person extends Model {
    method tableName (line 11) | static get tableName() {
    method relationMappings (line 15) | static get relationMappings() {
  class Animal (line 51) | class Animal extends Model {
    method tableName (line 52) | static get tableName() {
  class Movie (line 57) | class Movie extends Model {
    method tableName (line 58) | static get tableName() {

FILE: tests/integration/knexSnakeCase.js
  class Person (line 10) | class Person extends Model {
    method tableName (line 11) | static get tableName() {
    method jsonAttributes (line 15) | static get jsonAttributes() {
    method relationMappings (line 19) | static get relationMappings() {
    method tableName (line 389) | static get tableName() {
    method relationMappings (line 393) | static get relationMappings() {
  class Animal (line 55) | class Animal extends Model {
    method tableName (line 56) | static get tableName() {
    method tableName (line 430) | static get tableName() {
  class Movie (line 61) | class Movie extends Model {
    method tableName (line 62) | static get tableName() {
    method tableName (line 436) | static get tableName() {
  function maybeWithAddress (line 195) | function maybeWithAddress(obj, address) {
  class Person (line 388) | class Person extends Model {
    method tableName (line 11) | static get tableName() {
    method jsonAttributes (line 15) | static get jsonAttributes() {
    method relationMappings (line 19) | static get relationMappings() {
    method tableName (line 389) | static get tableName() {
    method relationMappings (line 393) | static get relationMappings() {
  class Animal (line 429) | class Animal extends Model {
    method tableName (line 56) | static get tableName() {
    method tableName (line 430) | static get tableName() {
  class Movie (line 435) | class Movie extends Model {
    method tableName (line 62) | static get tableName() {
    method tableName (line 436) | static get tableName() {

FILE: tests/integration/misc/#1074.js
  method tableName (line 30) | static get tableName() {
  method relationMappings (line 34) | static get relationMappings() {

FILE: tests/integration/misc/#1202.js
  method tableName (line 33) | static get tableName() {
  method relationMappings (line 37) | static get relationMappings() {

FILE: tests/integration/misc/#1215.js
  method tableName (line 30) | static get tableName() {
  method relationMappings (line 34) | static get relationMappings() {

FILE: tests/integration/misc/#1223.js
  method tableName (line 30) | static get tableName() {
  method relationMappings (line 34) | static get relationMappings() {

FILE: tests/integration/misc/#1227.js
  method tableName (line 29) | static get tableName() {
  method tableName (line 39) | static get tableName() {
  method relationMappings (line 43) | static get relationMappings() {

FILE: tests/integration/misc/#1265.js
  method tableName (line 33) | static get tableName() {
  method relationMappings (line 37) | static get relationMappings() {
  method tableName (line 56) | static get tableName() {
  method relationMappings (line 60) | static get relationMappings() {

FILE: tests/integration/misc/#1455.js
  class BaseModel (line 48) | class BaseModel extends Model {
    method useLimitInFirst (line 49) | static get useLimitInFirst() {
    method concurrency (line 53) | static get concurrency() {
  class SetAttribute (line 58) | class SetAttribute extends BaseModel {
    method tableName (line 59) | static get tableName() {
  class Set (line 64) | class Set extends BaseModel {
    method tableName (line 65) | static get tableName() {
    method relationMappings (line 69) | static get relationMappings() {
  method tableName (line 81) | static get tableName() {
  method relationMappings (line 85) | static get relationMappings() {
  method orderById (line 130) | orderById(query) {
  method orderByName (line 134) | orderByName(query) {

FILE: tests/integration/misc/#1467.js
  method tableName (line 41) | static get tableName() {
  method columnNameMappers (line 45) | static get columnNameMappers() {
  method jsonSchema (line 49) | static get jsonSchema() {
  method relationMappings (line 59) | static get relationMappings() {
  class Cog (line 73) | class Cog extends Model {
    method tableName (line 74) | static get tableName() {
    method columnNameMappers (line 78) | static get columnNameMappers() {
    method jsonSchema (line 82) | static get jsonSchema() {
    method relationMappings (line 94) | static get relationMappings() {
  method tableName (line 100) | static get tableName() {
  method columnNameMappers (line 104) | static get columnNameMappers() {
  method jsonSchema (line 108) | static get jsonSchema() {
  method relationMappings (line 118) | static get relationMappings() {

FILE: tests/integration/misc/#1489.js
  method tableName (line 37) | static get tableName() {
  method tableName (line 43) | static get tableName() {
  method relationMappings (line 47) | static get relationMappings() {

FILE: tests/integration/misc/#1627.js
  method tableName (line 40) | static get tableName() {
  method columnNameMappers (line 44) | static get columnNameMappers() {
  method tableName (line 50) | static get tableName() {
  method columnNameMappers (line 54) | static get columnNameMappers() {
  method relationMappings (line 58) | static get relationMappings() {

FILE: tests/integration/misc/#1718.js
  class MyModel (line 9) | class MyModel extends Model {
    method tableName (line 10) | static get tableName() {
    method createValidator (line 14) | static createValidator() {
    method jsonSchema (line 26) | static get jsonSchema() {

FILE: tests/integration/misc/#1757.js
  class Person (line 8) | class Person extends Model {
    method tableName (line 9) | static get tableName() {
    method relationMappings (line 13) | static get relationMappings() {
  class Animal (line 45) | class Animal extends Model {
    method tableName (line 46) | static get tableName() {
    method relationMappings (line 50) | static get relationMappings() {

FILE: tests/integration/misc/#2105.js
  method constructor (line 23) | constructor() {
  method tableName (line 39) | static get tableName() {

FILE: tests/integration/misc/#292.js
  class A (line 7) | class A extends Model {
    method tableName (line 8) | static get tableName() {
    method relationMappings (line 12) | static get relationMappings() {
  class B (line 26) | class B extends Model {
    method tableName (line 27) | static get tableName() {
    method relationMappings (line 31) | static get relationMappings() {
  class C (line 61) | class C extends Model {
    method tableName (line 62) | static get tableName() {
  class D (line 67) | class D extends Model {
    method tableName (line 68) | static get tableName() {

FILE: tests/integration/misc/#325.js
  method tableName (line 24) | static get tableName() {
  method jsonSchema (line 28) | static get jsonSchema() {

FILE: tests/integration/misc/#403.js
  method tableName (line 31) | static get tableName() {
  method idColumn (line 35) | static get idColumn() {
  method jsonAttributes (line 39) | static get jsonAttributes() {
  method relationMappings (line 43) | static get relationMappings() {

FILE: tests/integration/misc/#517.js
  method tableName (line 31) | static get tableName() {
  method relationMappings (line 35) | static get relationMappings() {
  method tableName (line 50) | static get tableName() {
  method idColumn (line 54) | static get idColumn() {

FILE: tests/integration/misc/#712.js
  method tableName (line 23) | static get tableName() {
  method modifiers (line 27) | static get modifiers() {
  method relationMappings (line 41) | static get relationMappings() {

FILE: tests/integration/misc/#733.js
  method tableName (line 23) | static get tableName() {
  method modifiers (line 27) | static get modifiers() {
  method relationMappings (line 39) | static get relationMappings() {

FILE: tests/integration/misc/#760.js
  method tableName (line 31) | static get tableName() {
  method relationMappings (line 35) | static get relationMappings() {

FILE: tests/integration/misc/#844.js
  method tableName (line 46) | static get tableName() {
  method relationMappings (line 50) | static get relationMappings() {
  method tableName (line 69) | static get tableName() {
  method modifiers (line 73) | static get modifiers() {
  method relationMappings (line 80) | static get relationMappings() {

FILE: tests/integration/misc/#909.js
  method tableName (line 28) | static get tableName() {

FILE: tests/integration/misc/concurrency.js
  method tableName (line 14) | static get tableName() {
  method concurrency (line 18) | static get concurrency() {
  method relationMappings (line 22) | static get relationMappings() {
  method tableName (line 70) | static tableName() {
  method idColumn (line 74) | static get idColumn() {
  method columnNameMappers (line 78) | static get columnNameMappers() {
  method concurrency (line 82) | static get concurrency() {

FILE: tests/integration/misc/defaultModelFieldValues.js
  class Person (line 11) | class Person extends Model {
  class Pet (line 37) | class Pet extends Model {
  class Toy (line 81) | class Toy extends Model {

FILE: tests/integration/misc/generatedId.js
  method tableName (line 23) | static get tableName() {
  method idColumn (line 27) | static get idColumn() {
  method $beforeInsert (line 31) | $beforeInsert() {

FILE: tests/integration/misc/hasOneTree.js
  method tableName (line 23) | static get tableName() {
  method relationMappings (line 27) | static get relationMappings() {

FILE: tests/integration/misc/modelWithLengthProperty.js
  method tableName (line 23) | static get tableName() {

FILE: tests/integration/misc/mysqlBinaryColumns.js
  method tableName (line 24) | static get tableName() {
  function buffer (line 32) | function buffer() {
  function bufferEquals (line 36) | function bufferEquals(a, b) {

FILE: tests/integration/misc/nonMutatingRelatedQuery.js
  class ModelOne (line 5) | class ModelOne extends session.unboundModels.Model1 {
    method relatedFindQueryMutates (line 6) | static get relatedFindQueryMutates() {
    method relatedInsertQueryMutates (line 10) | static get relatedInsertQueryMutates() {
  class ModelTwo (line 15) | class ModelTwo extends session.unboundModels.Model2 {
    method relatedFindQueryMutates (line 16) | static get relatedFindQueryMutates() {
    method relatedInsertQueryMutates (line 20) | static get relatedInsertQueryMutates() {

FILE: tests/integration/misc/refAttack.js
  class Role (line 8) | class Role extends Model {
    method tableName (line 9) | static get tableName() {
  class User (line 14) | class User extends Model {
    method tableName (line 15) | static get tableName() {
    method relationMappings (line 19) | static get relationMappings() {

FILE: tests/integration/misc/relatedQueryErrors.js
  class Post (line 8) | class Post extends Model {
    method tableName (line 9) | static get tableName() {
  class User (line 14) | class User extends Model {
    method tableName (line 15) | static get tableName() {
    method relationMappings (line 18) | static get relationMappings() {

FILE: tests/integration/misc/relationHooks.js
  class Model1 (line 7) | class Model1 extends Model {
    method tableName (line 8) | static get tableName() {
    method relationMappings (line 12) | static get relationMappings() {
  class Model2 (line 70) | class Model2 extends Model {
    method tableName (line 71) | static get tableName() {
    method idColumn (line 75) | static get idColumn() {
    method columnNameMappers (line 79) | static get columnNameMappers() {
    method relationMappings (line 83) | static get relationMappings() {

FILE: tests/integration/misc/tableMetadata.js
  method tableName (line 34) | static get tableName() {
  method tableName (line 40) | static get tableName() {
  method jsonSchema (line 44) | static get jsonSchema() {
  method tableMetadata (line 55) | static tableMetadata() {
  method relationMappings (line 61) | static get relationMappings() {

FILE: tests/integration/misc/usingUnboundModelsByPassingKnex.js
  class TestModel (line 97) | class TestModel extends Model1 {
    method idColumn (line 98) | static get idColumn() {
  function sortRelations (line 482) | function sortRelations(models) {

FILE: tests/integration/misc/zeroValueInRelationColumn.js
  method tableName (line 32) | static get tableName() {
  method relationMappings (line 36) | static get relationMappings() {
  method tableName (line 51) | static get tableName() {

FILE: tests/integration/modifiers.js
  class Person (line 6) | class Person extends Model {
    method tableName (line 7) | static get tableName() {
    method relationMappings (line 11) | static get relationMappings() {
  class Animal (line 47) | class Animal extends Model {
    method tableName (line 48) | static get tableName() {
    method modifiers (line 52) | static get modifiers() {
  class Movie (line 61) | class Movie extends Model {
    method tableName (line 62) | static get tableName() {
    method modifiers (line 66) | static get modifiers() {
  method goodMovies (line 164) | goodMovies(query) {
  method onlyDictators (line 167) | onlyDictators(query) {
  method goodMovies (line 185) | goodMovies(query) {
  method onlyDictators (line 188) | onlyDictators(query) {
  method goodMovies (line 207) | goodMovies(query) {
  method onlyDictators (line 210) | onlyDictators(query) {

FILE: tests/integration/nonPrimaryKeyRelations.js
  class Person (line 7) | class Person extends Model {
    method tableName (line 8) | static get tableName() {
    method relationMappings (line 12) | static get relationMappings() {
  class Animal (line 49) | class Animal extends Model {
    method tableName (line 50) | static get tableName() {
  class Movie (line 55) | class Movie extends Model {
    method tableName (line 56) | static get tableName() {
  class PersonMovie (line 61) | class PersonMovie extends Model {
    method tableName (line 62) | static get tableName() {
    method idColumn (line 66) | static get idColumn() {
    method uniqueTag (line 70) | static uniqueTag() {
  function findArnold (line 971) | function findArnold() {
  function findArnoldEagerly (line 975) | function findArnoldEagerly() {
  function findGustav (line 983) | function findGustav() {
  function findMeinhard (line 987) | function findMeinhard() {
  function findStalin (line 991) | function findStalin() {
  function findTerminator (line 995) | function findTerminator() {
  function insertTeppo (line 999) | function insertTeppo() {
  function insertTahvo (line 1003) | function insertTahvo() {
  function insertTerminator3 (line 1007) | function insertTerminator3() {
  function concat (line 1012) | function concat(str1, str2) {

FILE: tests/integration/patch.js
  class Test (line 306) | class Test extends Model {
    method tableName (line 307) | static get tableName() {
    method $beforeUpdate (line 311) | $beforeUpdate(opt, ctx) {
  class MyModel1 (line 337) | class MyModel1 extends Model1 {}
  method execute (line 340) | execute() {
  method runBefore (line 348) | runBefore() {
  function subClassWithSchema (line 2339) | function subClassWithSchema(Model, schema) {

FILE: tests/integration/relationModify.js
  class Person (line 6) | class Person extends Model {
    method tableName (line 7) | static get tableName() {
    method relationMappings (line 11) | static get relationMappings() {
  class Animal (line 56) | class Animal extends Model {
    method tableName (line 57) | static get tableName() {
  class Movie (line 62) | class Movie extends Model {
    method tableName (line 63) | static get tableName() {
  function findArnold (line 439) | function findArnold() {
  function findMeinhard (line 443) | function findMeinhard() {
  function findRuffus (line 447) | function findRuffus() {
  function modifyBelongsToOne (line 451) | function modifyBelongsToOne(query) {
  function modifyHasMany (line 457) | function modifyHasMany(query) {
  function modifyManyToMany (line 463) | function modifyManyToMany(query) {

FILE: tests/integration/schema.js
  class Person (line 10) | class Person extends Model {
    method tableName (line 11) | static get tableName() {
    method relationMappings (line 15) | static get relationMappings() {
    method tableName (line 209) | static get tableName() {
    method relationMappings (line 213) | static get relationMappings() {
  class Animal (line 42) | class Animal extends Model {
    method tableName (line 43) | static get tableName() {
    method tableName (line 228) | static get tableName() {
    method relationMappings (line 232) | static get relationMappings() {
  class Person (line 208) | class Person extends Model {
    method tableName (line 11) | static get tableName() {
    method relationMappings (line 15) | static get relationMappings() {
    method tableName (line 209) | static get tableName() {
    method relationMappings (line 213) | static get relationMappings() {
  class Animal (line 227) | class Animal extends Model {
    method tableName (line 43) | static get tableName() {
    method tableName (line 228) | static get tableName() {
    method relationMappings (line 232) | static get relationMappings() {

FILE: tests/integration/snakeCase.js
  class Person (line 7) | class Person extends Model {
    method $formatDatabaseJson (line 8) | $formatDatabaseJson(json) {
    method tableName (line 14) | static get tableName() {
    method columnNameMappers (line 18) | static get columnNameMappers() {
    method jsonAttributes (line 22) | static get jsonAttributes() {
    method relationMappings (line 26) | static get relationMappings() {
    method tableName (line 292) | static get tableName() {
    method idColumn (line 296) | static get idColumn() {
    method columnNameMappers (line 300) | static get columnNameMappers() {
    method relationMappings (line 304) | static get relationMappings() {
  class Animal (line 62) | class Animal extends Model {
    method tableName (line 63) | static get tableName() {
    method columnNameMappers (line 67) | static get columnNameMappers() {
    method tableName (line 341) | static get tableName() {
    method idColumn (line 345) | static get idColumn() {
    method columnNameMappers (line 349) | static get columnNameMappers() {
  class Movie (line 72) | class Movie extends Model {
    method tableName (line 73) | static get tableName() {
    method columnNameMappers (line 77) | static get columnNameMappers() {
    method tableName (line 355) | static get tableName() {
    method idColumn (line 359) | static get idColumn() {
    method columnNameMappers (line 363) | static get columnNameMappers() {
  function maybeWithAddress (line 114) | function maybeWithAddress(obj, address) {
  class Person (line 291) | class Person extends Model {
    method $formatDatabaseJson (line 8) | $formatDatabaseJson(json) {
    method tableName (line 14) | static get tableName() {
    method columnNameMappers (line 18) | static get columnNameMappers() {
    method jsonAttributes (line 22) | static get jsonAttributes() {
    method relationMappings (line 26) | static get relationMappings() {
    method tableName (line 292) | static get tableName() {
    method idColumn (line 296) | static get idColumn() {
    method columnNameMappers (line 300) | static get columnNameMappers() {
    method relationMappings (line 304) | static get relationMappings() {
  class Animal (line 340) | class Animal extends Model {
    method tableName (line 63) | static get tableName() {
    method columnNameMappers (line 67) | static get columnNameMappers() {
    method tableName (line 341) | static get tableName() {
    method idColumn (line 345) | static get idColumn() {
    method columnNameMappers (line 349) | static get columnNameMappers() {
  class Movie (line 354) | class Movie extends Model {
    method tableName (line 73) | static get tableName() {
    method columnNameMappers (line 77) | static get columnNameMappers() {
    method tableName (line 355) | static get tableName() {
    method idColumn (line 359) | static get idColumn() {
    method columnNameMappers (line 363) | static get columnNameMappers() {

FILE: tests/integration/staticHooks.js
  method tableName (line 59) | static get tableName() {
  method relationMappings (line 63) | static get relationMappings() {
  method tableName (line 91) | static get tableName() {
  method relationMappings (line 95) | static get relationMappings() {
  method tableName (line 110) | static get tableName() {
  method relationMappings (line 114) | static get relationMappings() {
  function createHookSpy (line 3123) | function createHookSpy(hook = () => {}) {
  function delay (line 3134) | function delay(millis) {

FILE: tests/integration/toKnexQuery.js
  method tableName (line 25) | static get tableName() {
  method relationMappings (line 29) | static get relationMappings() {
  function testSql (line 124) | function testSql({ query, sql, bindings }) {
  function normalizeSql (line 131) | function normalizeSql(sql) {

FILE: tests/integration/update.js
  class MyError (line 232) | class MyError extends Error {
    method constructor (line 233) | constructor({ data }) {
  function subClassWithSchema (line 900) | function subClassWithSchema(Model, schema) {

FILE: tests/integration/upsertGraph.js
  method onBuild (line 182) | onBuild(builder) {
  method onBuild (line 722) | onBuild(builder) {
  method runBefore (line 2411) | runBefore(_, builder) {
  function omitIrrelevantProps (line 4304) | function omitIrrelevantProps(model) {
  function omitIds (line 4314) | function omitIds(model) {

FILE: tests/integration/viewsAndAliases.js
  function sortEager (line 703) | function sortEager(models) {

FILE: tests/integration/withGraph.js
  method onlyFirst (line 1227) | onlyFirst(query) {
  method rawStuff (line 1661) | rawStuff(builder) {
  method onBuild (line 2945) | onBuild(builder) {
  function traverser (line 3134) | function traverser(model) {
  function test (line 3157) | function test(expr, tester, opt) {
  function sortRelations (line 3210) | function sortRelations(disable) {

FILE: tests/ts/custom-query-builder.ts
  class CustomQueryBuilder (line 3) | class CustomQueryBuilder<M extends Model, R = M[]> extends QueryBuilder<...
    method someCustomMethod (line 10) | someCustomMethod(): this {
    method delete (line 14) | delete() {
  class BaseModel (line 19) | class BaseModel extends Model {
    method $query (line 22) | $query(trxOrKnex?: TransactionOrKnex) {
  class Animal (line 27) | class Animal extends BaseModel {
  class Person (line 33) | class Person extends BaseModel {

FILE: tests/ts/examples.ts
  class CustomValidationError (line 24) | class CustomValidationError extends Error {}
  class CustomValidator (line 26) | class CustomValidator extends objection.Validator {
    method beforeValidate (line 27) | beforeValidate(args: objection.ValidatorArgs): void {
    method validate (line 35) | validate(args: objection.ValidatorArgs): objection.Pojo {
    method afterValidate (line 42) | afterValidate(args: objection.ValidatorArgs): void {
  class Person (line 47) | class Person extends objection.Model {
    method beforeFind (line 73) | static async beforeFind({
    method afterUpdate (line 81) | static async afterUpdate({
    method staticExamplePersonMethod (line 93) | static staticExamplePersonMethod() {
    method petsWithId (line 97) | petsWithId(petId: number): PromiseLike<Animal[]> {
    method commentsWithId (line 101) | commentsWithId(commentId: number): Promise<Comment[]> {
    method fetchMom (line 105) | fetchMom(): PromiseLike<Person | undefined> {
    method $beforeInsert (line 109) | async $beforeInsert(queryContext: objection.QueryContext) {
    method $formatDatabaseJson (line 113) | $formatDatabaseJson(json: objection.Pojo) {
    method $parseDatabaseJson (line 119) | $parseDatabaseJson(json: objection.Pojo) {
    method createValidator (line 125) | static createValidator() {
    method createValidationError (line 136) | static createValidationError(args: objection.CreateValidationErrorArgs) {
    method myFilter (line 144) | myFilter(query: QueryBuilder<Person>) {
    method beforeInsert (line 154) | beforeInsert(pet) {
    method modify (line 158) | modify(query) {
  function takesModelSubclass (line 170) | function takesModelSubclass<M extends objection.Model>(m: M) {}
  function takesModel (line 171) | function takesModel(m: objection.Model) {}
  function takesModelClass (line 172) | function takesModelClass(m: objection.ModelClass<any>) {}
  type TypeEqual (line 175) | type TypeEqual<T, U> =
  function takesPersonClass (line 186) | async function takesPersonClass(PersonClass: typeof Person) {
  function takesPersonQueryBuilder (line 191) | function takesPersonQueryBuilder(qb: objection.QueryBuilder<Person>): Pr...
  class Movie (line 311) | class Movie extends objection.Model {
    method fetchDirector (line 319) | fetchDirector(): PromiseLike<Person> {
  function takesMovie (line 356) | function takesMovie(m: Movie) {
  class Animal (line 372) | class Animal extends objection.Model {
    method parse (line 380) | parse(json: objection.Pojo) {
    method format (line 384) | format(json: objection.Pojo) {
  class Comment (line 396) | class Comment extends objection.Model {
  class Actor (line 440) | class Actor {
  function byId (line 446) | function byId(id: number): Promise<Person | undefined> {
  function byIds (line 452) | function byIds(ids: number[] | number[][]): PromiseLike<Person[]> {
  function whereSpecies (line 458) | function whereSpecies(species: string): PromiseLike<Animal[]> {
  function noop (line 833) | function noop() {
  function checkQueryEquivalence (line 1153) | async function checkQueryEquivalence() {
  class MyModel (line 1233) | class MyModel extends objection.mixin(objection.Model, plugin1) {
  class MyPerson (line 1242) | class MyPerson extends objection.mixin(Person, plugin1) {}
  class Interview (line 1249) | class Interview extends objection.Model {

FILE: tests/ts/fixtures/animal.ts
  class Animal (line 4) | class Animal extends objection.Model {
    method parse (line 13) | parse(json: objection.Pojo) {
    method format (line 17) | format(json: objection.Pojo) {
    method modifiers (line 22) | static get modifiers() {

FILE: tests/ts/fixtures/movie.ts
  class Movie (line 6) | class Movie extends objection.Model {

FILE: tests/ts/fixtures/person.ts
  class CustomValidationError (line 6) | class CustomValidationError extends Error {}
  class Person (line 8) | class Person extends objection.Model {
    method staticExamplePersonMethod (line 36) | static staticExamplePersonMethod() {
    method petsWithId (line 40) | petsWithId(petId: number): PromiseLike<Animal[]> {
    method fetchMom (line 44) | fetchMom(): PromiseLike<Person | undefined> {
    method $beforeInsert (line 48) | async $beforeInsert(queryContext: objection.QueryContext) {
    method $formatDatabaseJson (line 52) | $formatDatabaseJson(json: objection.Pojo) {
    method $parseDatabaseJson (line 58) | $parseDatabaseJson(json: objection.Pojo) {
    method createValidator (line 64) | static createValidator() {
    method createValidationError (line 75) | static createValidationError(args: objection.CreateValidationErrorArgs) {
    method modifiers (line 82) | static get modifiers() {

FILE: tests/ts/fixtures/review.ts
  class Review (line 3) | class Review extends objection.Model {

FILE: tests/ts/query-builder-api/eager-loading-methods.ts
  method selectNameAndId (line 18) | selectNameAndId(builder) {
  method orderByName (line 22) | orderByName(builder) {
  method onlyDogs (line 26) | onlyDogs(builder) {
  method filterFemale (line 33) | filterFemale(builder) {
  method filterDogs (line 37) | filterDogs(builder) {

FILE: tests/ts/query-builder-api/other-methods.ts
  method runBefore (line 16) | runBefore(result: any, builder: any) {
  method runAfter (line 19) | runAfter(result: any, builder: any) {
  method onBuild (line 22) | onBuild(builder: any) {}
  method onBuild (line 28) | onBuild(builder: any) {
  function modifierFunc (line 167) | function modifierFunc(query: any, arg1: any, arg2: any) {

FILE: tests/ts/transactions/using.ts
  function insertPersonAndPet (line 24) | async function insertPersonAndPet(

FILE: tests/unit/model/AjvValidator.js
  function modelClass (line 5) | function modelClass(tableName, schema) {

FILE: tests/unit/model/Model.js
  function SomeClass (line 557) | function SomeClass() {}
  class Model1 (line 1224) | class Model1 extends Model {
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class Model1 (line 1264) | class Model1 extends Model {
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class Model1 (line 1302) | class Model1 extends Model {
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class Model1 (line 1340) | class Model1 extends Model {
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class Model1 (line 1382) | class Model1 extends modelClass('Model1') {
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class Model2 (line 1392) | class Model2 extends modelClass('Model2') {
    method virtualAttributes (line 1393) | static get virtualAttributes() {
    method relationMappings (line 1397) | static get relationMappings() {
    method bar (line 1410) | get bar() {
    method virtualAttributes (line 1446) | static get virtualAttributes() {
    method relationMappings (line 1450) | static get relationMappings() {
    method bar (line 1463) | get bar() {
  class Model1 (line 1435) | class Model1 extends modelClass('Model1') {
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class Model2 (line 1445) | class Model2 extends modelClass('Model2') {
    method virtualAttributes (line 1393) | static get virtualAttributes() {
    method relationMappings (line 1397) | static get relationMappings() {
    method bar (line 1410) | get bar() {
    method virtualAttributes (line 1446) | static get virtualAttributes() {
    method relationMappings (line 1450) | static get relationMappings() {
    method bar (line 1463) | get bar() {
  class Model1 (line 1488) | class Model1 extends Model {
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class Model1 (line 1510) | class Model1 extends Model {
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class BaseModel (line 1563) | class BaseModel extends Model {
    method virtualAttributes (line 1564) | static get virtualAttributes() {
    method foo (line 1568) | get foo() {
  class Model1 (line 1573) | class Model1 extends BaseModel {}
    method foo (line 1225) | get foo() {
    method bar (line 1229) | get bar() {
    method virtualAttributes (line 1233) | static get virtualAttributes() {
    method foo (line 1265) | get foo() {
    method bar (line 1269) | get bar() {
    method virtualAttributes (line 1273) | static get virtualAttributes() {
    method foo (line 1303) | get foo() {
    method bar (line 1307) | get bar() {
    method virtualAttributes (line 1311) | static get virtualAttributes() {
    method foo (line 1341) | get foo() {
    method bar (line 1345) | get bar() {
    method virtualAttributes (line 1349) | static get virtualAttributes() {
    method virtualAttributes (line 1383) | static get virtualAttributes() {
    method foo (line 1387) | get foo() {
    method virtualAttributes (line 1436) | static get virtualAttributes() {
    method foo (line 1440) | get foo() {
    method foo (line 1489) | foo() {
    method bar (line 1493) | bar() {
    method virtualAttributes (line 1497) | static get virtualAttributes() {
    method foo (line 1511) | get foo() {
    method notEvenVirtual (line 1516) | get notEvenVirtual() {
    method bar (line 1520) | get bar() {
    method bar (line 1524) | set bar(c) {
    method baz (line 1528) | baz() {
    method virtualAttributes (line 1532) | static get virtualAttributes() {
  class Person (line 1590) | class Person extends Model {}
    method cloneObjectAttributes (line 1625) | static get cloneObjectAttributes() {
    method idColumn (line 2614) | static get idColumn() {
  class Person (line 1624) | class Person extends Model {
    method cloneObjectAttributes (line 1625) | static get cloneObjectAttributes() {
    method idColumn (line 2614) | static get idColumn() {
  class TestModel (line 1869) | class TestModel extends Model {
    method tableName (line 1870) | static get tableName() {
    method jsonSchema (line 1874) | static get jsonSchema() {
    method jsonAttributes (line 1901) | static get jsonAttributes() {
  class MyQueryBuilder1 (line 2129) | class MyQueryBuilder1 extends QueryBuilder {}
  class MyQueryBuilder2 (line 2130) | class MyQueryBuilder2 extends QueryBuilder {}
  class Person (line 2613) | class Person extends Model {
    method cloneObjectAttributes (line 1625) | static get cloneObjectAttributes() {
    method idColumn (line 2614) | static get idColumn() {
  function modelClass (line 2625) | function modelClass(tableName) {
  function createModelClass (line 2633) | function createModelClass(proto, staticStuff) {

FILE: tests/unit/queryBuilder/JoinBuilder.js
  class TestModel (line 9) | class TestModel extends Model {
    method tableName (line 10) | static get tableName() {

FILE: tests/unit/queryBuilder/QueryBuilder.js
  method tableName (line 40) | static get tableName() {
  class TestModel (line 49) | class TestModel extends Model {
    method tableName (line 935) | static get tableName() {
    method relationMappings (line 939) | static get relationMappings() {
  method a (line 223) | a(qb) {
  method b (line 227) | b(qb) {
  class TestModelRelated (line 928) | class TestModelRelated extends Model {
    method tableName (line 929) | static get tableName() {
  class TestModel (line 934) | class TestModel extends Model {
    method tableName (line 935) | static get tableName() {
    method relationMappings (line 939) | static get relationMappings() {
  class M1 (line 1540) | class M1 extends Model {
    method tableName (line 1541) | static get tableName() {
    method tableName (line 2161) | static get tableName() {
    method relationMappings (line 2165) | static get relationMappings() {
    method QueryBuilder (line 2178) | static get QueryBuilder() {
    method tableName (line 2254) | static get tableName() {
    method $afterFind (line 2258) | $afterFind() {
    method relationMappings (line 2262) | static get relationMappings() {
  class M2 (line 1546) | class M2 extends Model {
    method tableName (line 1547) | static get tableName() {
    method relationMappings (line 1551) | static get relationMappings() {
    method tableName (line 2184) | static get tableName() {
    method relationMappings (line 2188) | static get relationMappings() {
    method QueryBuilder (line 2201) | static get QueryBuilder() {
  class UnboundModel (line 1649) | class UnboundModel extends Model {
    method tableName (line 1650) | static get tableName() {
  class CustomQueryBuilder (line 1702) | class CustomQueryBuilder extends TestModel.QueryBuilder {}
  class M1
Condensed preview — 410 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,113K chars).
[
  {
    "path": ".eslintrc.json",
    "chars": 237,
    "preview": "{\n  \"parserOptions\": {\n    \"ecmaVersion\": \"latest\"\n  },\n  \"plugins\": [\n    \"prettier\"\n  ],\n  \"rules\": {\n    \"prettier/pr"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 137,
    "preview": "Please read the instructions linked below before opening an issue.\n\nhttps://vincit.github.io/objection.js/guide/contribu"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 107,
    "preview": "\nversion: 2\nupdates:\n  - package-ecosystem: 'npm'\n    directory: '/'\n    schedule:\n      interval: 'daily'\n"
  },
  {
    "path": ".github/workflows/test.yml",
    "chars": 654,
    "preview": "name: tests\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  run-tests:\n    runs-on: ubun"
  },
  {
    "path": ".gitignore",
    "chars": 199,
    "preview": "node_modules\n.history\n.idea\nscratchpad.js\ntestCoverage\nexamples/*/*.db\nexamples/*/dist\nexamples/**/package-lock.json\n*.i"
  },
  {
    "path": ".prettierrc.json",
    "chars": 88,
    "preview": "{\n  \"printWidth\": 100,\n  \"singleQuote\": true,\n  \"bracketSpacing\": true,\n  \"semi\": true\n}"
  },
  {
    "path": "LICENSE",
    "chars": 1082,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 Sami Koskimäki\n\nPermission is hereby granted, free of charge, to any person ob"
  },
  {
    "path": "README.md",
    "chars": 4916,
    "preview": "[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://"
  },
  {
    "path": "doc/.prettierrc.json",
    "chars": 88,
    "preview": "{\n  \"printWidth\": 80,\n  \"singleQuote\": true,\n  \"bracketSpacing\": true,\n  \"semi\": true\n}\n"
  },
  {
    "path": "doc/.vuepress/config.js",
    "chars": 3709,
    "preview": "module.exports = {\n  title: 'Objection.js',\n  description: 'An SQL friendly ORM for node.js',\n  base: '/objection.js/',\n"
  },
  {
    "path": "doc/.vuepress/styles/index.styl",
    "chars": 2713,
    "preview": "$bgColor = #1E1E1E;\n$mediumBgColor = #252525;\n$lightBgColor = #383838;\n$accentColor = #e0b24d;\n$textColor = #DDDDDD;\n$bo"
  },
  {
    "path": "doc/.vuepress/styles/palette.styl",
    "chars": 94,
    "preview": "$accentColor = #e0b24d;\n$textColor = #DDDDDD;\n$borderColor = #383838;\n$codeBgColor = #252525;\n"
  },
  {
    "path": "doc/.vuepress/theme/components/AlgoliaSearchBox.vue",
    "chars": 4805,
    "preview": "<template>\n  <form\n    id=\"search-form\"\n    class=\"algolia-search-wrapper search-box\"\n    role=\"search\"\n  >\n    <input\n "
  },
  {
    "path": "doc/.vuepress/theme/index.js",
    "chars": 692,
    "preview": "const path = require('path');\n\nmodule.exports = (_, ctx) => ({\n  // MODIFICATION_FROM_THEME - this alias method is impor"
  },
  {
    "path": "doc/README.md",
    "chars": 3135,
    "preview": "---\nhome: true\nheroText: Objection.js\ntagline: An SQL-friendly ORM for Node.js\nactionText: Get Started →\nactionLink: /gu"
  },
  {
    "path": "doc/api/README.md",
    "chars": 306,
    "preview": "# API Reference\n\n**NOTE**: Everything not mentioned in the API documentation is considered private implementation\nand sh"
  },
  {
    "path": "doc/api/model/instance-methods.md",
    "chars": 41492,
    "preview": "# Instance Methods\n\nAll instance methods start with the character `$` to prevent them from colliding with the database c"
  },
  {
    "path": "doc/api/model/instance-properties.md",
    "chars": 568,
    "preview": "# Instance Properties\n\nAll instance properties start with the character `$` to prevent them from colliding with the data"
  },
  {
    "path": "doc/api/model/overview.md",
    "chars": 2881,
    "preview": "# Overview\n\n## Model data lifecycle\n\nFor the purposes of this explanation, let’s define three data layouts:\n\n1. `databas"
  },
  {
    "path": "doc/api/model/static-methods.md",
    "chars": 38624,
    "preview": "# Static Methods\n\n## `static` query()\n\n```js\nconst queryBuilder = Person.query(transactionOrKnex);\n```\n\nCreates a query "
  },
  {
    "path": "doc/api/model/static-properties.md",
    "chars": 17761,
    "preview": "# Static Properties\n\n## `static` tableName\n\n```js\nclass Person extends Model {\n  static get tableName() {\n    return 'pe"
  },
  {
    "path": "doc/api/objection/README.md",
    "chars": 16068,
    "preview": "---\nsidebar: auto\n---\n\n# `module` objection\n\n```js\nconst objection = require('objection');\nconst { Model, ref } = requir"
  },
  {
    "path": "doc/api/query-builder/README.md",
    "chars": 842,
    "preview": "# `class` QueryBuilder\n\n`QueryBuilder` is the most important component in objection. Every method that allows you to fet"
  },
  {
    "path": "doc/api/query-builder/eager-methods.md",
    "chars": 21360,
    "preview": "# Eager Loading Methods\n\n## withGraphFetched()\n\n```js\nqueryBuilder = queryBuilder.withGraphFetched(relationExpression, g"
  },
  {
    "path": "doc/api/query-builder/find-methods.md",
    "chars": 44688,
    "preview": "# Find Methods\n\n## findById()\n\n```js\nqueryBuilder = queryBuilder.findById(id);\n```\n\nFinds a single item by id.\n\n##### Ar"
  },
  {
    "path": "doc/api/query-builder/join-methods.md",
    "chars": 6937,
    "preview": "# Join Methods\n\n## joinRelated()\n\n```js\nqueryBuilder = queryBuilder.joinRelated(relationExpression, opt);\n```\n\nJoins a s"
  },
  {
    "path": "doc/api/query-builder/mutate-methods.md",
    "chars": 30323,
    "preview": "# Mutating Methods\n\n## insert()\n\n```js\nqueryBuilder = queryBuilder.insert(modelsOrObjects);\n```\n\nCreates an insert query"
  },
  {
    "path": "doc/api/query-builder/other-methods.md",
    "chars": 38668,
    "preview": "# Other Methods\n\n## debug()\n\nChaining this method to any query will print all the executed SQL to console.\n\nSee [knex do"
  },
  {
    "path": "doc/api/query-builder/static-methods.md",
    "chars": 1463,
    "preview": "# Static Methods\n\n## forClass()\n\n```js\nconst builder = QueryBuilder.forClass(modelClass);\n```\n\nCreate QueryBuilder for a"
  },
  {
    "path": "doc/api/types/README.md",
    "chars": 57708,
    "preview": "---\nsidebar: auto\n---\n\n# Types\n\nThis page contains the documentation of all other types and classes than [Model](/api/mo"
  },
  {
    "path": "doc/guide/contributing.md",
    "chars": 4396,
    "preview": "# Contribution guide\n\n## Issues\n\nYou can use [github issues](https://github.com/Vincit/objection.js/issues) to request f"
  },
  {
    "path": "doc/guide/documents.md",
    "chars": 1377,
    "preview": "# Documents\n\nObjection.js makes it easy to store non-flat documents as table rows. All properties of a model that are ma"
  },
  {
    "path": "doc/guide/getting-started.md",
    "chars": 3453,
    "preview": "# Getting started\n\nTo use objection.js all you need to do is [initialize knex](https://knexjs.org/guide/#node-js) and gi"
  },
  {
    "path": "doc/guide/hooks.md",
    "chars": 14848,
    "preview": "# Hooks\n\nHooks are model methods that allow you too hook into different stages of objection queries. There are three dif"
  },
  {
    "path": "doc/guide/installation.md",
    "chars": 518,
    "preview": "# Installation\n\nObjection.js can be installed using `npm` or `yarn`. Objection uses [knex](https://knexjs.org/) as its d"
  },
  {
    "path": "doc/guide/models.md",
    "chars": 6636,
    "preview": "# Models\n\nA [Model](/api/model/) subclass represents a database table and instances of that class represent table rows. "
  },
  {
    "path": "doc/guide/plugins.md",
    "chars": 3768,
    "preview": "# Plugins\n\nA curated list of plugins and modules for objection. Only plugins that follow [the best practices](/guide/plu"
  },
  {
    "path": "doc/guide/query-examples.md",
    "chars": 44620,
    "preview": "---\nsidebarDepth: 3\n---\n\n# Query examples\n\nThe `Person` model used in the examples is defined [here](/guide/models.html#"
  },
  {
    "path": "doc/guide/relations.md",
    "chars": 7664,
    "preview": "# Relations\n\nWe already went through how to create relationships (aka. relations, associations) in the [models](/guide/m"
  },
  {
    "path": "doc/guide/transactions.md",
    "chars": 10617,
    "preview": "# Transactions\n\nTransactions are atomic and isolated units of work in relational databases. If you are not familiar with"
  },
  {
    "path": "doc/guide/validation.md",
    "chars": 2506,
    "preview": "# Validation\n\n[JSON schema](https://json-schema.org/) validation can be enabled by setting the [jsonSchema](/api/model/s"
  },
  {
    "path": "doc/recipes/composite-keys.md",
    "chars": 2214,
    "preview": "# Composite keys\n\nComposite (compound) keys are fully supported. Just give an array of columns where you would normally "
  },
  {
    "path": "doc/recipes/custom-id-column.md",
    "chars": 470,
    "preview": "# Custom id column\n\nName of the identifier column can be changed by setting the static [idColumn](/api/model/static-prop"
  },
  {
    "path": "doc/recipes/custom-query-builder.md",
    "chars": 3994,
    "preview": "# Custom query builder (extending the query builder)\n\nYou can extend the [QueryBuilder](/api/query-builder/) returned by"
  },
  {
    "path": "doc/recipes/custom-validation.md",
    "chars": 3411,
    "preview": "# Custom validation\n\nIf you want to use the json schema validation but add some custom validation on top of it you can o"
  },
  {
    "path": "doc/recipes/default-values.md",
    "chars": 704,
    "preview": "# Default values\n\nYou can set the default values for properties using the `default` property in [jsonSchema](/api/model/"
  },
  {
    "path": "doc/recipes/error-handling.md",
    "chars": 4010,
    "preview": "# Error handling\n\nObjection throws four kinds of errors:\n\n1. [ValidationError](/api/types/#class-validationerror) when a"
  },
  {
    "path": "doc/recipes/extra-properties.md",
    "chars": 3252,
    "preview": "# Join table extra properties\n\nSometimes when you have a many-to-many relationship, you want to store some properties in"
  },
  {
    "path": "doc/recipes/indexing-postgresql-jsonb-columns.md",
    "chars": 4201,
    "preview": "# Indexing PostgreSQL JSONB columns\n\nGood reading on the subject:\n\n- [JSONB type performance in PostgreSQL 9.4](https://"
  },
  {
    "path": "doc/recipes/joins.md",
    "chars": 602,
    "preview": "# Joins\n\nAgain, [do as you would with a knex query builder](https://knexjs.org/guide/query-builder.html#join):\n\n```js\nco"
  },
  {
    "path": "doc/recipes/json-queries.md",
    "chars": 1590,
    "preview": "# JSON queries\n\nYou can use the [ref](/api/objection/#ref) function from the main module to refer to json columns in que"
  },
  {
    "path": "doc/recipes/modifiers.md",
    "chars": 3786,
    "preview": "# Modifiers\n\nModifiers allow you to easily reuse snippets of query logic. A modifier is simply a function that takes a ["
  },
  {
    "path": "doc/recipes/multitenancy-using-multiple-databases.md",
    "chars": 3366,
    "preview": "# Multitenancy using multiple databases\n\nBy default, the examples guide you to setup the database connection by calling "
  },
  {
    "path": "doc/recipes/paging.md",
    "chars": 1271,
    "preview": "# Paging\n\nMost of the queries can be paged using the [page](/api/query-builder/other-methods.html#page) or [range](/api/"
  },
  {
    "path": "doc/recipes/plugins.md",
    "chars": 1386,
    "preview": "# Plugins\n\n## TypeScript Example\n\n```ts\nexport function Mixin(options = {}) {\n  return function<T extends typeof Model>("
  },
  {
    "path": "doc/recipes/polymorphic-associations.md",
    "chars": 1851,
    "preview": "# Polymorphic associations\n\nLet's assume we have tables `Comment`, `Issue` and `PullRequest`. Both `Issue` and `PullRequ"
  },
  {
    "path": "doc/recipes/precedence-and-parentheses.md",
    "chars": 395,
    "preview": "# Precedence and parentheses\n\nYou can add parentheses to queries by passing a function to any of the [where\\*](/api/quer"
  },
  {
    "path": "doc/recipes/raw-queries.md",
    "chars": 2254,
    "preview": "# Raw queries\n\nTo mix raw SQL with queries, use the [raw](/api/objection/#raw) function from the main module. [raw](/api"
  },
  {
    "path": "doc/recipes/relation-subqueries.md",
    "chars": 2119,
    "preview": "# Relation subqueries\n\nLet's say you have a `Tweet` model and a `Like` model. `Tweet` has a `HasManyRelation` named `lik"
  },
  {
    "path": "doc/recipes/returning-tricks.md",
    "chars": 1969,
    "preview": "# PostgreSQL \"returning\" tricks\n\nBecause PostgreSQL (and some others) support [returning('\\*')](/api/query-builder/find-"
  },
  {
    "path": "doc/recipes/snake-case-to-camel-case-conversion.md",
    "chars": 4062,
    "preview": "# Snake case to camel case conversion\n\nYou may want to use snake_cased names in database and camelCased names in code. T"
  },
  {
    "path": "doc/recipes/subqueries.md",
    "chars": 1484,
    "preview": "# Subqueries\n\nSubqueries can be written just like in knex: by passing a function in place of a value. A bunch of query b"
  },
  {
    "path": "doc/recipes/ternary-relationships.md",
    "chars": 5002,
    "preview": "# Ternary relationships\n\nAssume we have the following Models:\n\n1. user `(id, first_name, last_name)`\n1. group `(id, name"
  },
  {
    "path": "doc/recipes/timestamps.md",
    "chars": 501,
    "preview": "# Timestamps\n\nYou can implement the [\\$beforeInsert](/api/model/instance-methods.html#beforeinsert) and [\\$beforeUpdate]"
  },
  {
    "path": "doc/release-notes/changelog.md",
    "chars": 40583,
    "preview": "# Changelog\n\n## 3.1.5\n\n### What's new\n\n- Types: Fix generic static `this` [#2533](https://github.com/Vincit/objection.js"
  },
  {
    "path": "doc/release-notes/migration.md",
    "chars": 11673,
    "preview": "# Migration from objection 2.x to 3.0\n\nThis document guides you through each breaking change in objection 3.0 and attemp"
  },
  {
    "path": "docker-compose.yml",
    "chars": 452,
    "preview": "version: '3'\nservices:\n  postgres:\n    image: 'postgres'\n    container_name: 'objection_postgres'\n    command: postgres "
  },
  {
    "path": "examples/koa/.prettierrc.json",
    "chars": 64,
    "preview": "{\n  \"printWidth\": 100,\n  \"semi\": false,\n  \"singleQuote\": true\n}\n"
  },
  {
    "path": "examples/koa/README.md",
    "chars": 591,
    "preview": "# Koa example project\n\nThis is an example project that targets node 8.0.0 and up. The project is a simple Koa server wit"
  },
  {
    "path": "examples/koa/api.js",
    "chars": 6957,
    "preview": "'use strict'\n\nconst Person = require('./models/Person')\nconst Movie = require('./models/Movie')\n\nmodule.exports = (route"
  },
  {
    "path": "examples/koa/app.js",
    "chars": 1632,
    "preview": "const Koa = require('koa')\nconst KoaRouter = require('koa-router')\nconst bodyParser = require('koa-bodyparser')\n\nconst K"
  },
  {
    "path": "examples/koa/client.js",
    "chars": 5484,
    "preview": "'use strict'\n\n/**\n * This file contains a bunch of HTTP requests that use the\n * API defined in api.js.\n */\n\nconst axios"
  },
  {
    "path": "examples/koa/knexfile.js",
    "chars": 411,
    "preview": "module.exports = {\n  development: {\n    client: 'sqlite3',\n    useNullAsDefault: true,\n    connection: {\n      filename:"
  },
  {
    "path": "examples/koa/migrations/20150613161239_initial_schema.js",
    "chars": 1446,
    "preview": "exports.up = (knex) => {\n  return knex.schema\n    .createTable('persons', (table) => {\n      table.increments('id').prim"
  },
  {
    "path": "examples/koa/models/Animal.js",
    "chars": 1367,
    "preview": "'use strict'\n\nconst { Model } = require('objection')\n\nclass Animal extends Model {\n  // Table name is the only required "
  },
  {
    "path": "examples/koa/models/Movie.js",
    "chars": 1395,
    "preview": "'use strict'\n\nconst { Model } = require('objection')\n\nclass Movie extends Model {\n  // Table name is the only required p"
  },
  {
    "path": "examples/koa/models/Person.js",
    "chars": 3262,
    "preview": "'use strict'\n\nconst { Model } = require('objection')\n\nclass Person extends Model {\n  // Table name is the only required "
  },
  {
    "path": "examples/koa/package.json",
    "chars": 528,
    "preview": "{\n  \"name\": \"objection-example-koa\",\n  \"version\": \"3.0.0\",\n  \"description\": \"Objection.js koa example\",\n  \"main\": \"app.j"
  },
  {
    "path": "examples/koa-ts/.prettierrc.json",
    "chars": 64,
    "preview": "{\n  \"printWidth\": 100,\n  \"semi\": false,\n  \"singleQuote\": true\n}\n"
  },
  {
    "path": "examples/koa-ts/README.md",
    "chars": 605,
    "preview": "# Koa typescript example project\n\nThis is an example project that targets node 8.0.0 and up. The project is a simple Koa"
  },
  {
    "path": "examples/koa-ts/api.ts",
    "chars": 7094,
    "preview": "import Person from './models/Person'\nimport Movie from './models/Movie'\nimport KoaRouter from 'koa-router'\n\nexport defau"
  },
  {
    "path": "examples/koa-ts/app.ts",
    "chars": 1629,
    "preview": "import Koa, { Context } from 'koa'\nimport KoaRouter from 'koa-router'\nimport bodyParser from 'koa-bodyparser'\nimport Kne"
  },
  {
    "path": "examples/koa-ts/client.js",
    "chars": 5556,
    "preview": "'use strict'\n\n/**\n * This file contains a bunch of HTTP requests that use the\n * API defined in api.js.\n */\n\nconst axios"
  },
  {
    "path": "examples/koa-ts/knexfile.js",
    "chars": 411,
    "preview": "module.exports = {\n  development: {\n    client: 'sqlite3',\n    useNullAsDefault: true,\n    connection: {\n      filename:"
  },
  {
    "path": "examples/koa-ts/migrations/20150613161239_initial_schema.js",
    "chars": 1446,
    "preview": "exports.up = (knex) => {\n  return knex.schema\n    .createTable('persons', (table) => {\n      table.increments('id').prim"
  },
  {
    "path": "examples/koa-ts/models/Animal.ts",
    "chars": 1162,
    "preview": "import { Model } from 'objection'\nimport Person from './Person'\n\nexport default class Animal extends Model {\n  id!: numb"
  },
  {
    "path": "examples/koa-ts/models/Movie.ts",
    "chars": 1247,
    "preview": "import { Model } from 'objection'\nimport Person from './Person'\n\nexport default class Movie extends Model {\n  id!: numbe"
  },
  {
    "path": "examples/koa-ts/models/Person.ts",
    "chars": 3154,
    "preview": "import { Model, Modifiers } from 'objection'\nimport Movie from './Movie'\nimport Animal from './Animal'\n\nexport default c"
  },
  {
    "path": "examples/koa-ts/package.json",
    "chars": 731,
    "preview": "{\n  \"name\": \"objection-example-koa-ts\",\n  \"version\": \"3.0.0\",\n  \"description\": \"Objection.js koa typescript example\",\n  "
  },
  {
    "path": "examples/koa-ts/tsconfig.json",
    "chars": 442,
    "preview": "{\n  \"compilerOptions\": {\n    \"allowUnreachableCode\": false,\n    \"alwaysStrict\": true,\n    \"module\": \"commonjs\",\n    \"mod"
  },
  {
    "path": "examples/minimal/README.md",
    "chars": 454,
    "preview": "# Minimal example project.\n\nThis example has the bare minimum to get you running queries and testing out things with obj"
  },
  {
    "path": "examples/minimal/app.js",
    "chars": 813,
    "preview": "'use strict';\n\nconst Knex = require('knex');\nconst knexConfig = require('./knexfile');\n\nconst { Model } = require('objec"
  },
  {
    "path": "examples/minimal/knexfile.js",
    "chars": 413,
    "preview": "module.exports = {\n  development: {\n    client: 'sqlite3',\n    useNullAsDefault: true,\n    connection: {\n      filename:"
  },
  {
    "path": "examples/minimal/migrations/20190330121219_initial_schema.js",
    "chars": 287,
    "preview": "'use strict';\n\nexports.up = (knex) => {\n  return knex.schema.createTable('persons', (table) => {\n    table.increments('i"
  },
  {
    "path": "examples/minimal/models/Person.js",
    "chars": 220,
    "preview": "'use strict';\n\nconst { Model } = require('objection');\n\nclass Person extends Model {\n  // Table name is the only require"
  },
  {
    "path": "examples/minimal/package.json",
    "chars": 433,
    "preview": "{\n  \"name\": \"objection-example-minimal\",\n  \"version\": \"2.0.0\",\n  \"description\": \"Objection.js minimal example project\",\n"
  },
  {
    "path": "examples/plugin/README.md",
    "chars": 952,
    "preview": "# Objection.js example plugin\n\nThis project serves as the best practices example of an objection.js plugin.\n\nThe plugin "
  },
  {
    "path": "examples/plugin/index.js",
    "chars": 2587,
    "preview": "'use strict';\n\n// Objection.js plugins are class mixins. Read this excellent article for detailed description:\n// http:/"
  },
  {
    "path": "examples/plugin/package.json",
    "chars": 482,
    "preview": "{\n  \"name\": \"objection-plugin-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"An example plugin for objection\",\n  \"mai"
  },
  {
    "path": "examples/plugin/tests.js",
    "chars": 2194,
    "preview": "'use strict';\n\nconst sessionPlugin = require('./');\nconst expect = require('expect.js');\nconst { Model } = require('obje"
  },
  {
    "path": "examples/plugin-with-options/README.md",
    "chars": 1384,
    "preview": "# Objection.js example plugin with options\n\nThis project serves as the best practices example of an objection.js plugin "
  },
  {
    "path": "examples/plugin-with-options/index.js",
    "chars": 3489,
    "preview": "'use strict';\n\n// Objection.js plugins are class mixins. Read this excellent article for detailed description:\n// http:/"
  },
  {
    "path": "examples/plugin-with-options/package.json",
    "chars": 482,
    "preview": "{\n  \"name\": \"objection-plugin-example\",\n  \"version\": \"1.0.0\",\n  \"description\": \"An example plugin for objection\",\n  \"mai"
  },
  {
    "path": "examples/plugin-with-options/tests.js",
    "chars": 3167,
    "preview": "'use strict';\n\nconst sessionPluginFactory = require('./');\nconst expect = require('expect.js');\nconst { Model } = requir"
  },
  {
    "path": "lib/.eslintrc.json",
    "chars": 96,
    "preview": "{\n  \"parserOptions\": {\n    \"sourceType\": \"script\"\n  },\n  \"rules\": {\n    \"strict\": \"error\"\n  }\n}\n"
  },
  {
    "path": "lib/initialize.js",
    "chars": 286,
    "preview": "'use strict';\n\nasync function initialize(knex, modelClasses) {\n  if (!modelClasses) {\n    modelClasses = knex;\n    knex "
  },
  {
    "path": "lib/model/AjvValidator.js",
    "chars": 8696,
    "preview": "'use strict';\n\nconst Ajv = require('ajv');\nconst addFormats = require('ajv-formats');\nconst { Validator } = require('./V"
  },
  {
    "path": "lib/model/Model.js",
    "chars": 22996,
    "preview": "'use strict';\n\nconst { clone } = require('./modelClone');\nconst { bindKnex } = require('./modelBindKnex');\nconst { valid"
  },
  {
    "path": "lib/model/ModifierNotFoundError.js",
    "chars": 271,
    "preview": "'use strict';\n\nclass ModifierNotFoundError extends Error {\n  constructor(modifierName) {\n    super(`Unable to determine "
  },
  {
    "path": "lib/model/NotFoundError.js",
    "chars": 580,
    "preview": "'use strict';\n\nclass NotFoundError extends Error {\n  constructor({ modelClass, data = {}, statusCode = 404, ...rest } = "
  },
  {
    "path": "lib/model/RelationDoesNotExistError.js",
    "chars": 303,
    "preview": "'use strict';\n\nclass RelationDoesNotExistError extends Error {\n  constructor(relationName) {\n    super(`unknown relation"
  },
  {
    "path": "lib/model/ValidationError.js",
    "chars": 1226,
    "preview": "'use strict';\n\nconst { asArray, isString } = require('../utils/objectUtils');\n\nconst ValidationErrorType = {\n  ModelVali"
  },
  {
    "path": "lib/model/Validator.js",
    "chars": 441,
    "preview": "'use strict';\n\nclass Validator {\n  constructor(...args) {\n    this.constructor.init(this, ...args);\n  }\n\n  static init()"
  },
  {
    "path": "lib/model/getModel.js",
    "chars": 200,
    "preview": "'use strict';\n\n// A small helper method for cached lazy-importing of the Model class.\nlet Model;\nconst getModel = () => "
  },
  {
    "path": "lib/model/graph/ModelGraph.js",
    "chars": 1686,
    "preview": "'use strict';\n\nconst { ModelGraphBuilder } = require('./ModelGraphBuilder');\nconst NOT_CALCULATED = {};\n\nclass ModelGrap"
  },
  {
    "path": "lib/model/graph/ModelGraphBuilder.js",
    "chars": 6109,
    "preview": "'use strict';\n\nconst { isObject, isString, asArray, asSingle } = require('../../utils/objectUtils');\nconst { ValidationE"
  },
  {
    "path": "lib/model/graph/ModelGraphEdge.js",
    "chars": 930,
    "preview": "'use strict';\n\nconst Type = {\n  Relation: 'Relation',\n  Reference: 'Reference',\n};\n\nconst ReferenceType = {\n  Object: 'O"
  },
  {
    "path": "lib/model/graph/ModelGraphNode.js",
    "chars": 5206,
    "preview": "'use strict';\n\nconst { ModelGraphEdge } = require('./ModelGraphEdge');\nconst { isNumber } = require('../../utils/objectU"
  },
  {
    "path": "lib/model/inheritModel.js",
    "chars": 481,
    "preview": "'use strict';\n\nconst cache = new Map();\n\nfunction inheritModel(modelClass) {\n  let inherit = cache.get(modelClass.name);"
  },
  {
    "path": "lib/model/modelBindKnex.js",
    "chars": 2317,
    "preview": "'use strict';\n\nconst { inheritModel } = require('./inheritModel');\nconst { staticHiddenProps } = require('./modelUtils')"
  },
  {
    "path": "lib/model/modelClone.js",
    "chars": 2659,
    "preview": "'use strict';\n\nconst { isObject, cloneDeep } = require('../utils/objectUtils');\nconst { hiddenProps } = require('./model"
  },
  {
    "path": "lib/model/modelColPropMap.js",
    "chars": 874,
    "preview": "'use strict';\n\nconst { difference } = require('../utils/objectUtils');\n\nfunction columnNameToPropertyName(modelClass, co"
  },
  {
    "path": "lib/model/modelId.js",
    "chars": 1307,
    "preview": "'use strict';\n\nfunction getSetId(model, maybeId) {\n  if (maybeId !== undefined) {\n    return setId(model, maybeId);\n  } "
  },
  {
    "path": "lib/model/modelJsonAttributes.js",
    "chars": 2239,
    "preview": "'use strict';\n\nconst { asArray, isObject, flatten, isString } = require('../utils/objectUtils');\n\nfunction parseJsonAttr"
  },
  {
    "path": "lib/model/modelParseRelations.js",
    "chars": 1862,
    "preview": "'use strict';\n\nconst { isObject } = require('../utils/objectUtils');\n\nfunction parseRelationsIntoModelInstances(model, j"
  },
  {
    "path": "lib/model/modelQueryProps.js",
    "chars": 3731,
    "preview": "'use strict';\n\nconst { isObject, isFunction } = require('../utils/objectUtils');\nconst { defineNonEnumerableProperty } ="
  },
  {
    "path": "lib/model/modelSet.js",
    "chars": 3332,
    "preview": "'use strict';\n\nconst { isInternalProp } = require('../utils/internalPropUtils');\nconst { splitQueryProps } = require('./"
  },
  {
    "path": "lib/model/modelTableMetadata.js",
    "chars": 2273,
    "preview": "'use strict';\n\nconst { defineNonEnumerableProperty } = require('./modelUtils');\nconst { isPromise } = require('../utils/"
  },
  {
    "path": "lib/model/modelToJson.js",
    "chars": 4238,
    "preview": "'use strict';\n\nconst { isInternalProp } = require('../utils/internalPropUtils');\nconst { mergeQueryProps } = require('./"
  },
  {
    "path": "lib/model/modelUtils.js",
    "chars": 866,
    "preview": "'use strict';\n\nconst hiddenProps = ['$$queryProps'];\n\nconst staticHiddenProps = [\n  '$$knex',\n  '$$validator',\n  '$$json"
  },
  {
    "path": "lib/model/modelValidate.js",
    "chars": 1253,
    "preview": "'use strict';\n\nconst { clone } = require('./modelClone');\n\nfunction validate(model, json, options = {}) {\n  json = json "
  },
  {
    "path": "lib/model/modelValues.js",
    "chars": 2466,
    "preview": "'use strict';\n\nconst { isObject } = require('../utils/objectUtils');\n\n// Property keys needs to be prefixed with a non-n"
  },
  {
    "path": "lib/model/modelVisitor.js",
    "chars": 1079,
    "preview": "'use strict';\n\nfunction visitModels(models, modelClass, visitor) {\n  doVisit(models, modelClass, null, null, visitor);\n}"
  },
  {
    "path": "lib/objection.js",
    "chars": 3220,
    "preview": "'use strict';\n\nconst {\n  DBError,\n  UniqueViolationError,\n  NotNullViolationError,\n  ForeignKeyViolationError,\n  Constra"
  },
  {
    "path": "lib/queryBuilder/FunctionBuilder.js",
    "chars": 998,
    "preview": "'use strict';\n\nconst { RawBuilder, normalizeRawArgs } = require('./RawBuilder');\nconst { asSingle, isNumber } = require("
  },
  {
    "path": "lib/queryBuilder/InternalOptions.js",
    "chars": 664,
    "preview": "'use strict';\n\nclass InternalOptions {\n  constructor() {\n    this.skipUndefined = false;\n    this.keepImplicitJoinProps "
  },
  {
    "path": "lib/queryBuilder/JoinBuilder.js",
    "chars": 3429,
    "preview": "'use strict';\n\nconst { QueryBuilderOperationSupport } = require('./QueryBuilderOperationSupport');\nconst { KnexOperation"
  },
  {
    "path": "lib/queryBuilder/QueryBuilder.js",
    "chars": 37135,
    "preview": "'use strict';\n\nconst { wrapError } = require('db-errors');\n\nconst { raw } = require('./RawBuilder');\nconst { createModif"
  },
  {
    "path": "lib/queryBuilder/QueryBuilderBase.js",
    "chars": 21052,
    "preview": "'use strict';\n\nconst { QueryBuilderOperationSupport } = require('./QueryBuilderOperationSupport');\nconst { isSqlite, isM"
  },
  {
    "path": "lib/queryBuilder/QueryBuilderContext.js",
    "chars": 512,
    "preview": "'use strict';\n\nconst { QueryBuilderContextBase } = require('./QueryBuilderContextBase');\n\nclass QueryBuilderContext exte"
  },
  {
    "path": "lib/queryBuilder/QueryBuilderContextBase.js",
    "chars": 752,
    "preview": "'use strict';\n\nconst { InternalOptions } = require('./InternalOptions');\n\nclass QueryBuilderContextBase {\n  constructor("
  },
  {
    "path": "lib/queryBuilder/QueryBuilderOperationSupport.js",
    "chars": 12622,
    "preview": "'use strict';\n\nconst { isString, isFunction, isRegExp, mergeMaps, last } = require('../utils/objectUtils');\nconst { Quer"
  },
  {
    "path": "lib/queryBuilder/QueryBuilderUserContext.js",
    "chars": 655,
    "preview": "'use strict';\n\nconst SYMBOL_BUILDER = Symbol();\n\nclass QueryBuilderUserContext {\n  constructor(builder) {\n    // This sh"
  },
  {
    "path": "lib/queryBuilder/RawBuilder.js",
    "chars": 1666,
    "preview": "'use strict';\n\nconst { isPlainObject } = require('../utils/objectUtils');\nconst { buildArg } = require('../utils/buildUt"
  },
  {
    "path": "lib/queryBuilder/ReferenceBuilder.js",
    "chars": 4755,
    "preview": "'use strict';\n\nconst { parseFieldExpression } = require('../utils/parseFieldExpression');\nconst { isObject } = require('"
  },
  {
    "path": "lib/queryBuilder/RelationExpression.js",
    "chars": 10592,
    "preview": "'use strict';\n\nconst parser = require('./parsers/relationExpressionParser');\nconst { isObject, isNumber, isString, union"
  },
  {
    "path": "lib/queryBuilder/StaticHookArguments.js",
    "chars": 2546,
    "preview": "'use strict';\n\nconst { asArray } = require('../utils/objectUtils');\n\nconst BUILDER_SYMBOL = Symbol();\n\nclass StaticHookA"
  },
  {
    "path": "lib/queryBuilder/ValueBuilder.js",
    "chars": 1950,
    "preview": "'use strict';\n\nconst { asArray, isObject } = require('../utils/objectUtils');\nconst { buildArg } = require('../utils/bui"
  },
  {
    "path": "lib/queryBuilder/graph/GraphAction.js",
    "chars": 1441,
    "preview": "'use strict';\n\nconst { isPostgres } = require('../../utils/knexUtils');\n\nconst POSTGRES_MAX_INSERT_BATCH_SIZE = 100;\ncon"
  },
  {
    "path": "lib/queryBuilder/graph/GraphData.js",
    "chars": 291,
    "preview": "'use strict';\n\nclass GraphData {\n  constructor({ graph, currentGraph, graphOptions, nodeDbExistence }) {\n    this.graph "
  },
  {
    "path": "lib/queryBuilder/graph/GraphFetcher.js",
    "chars": 5459,
    "preview": "'use strict';\n\nconst { asArray, groupBy } = require('../../utils/objectUtils');\nconst { ModelGraph } = require('../../mo"
  },
  {
    "path": "lib/queryBuilder/graph/GraphNodeDbExistence.js",
    "chars": 5681,
    "preview": "'use strict';\n\nconst { GraphData } = require('./GraphData');\nconst { GraphAction } = require('./GraphAction');\nconst pro"
  },
  {
    "path": "lib/queryBuilder/graph/GraphOperation.js",
    "chars": 374,
    "preview": "'use strict';\n\nclass GraphOperation {\n  constructor(graphData) {\n    this.graphData = graphData;\n  }\n\n  get graph() {\n  "
  },
  {
    "path": "lib/queryBuilder/graph/GraphOptions.js",
    "chars": 5668,
    "preview": "'use strict';\n\nconst NO_RELATE = 'noRelate';\nconst NO_UNRELATE = 'noUnrelate';\nconst NO_INSERT = 'noInsert';\nconst NO_UP"
  },
  {
    "path": "lib/queryBuilder/graph/GraphUpsert.js",
    "chars": 9230,
    "preview": "'use strict';\n\nconst { ModelGraph } = require('../../model/graph/ModelGraph');\nconst { ModelGraphEdge } = require('../.."
  },
  {
    "path": "lib/queryBuilder/graph/delete/GraphDelete.js",
    "chars": 473,
    "preview": "'use strict';\n\nconst { GraphOperation } = require('../GraphOperation');\nconst { GraphDeleteAction } = require('./GraphDe"
  },
  {
    "path": "lib/queryBuilder/graph/delete/GraphDeleteAction.js",
    "chars": 2182,
    "preview": "'use strict';\n\nconst { GraphAction } = require('../GraphAction');\nconst { groupBy } = require('../../../utils/objectUtil"
  },
  {
    "path": "lib/queryBuilder/graph/insert/GraphInsert.js",
    "chars": 4133,
    "preview": "'use strict';\n\nconst { JoinRowGraphInsertAction } = require('./JoinRowGraphInsertAction');\nconst { GraphInsertAction } ="
  },
  {
    "path": "lib/queryBuilder/graph/insert/GraphInsertAction.js",
    "chars": 6184,
    "preview": "'use strict';\n\nconst { GraphAction } = require('../GraphAction');\nconst { groupBy, chunk, get, set } = require('../../.."
  },
  {
    "path": "lib/queryBuilder/graph/insert/JoinRowGraphInsertAction.js",
    "chars": 2580,
    "preview": "'use strict';\n\nconst { GraphAction } = require('../GraphAction');\nconst { groupBy, chunk } = require('../../../utils/obj"
  },
  {
    "path": "lib/queryBuilder/graph/patch/GraphPatch.js",
    "chars": 457,
    "preview": "'use strict';\n\nconst { GraphOperation } = require('../GraphOperation');\nconst { GraphPatchAction } = require('./GraphPat"
  },
  {
    "path": "lib/queryBuilder/graph/patch/GraphPatchAction.js",
    "chars": 8079,
    "preview": "'use strict';\n\nconst { getModel } = require('../../../model/getModel');\nconst { GraphAction } = require('../GraphAction'"
  },
  {
    "path": "lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsert.js",
    "chars": 756,
    "preview": "'use strict';\n\nconst { GraphOperation } = require('../GraphOperation');\nconst { GraphRecursiveUpsertAction } = require('"
  },
  {
    "path": "lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsertAction.js",
    "chars": 3353,
    "preview": "'use strict';\n\nconst { GraphAction } = require('../GraphAction');\nconst { groupBy, get, set } = require('../../../utils/"
  },
  {
    "path": "lib/queryBuilder/join/JoinResultColumn.js",
    "chars": 487,
    "preview": "'use strict';\n\nclass JoinResultColumn {\n  constructor({ columnAlias, tableNode, name }) {\n    this.columnAlias = columnA"
  },
  {
    "path": "lib/queryBuilder/join/JoinResultParser.js",
    "chars": 2877,
    "preview": "'use strict';\n\nconst { JoinResultColumn } = require('./JoinResultColumn');\nconst { groupBy } = require('../../utils/obje"
  },
  {
    "path": "lib/queryBuilder/join/RelationJoiner.js",
    "chars": 9896,
    "preview": "'use strict';\n\nconst { uniqBy } = require('../../utils/objectUtils');\nconst { Selection } = require('../operations/selec"
  },
  {
    "path": "lib/queryBuilder/join/TableNode.js",
    "chars": 3577,
    "preview": "'use strict';\n\nclass TableNode {\n  constructor({ tableTree, modelClass, expression, parentNode = null, relation = null }"
  },
  {
    "path": "lib/queryBuilder/join/TableTree.js",
    "chars": 1995,
    "preview": "'use strict';\n\nconst { forEachChildExpression } = require('./utils');\nconst { TableNode } = require('./TableNode');\n\ncla"
  },
  {
    "path": "lib/queryBuilder/join/utils.js",
    "chars": 739,
    "preview": "'use strict';\n\nconst { ValidationErrorType } = require('../../model/ValidationError');\n\nconst ID_LENGTH_LIMIT = 63;\ncons"
  },
  {
    "path": "lib/queryBuilder/operations/DelegateOperation.js",
    "chars": 3407,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\n// Operation that simply delegates"
  },
  {
    "path": "lib/queryBuilder/operations/DeleteOperation.js",
    "chars": 1154,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\nconst { StaticHookArguments } = req"
  },
  {
    "path": "lib/queryBuilder/operations/FindByIdOperation.js",
    "chars": 801,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\nconst { assertIdNotUndefined } = re"
  },
  {
    "path": "lib/queryBuilder/operations/FindByIdsOperation.js",
    "chars": 541,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass FindByIdsOperation extends Q"
  },
  {
    "path": "lib/queryBuilder/operations/FindOperation.js",
    "chars": 4038,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\nconst { StaticHookArguments } = req"
  },
  {
    "path": "lib/queryBuilder/operations/FirstOperation.js",
    "chars": 527,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass FirstOperation extends Query"
  },
  {
    "path": "lib/queryBuilder/operations/FromOperation.js",
    "chars": 2441,
    "preview": "'use strict';\n\nconst { ObjectionToKnexConvertingOperation } = require('./ObjectionToKnexConvertingOperation');\nconst { i"
  },
  {
    "path": "lib/queryBuilder/operations/InsertAndFetchOperation.js",
    "chars": 1381,
    "preview": "'use strict';\n\nconst { InsertOperation } = require('./InsertOperation');\nconst { DelegateOperation } = require('./Delega"
  },
  {
    "path": "lib/queryBuilder/operations/InsertGraphAndFetchOperation.js",
    "chars": 1076,
    "preview": "'use strict';\n\nconst { DelegateOperation } = require('./DelegateOperation');\nconst { InsertGraphOperation } = require('."
  },
  {
    "path": "lib/queryBuilder/operations/InsertGraphOperation.js",
    "chars": 2604,
    "preview": "'use strict';\n\nconst { DelegateOperation } = require('./DelegateOperation');\nconst { InsertOperation } = require('./Inse"
  },
  {
    "path": "lib/queryBuilder/operations/InsertOperation.js",
    "chars": 4134,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\nconst { StaticHookArguments } = req"
  },
  {
    "path": "lib/queryBuilder/operations/InstanceDeleteOperation.js",
    "chars": 1068,
    "preview": "'use strict';\n\nconst { DeleteOperation } = require('./DeleteOperation');\nconst { InstanceFindOperation } = require('./In"
  },
  {
    "path": "lib/queryBuilder/operations/InstanceFindOperation.js",
    "chars": 415,
    "preview": "'use strict';\n\nconst { FindOperation } = require('./FindOperation');\nconst { assertHasId } = require('../../utils/assert"
  },
  {
    "path": "lib/queryBuilder/operations/InstanceInsertOperation.js",
    "chars": 457,
    "preview": "'use strict';\n\nconst { InsertOperation } = require('./InsertOperation');\n\nclass InstanceInsertOperation extends InsertOp"
  },
  {
    "path": "lib/queryBuilder/operations/InstanceUpdateOperation.js",
    "chars": 1242,
    "preview": "'use strict';\n\nconst { UpdateOperation } = require('./UpdateOperation');\nconst { InstanceFindOperation } = require('./In"
  },
  {
    "path": "lib/queryBuilder/operations/JoinRelatedOperation.js",
    "chars": 2728,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\nconst { RelationExpression } = requ"
  },
  {
    "path": "lib/queryBuilder/operations/KnexOperation.js",
    "chars": 404,
    "preview": "'use strict';\n\nconst { ObjectionToKnexConvertingOperation } = require('./ObjectionToKnexConvertingOperation');\n\n// An op"
  },
  {
    "path": "lib/queryBuilder/operations/MergeOperation.js",
    "chars": 1335,
    "preview": "'use strict';\n\nconst { isFunction, isEmpty, isObject } = require('../../utils/objectUtils');\nconst { QueryBuilderOperati"
  },
  {
    "path": "lib/queryBuilder/operations/ObjectionToKnexConvertingOperation.js",
    "chars": 5387,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\nconst { isPlainObject, isObject, is"
  },
  {
    "path": "lib/queryBuilder/operations/OnBuildKnexOperation.js",
    "chars": 536,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass OnBuildKnexOperation extends"
  },
  {
    "path": "lib/queryBuilder/operations/OnBuildOperation.js",
    "chars": 494,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass OnBuildOperation extends Que"
  },
  {
    "path": "lib/queryBuilder/operations/OnErrorOperation.js",
    "chars": 508,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass OnErrorOperation extends Que"
  },
  {
    "path": "lib/queryBuilder/operations/QueryBuilderOperation.js",
    "chars": 9328,
    "preview": "'use strict';\n\nconst hookNameToHasMethodName = {\n  onAdd: 'hasOnAdd',\n  onBefore1: 'hasOnBefore1',\n  onBefore2: 'hasOnBe"
  },
  {
    "path": "lib/queryBuilder/operations/RangeOperation.js",
    "chars": 1001,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass RangeOperation extends Query"
  },
  {
    "path": "lib/queryBuilder/operations/RelateOperation.js",
    "chars": 470,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass RelateOperation extends Quer"
  },
  {
    "path": "lib/queryBuilder/operations/ReturningOperation.js",
    "chars": 907,
    "preview": "'use strict';\n\nconst { flatten } = require('../../utils/objectUtils');\nconst { ObjectionToKnexConvertingOperation } = re"
  },
  {
    "path": "lib/queryBuilder/operations/RunAfterOperation.js",
    "chars": 513,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass RunAfterOperation extends Qu"
  },
  {
    "path": "lib/queryBuilder/operations/RunBeforeOperation.js",
    "chars": 516,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass RunBeforeOperation extends Q"
  },
  {
    "path": "lib/queryBuilder/operations/UnrelateOperation.js",
    "chars": 419,
    "preview": "'use strict';\n\nconst { QueryBuilderOperation } = require('./QueryBuilderOperation');\n\nclass UnrelateOperation extends Qu"
  },
  {
    "path": "lib/queryBuilder/operations/UpdateAndFetchOperation.js",
    "chars": 1638,
    "preview": "'use strict';\n\nconst { DelegateOperation } = require('./DelegateOperation');\nconst { FindByIdOperation } = require('./Fi"
  }
]

// ... and 210 more files (download for full content)

About this extraction

This page contains the full source code of the Vincit/objection.js GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 410 files (2.8 MB), approximately 765.7k tokens, and a symbol index with 2826 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!