LoRaWAN-Signal-Mapping/server/Repos.SQLite/RSSIRepo.mjs

31 lines
532 B
JavaScript

"use strict";
class RSSIRepo {
constructor({ database }) {
this.db = database;
}
add(...rssis) {
if(typeof this.query_insert == "undefined")
this.query_insert = this.db.prepare(`INSERT INTO rssis (
id,
reading_id, gateway_id,
rssi, snr,
channel
) VALUES (
:id,
:reading_id, :gateway_id
:rssi, :snr,
:channel
)`);
for(let rssi of rssis)
this.insert_query.run(rssi);
}
iterate() {
return this.db.prepare(`SELECT * FROM rssis`).iterate();
}
}
export default RSSIRepo;