Add Null values and new measurements
This commit is contained in:
parent
c6e735950f
commit
c83feeb845
8 changed files with 331 additions and 11 deletions
33
data/data.go
33
data/data.go
|
@ -66,24 +66,36 @@ func InsertSets(sets Sets) {
|
|||
|
||||
m := model.Measurement()
|
||||
q := m.Insert(m.Time, m.MeterID,
|
||||
m.CGem1, m.CGem2, m.CGem3,
|
||||
m.CGem1, m.CGem2, m.CGem3, m.CGemN,
|
||||
m.Ep1, m.Ep2, m.Ep3,
|
||||
m.IGem1, m.IGem2, m.IGem3,
|
||||
m.IGem1, m.IGem2, m.IGem3, m.IGemN,
|
||||
m.IMax1, m.IMax2, m.IMax3,
|
||||
m.PMax1, m.PMax2, m.PMax3,
|
||||
m.SMax1, m.SMax2, m.SMax3,
|
||||
m.UGem1, m.UGem2, m.UGem3,
|
||||
m.UGem1, m.UGem2, m.UGem3, m.UGemN,
|
||||
m.BGem1, m.BGem2, m.BGem3, m.BGemN,
|
||||
m.SGem1, m.SGem2, m.SGem3, m.SGemN,
|
||||
m.PGem1, m.PGem2, m.PGem3, m.PGemN,
|
||||
m.Ithd1, m.Ithd2, m.Ithd3, m.IthdN,
|
||||
m.Uthd1, m.Uthd2, m.Uthd3, m.UthdN,
|
||||
m.Freq,
|
||||
)
|
||||
|
||||
for k, v := range sets {
|
||||
q.Values(k.Time, k.Meter,
|
||||
v[`CGem1`], v[`CGem2`], v[`CGem3`],
|
||||
v[`CGem1`], v[`CGem2`], v[`CGem3`], ifExists(v, `CGemN`),
|
||||
v[`EP1`], v[`EP2`], v[`EP3`],
|
||||
v[`IGem1`], v[`IGem2`], v[`IGem3`],
|
||||
v[`IGem1`], v[`IGem2`], v[`IGem3`], ifExists(v, `IGemN`),
|
||||
v[`IMax1`], v[`IMax2`], v[`IMax3`],
|
||||
v[`PMax1`], v[`PMax2`], v[`PMax3`],
|
||||
v[`SMax1`], v[`SMax2`], v[`SMax3`],
|
||||
v[`UGem1`], v[`UGem2`], v[`UGem3`],
|
||||
v[`UGem1`], v[`UGem2`], v[`UGem3`], ifExists(v, `UGemN`),
|
||||
v[`BGem1`], v[`BGem2`], v[`BGem3`], ifExists(v, `BGemN`),
|
||||
v[`SGem1`], v[`SGem2`], v[`SGem3`], ifExists(v, `SGemN`),
|
||||
v[`PGem1`], v[`PGem2`], v[`PGem3`], ifExists(v, `PGemN`),
|
||||
v[`ITHD1`], v[`ITHD2`], v[`ITHD3`], ifExists(v, `ITHDN`),
|
||||
v[`UTHD1`], v[`UTHD2`], v[`UTHD3`], ifExists(v, `UTHDN`),
|
||||
v[`FREQ`],
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -92,3 +104,12 @@ func InsertSets(sets Sets) {
|
|||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func ifExists(set Set, k string) interface{} {
|
||||
v, ok := set[k]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue