-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e2116d
commit c59d90e
Showing
10 changed files
with
1,004 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* @adonisjs/lucid | ||
* | ||
* (c) Harminder Virk <virk@adonisjs.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/// <reference path="../../../../adonis-typings/index.ts" /> | ||
|
||
import knex from 'knex' | ||
import { QueryClientContract } from '@ioc:Adonis/Lucid/Database' | ||
import { ManyToManyRelationContract, ManyToManyQueryBuilderContract } from '@ioc:Adonis/Lucid/Model' | ||
|
||
import { ModelQueryBuilder } from '../../QueryBuilder' | ||
|
||
export class ManyToManyQueryBuilder extends ModelQueryBuilder implements ManyToManyQueryBuilderContract { | ||
constructor ( | ||
builder: knex.QueryBuilder, | ||
private _relation: ManyToManyRelationContract, | ||
client: QueryClientContract, | ||
) { | ||
super(builder, _relation.relatedModel(), client) | ||
} | ||
|
||
public pivotColumns (columns: string[]): this { | ||
this.$knexBuilder.select(columns.map((column) => { | ||
return `${this._relation.pivotTable}.${column} as pivot_${column}` | ||
})) | ||
return this | ||
} | ||
} |
Oops, something went wrong.