forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_query.go
61 lines (50 loc) · 1.34 KB
/
index_query.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
51
52
53
54
55
56
57
58
59
60
61
package ravendb
import (
"time"
)
type IndexQuery struct {
// from IndexQueryBase<T>
pageSize int // if 0, not set
query string
queryParameters Parameters
start int
waitForNonStaleResults bool
waitForNonStaleResultsTimeout time.Duration
// from IndexQueryWithParameters
skipDuplicateChecking bool
// from IndexQuery
disableCaching bool
}
// from IndexQuery
func NewIndexQuery(query string) *IndexQuery {
return &IndexQuery{
query: query,
pageSize: 0,
}
}
// from IndexQueryBase<T>
// TODO: only for tests? Could expose with build-tags only for testing
func (q *IndexQuery) GetQuery() string {
return q.query
}
// TODO: only for tests? Could expose with build-tags only for testing
func (q *IndexQuery) GetQueryParameters() Parameters {
return q.queryParameters
}
func (q *IndexQuery) GetQueryHash() string {
hasher := &HashCalculator{}
hasher.write(q.query)
hasher.write(q.waitForNonStaleResults)
hasher.write(q.skipDuplicateChecking)
//TBD 4.1 hasher.write(isShowTimings());
//TBD 4.1 hasher.write(isExplainScores());
n := int64(q.waitForNonStaleResultsTimeout)
hasher.write(n)
hasher.write(q.start)
hasher.write(q.pageSize)
hasher.write(q.queryParameters)
return hasher.getHash()
}
func (q *IndexQuery) String() string {
return q.query
}