aerospike / aerospike-client-go

Aerospike Client Go
Apache License 2.0
429 stars 199 forks source link

Use Bytes() instead of Interface().([]byte) for reflect.Slice marshalling #382

Closed slobodyanyuk closed 1 year ago

slobodyanyuk commented 2 years ago

When trying to marshal field with custom type that has bytearray underneath (like datatypes.JSON from GORM) I get this: interface conversion: interface {} is datatypes.JSON, not []uint8

In our mocks I replaced the following line: [/marshal.go](../marshal.go#L113)

with: return f.Bytes()

And everything seems to work well.

Is this possible to do the same in aerospike-client? Return bytes without type assertion seems quiet safe because (reflect.Value).Bytes says: Bytes returns v's underlying value. It panics if v's underlying value is not a slice of bytes.

khaf commented 1 year ago

Thank you for your feedback. This issue was addressed in v6.4.0 released September 16 2022.