uuid
2015-12-14
Parent:e0d83ad4145f
uuid/uuid.go
Fix build errors. Guess who screwed up and assumed UUID types were ID types? This guy. This corrects my mistake when casting to the underlying types to call the methods. Also, turns out the underlying type satisfies the Scan interface but not the Value interface, for whatever arbitrary reason. So reimplement our (very basic) Value interface.
1.1 --- a/uuid.go Mon Dec 14 03:47:41 2015 -0800 1.2 +++ b/uuid.go Mon Dec 14 03:53:59 2015 -0800 1.3 @@ -43,19 +43,19 @@ 1.4 } 1.5 1.6 func (id ID) MarshalJSON() ([]byte, error) { 1.7 - return uuid.ID(id).MarshalJSON() 1.8 + return uuid.UUID(id).MarshalJSON() 1.9 } 1.10 1.11 func (id ID) Value() (driver.Value, error) { 1.12 - return uuid.ID(id).Value() 1.13 + return id.String(), nil 1.14 } 1.15 1.16 func (id *ID) Scan(src interface{}) error { 1.17 - return (*uuid.ID)(id).Scan(src) 1.18 + return (*uuid.UUID)(id).Scan(src) 1.19 } 1.20 1.21 func (id *ID) UnmarshalJSON(in []byte) error { 1.22 - return (*uuid.ID)(id).UnmarshalJSON(in) 1.23 + return (*uuid.UUID)(id).UnmarshalJSON(in) 1.24 } 1.25 1.26 func Parse(in string) (ID, error) {