(events: Event[])
| 236 | } |
| 237 | |
| 238 | public async createMany(events: Event[]): Promise<number> { |
| 239 | if (!events.length) { |
| 240 | return 0 |
| 241 | } |
| 242 | |
| 243 | const rows = events.map((event) => this.toInsertRow(event)) |
| 244 | |
| 245 | return this.masterDbClient('events') |
| 246 | .insert(rows) |
| 247 | .onConflict() |
| 248 | .ignore() |
| 249 | .then(prop('rowCount') as () => number, () => 0) |
| 250 | } |
| 251 | |
| 252 | private toInsertRow(event: Event) { |
| 253 | return applySpec({ |
nothing calls this directly
no test coverage detected