Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tux21b/gocql
Browse files Browse the repository at this point in the history
  • Loading branch information
tux21b committed Feb 2, 2014
2 parents 7889222 + f590187 commit 01f7e50
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ func marshalUUID(info *TypeInfo, value interface{}) ([]byte, error) {
}

func unmarshalUUID(info *TypeInfo, data []byte, value interface{}) error {
if data == nil {
if data == nil || len(data) == 0 {
switch v := value.(type) {
case *string:
*v = ""
Expand All @@ -932,11 +932,15 @@ func unmarshalUUID(info *TypeInfo, data []byte, value interface{}) error {
default:
return unmarshalErrorf("can not unmarshal X %s into %T", info, value)
}

return nil
}

u, err := UUIDFromBytes(data)
if err != nil {
return unmarshalErrorf("Unable to parse UUID: %s", err)
}

switch v := value.(type) {
case *string:
*v = u.String()
Expand Down

0 comments on commit 01f7e50

Please sign in to comment.