-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
63 lines (50 loc) · 1.69 KB
/
types.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
62
63
package mgoc
import "go.mongodb.org/mongo-driver/bson/primitive"
type ObjectID = primitive.ObjectID
type Decimal128 = primitive.Decimal128
type DateTime = primitive.DateTime
type GeoType string
const (
GeoTypePoint GeoType = "Point"
GeoTypeMultiPoint GeoType = "MultiPoint"
GeoTypeLineString GeoType = "LineString"
GeoTypeMultiLineString GeoType = "MultiLineString"
GeoTypePolygon GeoType = "Polygon"
GeoTypeMultiPolygon GeoType = "MultiPolygon"
)
type Coordinate struct {
X float64 `json:"x" bson:"x"`
Y float64 `json:"y" bson:"y"`
}
type FloatArray = []float64
type FloatArray2 = []FloatArray
type FloatArray3 = []FloatArray2
type FloatArray4 = []FloatArray3
type Geometry struct {
Type GeoType `json:"type" bson:"type"`
Coordinates interface{} `json:"coordinates" bson:"coordinates"`
}
type GeoPoint struct {
Type GeoType `json:"type" bson:"type"`
Coordinates FloatArray `json:"coordinates" bson:"coordinates"`
}
type GeoMultiPoint struct {
Type GeoType `json:"type" bson:"type"`
Coordinates FloatArray2 `json:"coordinates" bson:"coordinates"`
}
type GeoLineString struct {
Type GeoType `json:"type" bson:"type"`
Coordinates FloatArray2 `json:"coordinates" bson:"coordinates"`
}
type GeoMultiLineString struct {
Type GeoType `json:"type" bson:"type"`
Coordinates FloatArray3 `json:"coordinates" bson:"coordinates"`
}
type GeoPolygon struct {
Type GeoType `json:"type" bson:"type"`
Coordinates FloatArray3 `json:"coordinates" bson:"coordinates"`
}
type GeoMultiPolygon struct {
Type GeoType `json:"type" bson:"type"`
Coordinates FloatArray4 `json:"coordinates" bson:"coordinates"`
}