55 "os"
66 "strconv"
77 "strings"
8+
89 "github.com/gomodule/redigo/redis"
910 "github.com/olekukonko/tablewriter"
1011)
@@ -16,10 +17,10 @@ const (
1617 RELATIONSHIPS_DELETED string = "Relationships deleted"
1718 PROPERTIES_SET string = "Properties set"
1819 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"
2122 INTERNAL_EXECUTION_TIME string = "Query internal execution time"
22- CACHED_EXECUTION string = "Cached execution"
23+ CACHED_EXECUTION string = "Cached execution"
2324)
2425
2526type ResultSetColumnTypes int
@@ -55,11 +56,11 @@ type QueryResultHeader struct {
5556
5657// QueryResult represents the results of a query.
5758type 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
6364}
6465
6566func QueryResultNew (g * Graph , response interface {}) (* QueryResult , error ) {
@@ -70,7 +71,7 @@ func QueryResultNew(g *Graph, response interface{}) (*QueryResult, error) {
7071 column_names : make ([]string , 0 ),
7172 column_types : make ([]ResultSetColumnTypes , 0 ),
7273 },
73- graph : g ,
74+ graph : g ,
7475 current_record_idx : - 1 ,
7576 }
7677
@@ -243,12 +244,10 @@ func (qr *QueryResult) parseMap(cell interface{}) map[string]interface{} {
243244}
244245
245246func (qr * QueryResult ) parsePoint (cell interface {}) map [string ]float64 {
247+ array := cell .([]interface {})
246248 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 )
252251 return point
253252}
254253
@@ -400,4 +399,3 @@ func (qr *QueryResult) InternalExecutionTime() float64 {
400399func (qr * QueryResult ) CachedExecution () int {
401400 return int (qr .getStat (CACHED_EXECUTION ))
402401}
403-
0 commit comments