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

32 lines
533 B
JavaScript
Raw Normal View History

"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();
}
}
2019-05-29 10:36:36 +00:00
export default RSSIRepo;