| 1 | package typesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.14 fmt/" |
| 5 | ) |
| 6 | |
| 7 | type Geometryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry# struct { |
| 8 | Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. string |
| 9 | Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Point. Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point# |
| 10 | Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Line. Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line# |
| 11 | Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Lines. Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines# |
| 12 | } |
| 13 | |
| 14 | func (g Geometryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#) MarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#MarshalRQL().() (interface{}, error) { |
| 15 | switch g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. { |
| 16 | case "Point": |
| 17 | return g.Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Point..MarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#MarshalRQL().() |
| 18 | case "LineString": |
| 19 | return g.Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Line..MarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#MarshalRQL().() |
| 20 | case "Polygon": |
| 21 | return g.Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Lines..MarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#MarshalRQL().() |
| 22 | default: |
| 23 | return nil, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object field 'type' %s is not valid", g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type.) |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | func (g *Geometryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#) UnmarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#UnmarshalRQL().(data interface{}) error { |
| 28 | if data, ok := data.(Geometryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#); ok { |
| 29 | g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. = data.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. |
| 30 | g.Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Point. = data.Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Point. |
| 31 | g.Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Line. = data.Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Line. |
| 32 | g.Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Lines. = data.Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Lines. |
| 33 | |
| 34 | return nil |
| 35 | } |
| 36 | |
| 37 | m, ok := data.(map[string]interface{}) |
| 38 | if !ok { |
| 39 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object is not valid") |
| 40 | } |
| 41 | |
| 42 | typ, ok := m["type"] |
| 43 | if !ok { |
| 44 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object is not valid, expects 'type' field") |
| 45 | } |
| 46 | coords, ok := m["coordinates"] |
| 47 | if !ok { |
| 48 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object is not valid, expects 'coordinates' field") |
| 49 | } |
| 50 | |
| 51 | var err error |
| 52 | switch typ { |
| 53 | case "Point": |
| 54 | g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. = "Point" |
| 55 | g.Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Point., err = UnmarshalPointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/UnmarshalPoint().(coords) |
| 56 | case "LineString": |
| 57 | g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. = "LineString" |
| 58 | g.Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Line., err = UnmarshalLineStringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/UnmarshalLineString().(coords) |
| 59 | case "Polygon": |
| 60 | g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. = "Polygon" |
| 61 | g.Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Lines., err = UnmarshalPolygonscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/UnmarshalPolygon().(coords) |
| 62 | default: |
| 63 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object has invalid type") |
| 64 | } |
| 65 | |
| 66 | if err != nil { |
| 67 | return err |
| 68 | } |
| 69 | |
| 70 | return nil |
| 71 | } |
| 72 | |
| 73 | type Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point# struct { |
| 74 | Lonscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lon. float64 |
| 75 | Latscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lat. float64 |
| 76 | } |
| 77 | type Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line# []Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point# |
| 78 | type Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines# []Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line# |
| 79 | |
| 80 | func (p Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#) Coordsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Coords().() interface{} { |
| 81 | return []interface{}{p.Lonscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lon., p.Latscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lat.} |
| 82 | } |
| 83 | |
| 84 | func (p Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#) MarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#MarshalRQL().() (interface{}, error) { |
| 85 | return map[string]interface{}{ |
| 86 | "$reql_type$": "GEOMETRY", |
| 87 | "coordinates": p.Coordsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Coords().(), |
| 88 | "type": "Point", |
| 89 | }, nil |
| 90 | } |
| 91 | |
| 92 | func (p *Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#) UnmarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#UnmarshalRQL().(data interface{}) error { |
| 93 | g := &Geometryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#{} |
| 94 | err := g.UnmarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#UnmarshalRQL().(data) |
| 95 | if err != nil { |
| 96 | return err |
| 97 | } |
| 98 | if g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. != "Point" { |
| 99 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object has type %s, expected type %s", g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type., "Point") |
| 100 | } |
| 101 | |
| 102 | p.Latscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lat. = g.Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Point..Latscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lat. |
| 103 | p.Lonscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lon. = g.Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Point..Lonscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lon. |
| 104 | |
| 105 | return nil |
| 106 | } |
| 107 | |
| 108 | func (l Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#) Coordsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#Coords().() interface{} { |
| 109 | coords := make([]interface{}, len(l)) |
| 110 | for i, point := range l { |
| 111 | coords[i] = point.Coordsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Coords().() |
| 112 | } |
| 113 | return coords |
| 114 | } |
| 115 | |
| 116 | func (l Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#) MarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#MarshalRQL().() (interface{}, error) { |
| 117 | return map[string]interface{}{ |
| 118 | "$reql_type$": "GEOMETRY", |
| 119 | "coordinates": l.Coordsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#Coords().(), |
| 120 | "type": "LineString", |
| 121 | }, nil |
| 122 | } |
| 123 | |
| 124 | func (l *Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#) UnmarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#UnmarshalRQL().(data interface{}) error { |
| 125 | g := &Geometryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#{} |
| 126 | err := g.UnmarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#UnmarshalRQL().(data) |
| 127 | if err != nil { |
| 128 | return err |
| 129 | } |
| 130 | if g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. != "LineString" { |
| 131 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object has type %s, expected type %s", g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type., "LineString") |
| 132 | } |
| 133 | |
| 134 | *l = g.Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Line. |
| 135 | |
| 136 | return nil |
| 137 | } |
| 138 | |
| 139 | func (l Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#) Coordsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#Coords().() interface{} { |
| 140 | coords := make([]interface{}, len(l)) |
| 141 | for i, line := range l { |
| 142 | coords[i] = line.Coordsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#Coords().() |
| 143 | } |
| 144 | return coords |
| 145 | } |
| 146 | |
| 147 | func (l Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#) MarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#MarshalRQL().() (interface{}, error) { |
| 148 | return map[string]interface{}{ |
| 149 | "$reql_type$": "GEOMETRY", |
| 150 | "coordinates": l.Coordsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#Coords().(), |
| 151 | "type": "Polygon", |
| 152 | }, nil |
| 153 | } |
| 154 | |
| 155 | func (l *Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#) UnmarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#UnmarshalRQL().(data interface{}) error { |
| 156 | g := &Geometryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#{} |
| 157 | err := g.UnmarshalRQLscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#UnmarshalRQL().(data) |
| 158 | if err != nil { |
| 159 | return err |
| 160 | } |
| 161 | if g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type. != "Polygon" { |
| 162 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object has type %s, expected type %s", g.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Type., "Polygon") |
| 163 | } |
| 164 | |
| 165 | *l = g.Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Geometry#Lines. |
| 166 | |
| 167 | return nil |
| 168 | } |
| 169 | |
| 170 | func UnmarshalPointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/UnmarshalPoint().(v interface{}) (Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#, error) { |
| 171 | coords, ok := v.([]interface{}) |
| 172 | if !ok { |
| 173 | return Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#{}, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object field 'coordinates' is not valid") |
| 174 | } |
| 175 | if len(coords) != 2 { |
| 176 | return Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#{}, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object field 'coordinates' is not valid") |
| 177 | } |
| 178 | lon, ok := coords[0].(float64) |
| 179 | if !ok { |
| 180 | return Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#{}, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object field 'coordinates' is not valid") |
| 181 | } |
| 182 | lat, ok := coords[1].(float64) |
| 183 | if !ok { |
| 184 | return Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#{}, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object field 'coordinates' is not valid") |
| 185 | } |
| 186 | |
| 187 | return Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#{ |
| 188 | Lonscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lon.: lon, |
| 189 | Latscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Point#Lat.: lat, |
| 190 | }, nil |
| 191 | } |
| 192 | |
| 193 | func UnmarshalLineStringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/UnmarshalLineString().(v interface{}) (Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#, error) { |
| 194 | points, ok := v.([]interface{}) |
| 195 | if !ok { |
| 196 | return Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#{}, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object field 'coordinates' is not valid") |
| 197 | } |
| 198 | |
| 199 | var err error |
| 200 | line := make(Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#, len(points)) |
| 201 | for i, coords := range points { |
| 202 | line[i], err = UnmarshalPointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/UnmarshalPoint().(coords) |
| 203 | if err != nil { |
| 204 | return Linescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Line#{}, err |
| 205 | } |
| 206 | } |
| 207 | return line, nil |
| 208 | } |
| 209 | |
| 210 | func UnmarshalPolygonscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/UnmarshalPolygon().(v interface{}) (Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#, error) { |
| 211 | lines, ok := v.([]interface{}) |
| 212 | if !ok { |
| 213 | return Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#{}, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("pseudo-type GEOMETRY object field 'coordinates' is not valid") |
| 214 | } |
| 215 | |
| 216 | var err error |
| 217 | polygon := make(Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#, len(lines)) |
| 218 | for i, line := range lines { |
| 219 | polygon[i], err = UnmarshalLineStringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/UnmarshalLineString().(line) |
| 220 | if err != nil { |
| 221 | return Linesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/types`/Lines#{}, err |
| 222 | } |
| 223 | } |
| 224 | return polygon, nil |
| 225 | } |