joao-r-reis commented on code in PR #1838:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1838#discussion_r1853987009
##########
marshal.go:
##########
@@ -1706,7 +1708,7 @@ func unmarshalList(info TypeInfo, data []byte, value
interface{}) error {
}
return nil
}
- return unmarshalErrorf("can not unmarshal %s into %T", info, value)
+ return unmarshalErrorf("can not unmarshal %s into %T. Accepted types:
slice, array.", info, value)
Review Comment:
I think it has to be `*slice, *array`
##########
marshal.go:
##########
@@ -2280,7 +2282,7 @@ func marshalUDT(info TypeInfo, value interface{})
([]byte, error) {
}
if k.Kind() != reflect.Struct || !k.IsValid() {
- return nil, marshalErrorf("cannot marshal %T into %s", value,
info)
+ return nil, marshalErrorf("cannot marshal %T into %s. Accepted
types: Marshaler, UDTMarshaler, map[string]interface{}, struct, UnsetValue.",
value, info)
Review Comment:
It looks like `struct` is also accepted here
##########
marshal.go:
##########
@@ -2392,7 +2394,7 @@ func unmarshalUDT(info TypeInfo, data []byte, value
interface{}) error {
}
k := rv.Elem()
if k.Kind() != reflect.Struct || !k.IsValid() {
- return unmarshalErrorf("cannot unmarshal %s into %T", info,
value)
+ return unmarshalErrorf("cannot unmarshal %s into %T. Accepted
types: Unmarshaler, UDTUnmarshaler, *map[string]interface{}, struct.", info,
value)
Review Comment:
`*struct`
##########
marshal.go:
##########
@@ -2208,7 +2210,7 @@ func unmarshalTuple(info TypeInfo, data []byte, value
interface{}) error {
return nil
}
- return unmarshalErrorf("cannot unmarshal %s into %T", info, value)
+ return unmarshalErrorf("cannot unmarshal %s into %T. Accepted types:
struct, []interface{}, array, slice.", info, value)
Review Comment:
Unmarshaler is also accepted I think. Also the accepted types other than
`[]interface{}` have to be a pointer if I'm reading the code correctly (so
`*struct, *array, *slice`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]