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

35 lines
560 B
JavaScript
Raw Normal View History

"use strict";
import { get_instance } from '../Helpers/Database.mjs';
class RSSIRepo {
constructor() {
this.db = get_instance();
}
add(...rssis) {
if(typeof this.query_insert == "undefined")
this.query_insert = this.db.prepare(`INSERT INTO rssis (
id,
reading_id,
rssi, snr,
channel
) VALUES (
:id,
:reading_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;