5
5
"os"
6
6
"strconv"
7
7
"strings"
8
+
8
9
"github.com/gomodule/redigo/redis"
9
10
"github.com/olekukonko/tablewriter"
10
11
)
@@ -16,10 +17,10 @@ const (
16
17
RELATIONSHIPS_DELETED string = "Relationships deleted"
17
18
PROPERTIES_SET string = "Properties set"
18
19
RELATIONSHIPS_CREATED string = "Relationships created"
19
- INDICES_CREATED string = "Indices created"
20
- INDICES_DELETED string = "Indices deleted"
20
+ INDICES_CREATED string = "Indices created"
21
+ INDICES_DELETED string = "Indices deleted"
21
22
INTERNAL_EXECUTION_TIME string = "Query internal execution time"
22
- CACHED_EXECUTION string = "Cached execution"
23
+ CACHED_EXECUTION string = "Cached execution"
23
24
)
24
25
25
26
type ResultSetColumnTypes int
@@ -55,11 +56,11 @@ type QueryResultHeader struct {
55
56
56
57
// QueryResult represents the results of a query.
57
58
type QueryResult struct {
58
- graph * Graph
59
- header QueryResultHeader
60
- results []* Record
61
- statistics map [string ]float64
62
- current_record_idx int
59
+ graph * Graph
60
+ header QueryResultHeader
61
+ results []* Record
62
+ statistics map [string ]float64
63
+ current_record_idx int
63
64
}
64
65
65
66
func QueryResultNew (g * Graph , response interface {}) (* QueryResult , error ) {
@@ -70,7 +71,7 @@ func QueryResultNew(g *Graph, response interface{}) (*QueryResult, error) {
70
71
column_names : make ([]string , 0 ),
71
72
column_types : make ([]ResultSetColumnTypes , 0 ),
72
73
},
73
- graph : g ,
74
+ graph : g ,
74
75
current_record_idx : - 1 ,
75
76
}
76
77
@@ -243,12 +244,10 @@ func (qr *QueryResult) parseMap(cell interface{}) map[string]interface{} {
243
244
}
244
245
245
246
func (qr * QueryResult ) parsePoint (cell interface {}) map [string ]float64 {
247
+ array := cell .([]interface {})
246
248
point := make (map [string ]float64 )
247
- var array = cell .([]interface {})
248
- if len (array ) == 2 {
249
- point ["latitude" ], _ = redis .Float64 (array [0 ], nil )
250
- point ["longitude" ], _ = redis .Float64 (array [1 ], nil )
251
- }
249
+ point ["latitude" ], _ = redis .Float64 (array [0 ], nil )
250
+ point ["longitude" ], _ = redis .Float64 (array [1 ], nil )
252
251
return point
253
252
}
254
253
@@ -400,4 +399,3 @@ func (qr *QueryResult) InternalExecutionTime() float64 {
400
399
func (qr * QueryResult ) CachedExecution () int {
401
400
return int (qr .getStat (CACHED_EXECUTION ))
402
401
}
403
-
0 commit comments