/
meteoQueries.go
50 lines (37 loc) · 909 Bytes
/
meteoQueries.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package ldb
import (
"database/sql"
"log"
"github.com/deeper-x/goship/conf"
)
// GetActiveStations todo doc
func GetActiveStations() []map[string]string {
var portinformerCode, idPortinformer, tsFirstCreated, isActive sql.NullString
var result = []map[string]string{}
connector := Connect()
mapper.GenResource(conf.PMeteoSQL)
rows, err := mapper.resource.Query(connector, "meteo-active-stations")
if err != nil {
log.Fatal(err)
}
defer rows.Close()
for rows.Next() {
err := rows.Scan(
&idPortinformer,
&portinformerCode,
&tsFirstCreated,
&isActive,
)
if err != nil {
log.Fatal(err)
}
tmpDict := map[string]string{
"id_portinformer": idPortinformer.String,
"portinformer_code": portinformerCode.String,
"ts_first_created": tsFirstCreated.String,
"is_active": isActive.String,
}
result = append(result, tmpDict)
}
return result
}