forked from ravendb/ravendb-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle_criteria.go
35 lines (30 loc) · 1.13 KB
/
circle_criteria.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
package ravendb
// CircleCriteria describes circle criteria
type CircleCriteria struct {
SpatialCriteriaCommon
_radius float64
_latitude float64
_longitude float64
_radiusUnits SpatialUnits
}
// NewCircleCriteria returns new CircleCriteria
func NewCircleCriteria(radius float64, latitude float64, longitude float64, radiusUnits SpatialUnits, relation SpatialRelation, distErrorPercent float64) *CircleCriteria {
res := &CircleCriteria{
_radius: radius,
_latitude: latitude,
_longitude: longitude,
_radiusUnits: radiusUnits,
}
res._relation = relation
res._distanceErrorPct = distErrorPercent
return res
}
// ToQueryToken creates a token
func (c *CircleCriteria) ToQueryToken(fieldName string, addQueryParameter func(interface{}) string) queryToken {
return c.SpatialCriteriaCommon.toQueryTokenCommon(c, fieldName, addQueryParameter)
}
// GetShapeToken returns shapeToken
func (c *CircleCriteria) GetShapeToken(addQueryParameter func(interface{}) string) *shapeToken {
return shapeTokenCircle(addQueryParameter(c._radius), addQueryParameter(c._latitude),
addQueryParameter(c._longitude), c._radiusUnits)
}