summaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/pborman
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-12-16 15:49:04 -0500
committerChristopher Speller <crspeller@gmail.com>2015-12-16 15:49:04 -0500
commitf54936467101bb08bbdf7f3d9c341134c06b83c3 (patch)
tree5976a456548fce8beb79014c7c2780afeea89a8a /Godeps/_workspace/src/github.com/pborman
parentf08deca79f24ff1efe086483a091cf807a5a2e14 (diff)
downloadchat-f54936467101bb08bbdf7f3d9c341134c06b83c3.tar.gz
chat-f54936467101bb08bbdf7f3d9c341134c06b83c3.tar.bz2
chat-f54936467101bb08bbdf7f3d9c341134c06b83c3.zip
Updating go dependancies
Diffstat (limited to 'Godeps/_workspace/src/github.com/pborman')
-rw-r--r--Godeps/_workspace/src/github.com/pborman/uuid/sql.go18
-rw-r--r--Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go5
2 files changed, 18 insertions, 5 deletions
diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/sql.go b/Godeps/_workspace/src/github.com/pborman/uuid/sql.go
index 2d7679e2a..98b23aa15 100644
--- a/Godeps/_workspace/src/github.com/pborman/uuid/sql.go
+++ b/Godeps/_workspace/src/github.com/pborman/uuid/sql.go
@@ -24,14 +24,22 @@ func (uuid *UUID) Scan(src interface{}) error {
*uuid = parsed
case []byte:
- // assumes a simple slice of bytes, just check validity and store
- u := UUID(src.([]byte))
+ b := src.([]byte)
- if u.Variant() == Invalid {
- return errors.New("Scan: invalid UUID format")
+ // assumes a simple slice of bytes if 16 bytes
+ // otherwise attempts to parse
+ if len(b) == 16 {
+ *uuid = UUID(b)
+ } else {
+ u := Parse(string(b))
+
+ if u == nil {
+ return errors.New("Scan: invalid UUID format")
+ }
+
+ *uuid = u
}
- *uuid = u
default:
return fmt.Errorf("Scan: unable to scan type %T into UUID", src)
}
diff --git a/Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go b/Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go
index d643567ee..83bac8cac 100644
--- a/Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go
+++ b/Godeps/_workspace/src/github.com/pborman/uuid/sql_test.go
@@ -22,6 +22,11 @@ func TestScan(t *testing.T) {
t.Fatal(err)
}
+ err = (&uuid).Scan([]byte(stringTest))
+ if err != nil {
+ t.Fatal(err)
+ }
+
err = (&uuid).Scan(byteTest)
if err != nil {
t.Fatal(err)