Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dancannon committed Feb 15, 2015
1 parent 8e0e95f commit d8c38c9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion connection_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (c *Connection) readHandshakeSuccess() error {
return nil
}

func (c *Connection) writeQueryg(token int64, q []byte) error {
func (c *Connection) writeQuery(token int64, q []byte) error {
pos := 0
dataLen := 8 + 4 + len(q)

Expand Down
5 changes: 5 additions & 0 deletions encoding/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func valueDecoder(dv, sv reflect.Value) decoderFunc {
return invalidValueDecoder
}

if dv.IsValid() {
dv = indirect(dv, false)
dv.Set(reflect.Zero(dv.Type()))
}

return typeDecoder(dv.Type(), sv.Type())
}

Expand Down
13 changes: 12 additions & 1 deletion types/geometry.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package types

import "fmt"
import (
"fmt"
)

type Geometry struct {
Type string
Expand All @@ -23,6 +25,15 @@ func (g Geometry) MarshalRQL() (interface{}, error) {
}

func (g *Geometry) UnmarshalRQL(data interface{}) error {
if data, ok := data.(Geometry); ok {
g.Type = data.Type
g.Point = data.Point
g.Line = data.Line
g.Lines = data.Lines

return nil
}

m, ok := data.(map[string]interface{})
if !ok {
return fmt.Errorf("pseudo-type GEOMETRY object is not valid")
Expand Down
2 changes: 1 addition & 1 deletion wercker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ build:
name: Test
code: |-
go get -u gopkg.in/check.v1
go test ./...
go test ./... -short
- script:
name: Store cache
code: |-
Expand Down

0 comments on commit d8c38c9

Please sign in to comment.