Explorar o código

ajout de l'engine

dpacaud %!s(int64=12) %!d(string=hai) anos
pai
achega
0ff6547a1f
Modificáronse 1 ficheiros con 42 adicións e 0 borrados
  1. 42 0
      engines/timersEngine.js

+ 42 - 0
engines/timersEngine.js

@@ -0,0 +1,42 @@
+/**
+ *
+ *
+ */
+function MySQLBackendGaugesEngine() {
+	var self = this;
+}
+
+
+/**
+ *
+ *
+ */
+MySQLBackendGaugesEngine.prototype.buildQuerries = function(timers, time_stamp) {
+
+	var querries = [];
+	 // Iterate on each gauge
+    for(var timerName in timers) {
+      var timerValue = timers[timerName];
+      if(timerValue.length === 0) {
+        continue;
+      } else {
+
+        for(valueIndex in timerValue){
+          // We insert the raw timers data, you will need to calculate specific stats on the frontend
+          querries.push("insert into `timers_statistics` values (null," + time_stamp + ",'" + timerName + "'," + timerValue[valueIndex] + ");");  
+        }
+      }
+    }
+
+    return querries;
+}
+
+
+/**
+ *
+ *
+ */
+exports.init = function() {
+	var instance = new MySQLBackendGaugesEngine();
+  return instance;
+};