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

30 lines
511 B
JavaScript
Raw Normal View History

"use strict";
class GatewayRepo {
constructor({ database }) {
this.db = database;
}
add(...gateways) {
if(typeof this.query_insert == "undefined")
this.query_insert = this.db.prepare(`INSERT INTO gateways (
id,
lat, long,
altitude
) VALUES (
:id,
:latitude, :longitude,
:altitude
)`);
for(let gateway of gateways)
this.insert_query.run(gateway);
}
iterate() {
return this.db.prepare(`SELECT * FROM gateways`).iterate();
}
}
2019-05-29 10:36:36 +00:00
export default GatewayRepo;