harmonized Timing between Query/Write
This commit is contained in:
parent
f5df4898a3
commit
c50db56b73
|
@ -21,7 +21,7 @@ gorqlite should be considered alpha until more testers share their experiences.
|
|||
* Support for several rqlite-specific operations:
|
||||
* `Leader()` and `Peers()` to examine the cluster.
|
||||
* `SetConsistencyLevel()` can be called at any time on a connection to change the consistency level for future operations.
|
||||
* `Timing()` can be called on a per-result basis to retrieve the timings information for executed operations as float64, per the rqlite API.
|
||||
* `Timing` can be referenced on a per-result basis to retrieve the timings information for executed operations as float64, per the rqlite API.
|
||||
* `Trace(io.Writer)`/`Trace(nil)` can be used to turn on/off debugging information on everything gorqlite does to a io.Writer of your choice.
|
||||
* No external dependencies. Uses only standard library functions.
|
||||
|
||||
|
|
18
query.go
18
query.go
|
@ -167,7 +167,7 @@ func (conn *Connection) Query(sqlStatements []string) (results []QueryResult, er
|
|||
}
|
||||
|
||||
// time is a float64
|
||||
thisQR.timing = thisResult["time"].(float64)
|
||||
thisQR.Timing = thisResult["time"].(float64)
|
||||
|
||||
// column & type are an array of strings
|
||||
c := thisResult["columns"].([]interface{})
|
||||
|
@ -186,7 +186,7 @@ func (conn *Connection) Query(sqlStatements []string) (results []QueryResult, er
|
|||
|
||||
thisQR.rowNumber = -1
|
||||
|
||||
trace("%s: this result (#col,time) %d %f",conn.ID,len(thisQR.columns),thisQR.timing)
|
||||
trace("%s: this result (#col,time) %d %f",conn.ID,len(thisQR.columns),thisQR.Timing)
|
||||
results = append(results,thisQR)
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ type QueryResult struct {
|
|||
Err error
|
||||
columns []string
|
||||
types []string
|
||||
timing float64
|
||||
Timing float64
|
||||
values []interface{}
|
||||
rowNumber int64
|
||||
}
|
||||
|
@ -394,15 +394,3 @@ func (qr *QueryResult) Types() []string {
|
|||
return qr.types
|
||||
}
|
||||
|
||||
/* *****************************************************************
|
||||
|
||||
method: QueryResult.Timing()
|
||||
|
||||
* *****************************************************************/
|
||||
|
||||
/*
|
||||
Timing() returns this QueryResult's execution time, as reported by rqlite.
|
||||
*/
|
||||
func (qr *QueryResult) Timing() float64 {
|
||||
return qr.timing
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue