Skip to content

Commit

Permalink
forgot how HSET commands work
Browse files Browse the repository at this point in the history
  • Loading branch information
minemo committed Sep 13, 2023
1 parent 8ba9498 commit ada7a93
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/datalogger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,16 @@ impl DataLogger {
creator.arg(format!("{}:lookup",base_key));
let alldata: Vec<PVSignal> = [self.general_data.as_slice(), self.storage_data.as_slice(), self.pvs.iter().map(|x| [x.current.clone(), x.voltage.clone()]).flatten().collect::<Vec<PVSignal>>().as_slice()].concat();
for d in alldata.iter() {
creator.arg(&d.name).arg(&d.unit).arg(&d.gain);
creator.arg(&d.name).arg(&d.unit);
}
let _: () = creator.query(&mut con).unwrap();
// adding a gain-scaling-table to database if it doesnt already exist
debug!("Updating/adding scaling table");
let mut creator = redis::cmd("HSET");
creator.arg(format!("{}:scaling",base_key));
let alldata: Vec<PVSignal> = [self.general_data.as_slice(), self.storage_data.as_slice(), self.pvs.iter().map(|x| [x.current.clone(), x.voltage.clone()]).flatten().collect::<Vec<PVSignal>>().as_slice()].concat();
for d in alldata.iter() {
creator.arg(&d.name).arg(&d.gain);
}
let _: () = creator.query(&mut con).unwrap();

Expand Down

0 comments on commit ada7a93

Please sign in to comment.