]>
Commit | Line | Data |
---|---|---|
d9bf974f | 1 | import { QueryTypes, Sequelize, Transaction } from 'sequelize' |
d9bf974f | 2 | |
1d43c3a6 C |
3 | /** |
4 | * | |
5 | * Abstact builder to run video SQL queries | |
6 | * | |
7 | */ | |
8 | ||
7e7d8e48 | 9 | export class AbstractRunQuery { |
d9bf974f C |
10 | protected sequelize: Sequelize |
11 | ||
12 | protected query: string | |
13 | protected replacements: any = {} | |
14 | ||
71d4af1e | 15 | protected runQuery (options: { transaction?: Transaction, logging?: boolean } = {}) { |
71d4af1e C |
16 | const queryOptions = { |
17 | transaction: options.transaction, | |
18 | logging: options.logging, | |
d9bf974f C |
19 | replacements: this.replacements, |
20 | type: QueryTypes.SELECT as QueryTypes.SELECT, | |
37a44fc9 | 21 | nest: false |
d9bf974f C |
22 | } |
23 | ||
71d4af1e | 24 | return this.sequelize.query<any>(this.query, queryOptions) |
d9bf974f C |
25 | } |
26 | } |