Reader functions String() and Bytes() and thus Result.Scan(Scanner) currently only supports returning values when tokenLen < buf.Size() the problem is obviously that this is a bit obscure. Should this be documented as an "expected behaviour" and steer people to use Result.Scan(io.Writer) instead (and throw appropriate error messages) or should we implement support for size up to Redis max size?
The first way would encourage "good behaviour", as in that it makes people think about how much memory they're allocating (and thus copying) and steer them to using various buffers (such as strings.Builder{} or bytes.Buffer{}) rather than "blindly" use the primitive types. The second would allow people to shoot themselves in the foot if they want to, and many people may want that. 🤔
I'm currently leaning towards throwing errors and encourage good behaviour as I'm a bit of a Good Samaritan in that sense.
Reader functions
String()andBytes()and thusResult.Scan(Scanner)currently only supports returning values whentokenLen < buf.Size()the problem is obviously that this is a bit obscure. Should this be documented as an "expected behaviour" and steer people to useResult.Scan(io.Writer)instead (and throw appropriate error messages) or should we implement support for size up to Redis max size?The first way would encourage "good behaviour", as in that it makes people think about how much memory they're allocating (and thus copying) and steer them to using various buffers (such as
strings.Builder{}orbytes.Buffer{}) rather than "blindly" use the primitive types. The second would allow people to shoot themselves in the foot if they want to, and many people may want that. 🤔I'm currently leaning towards throwing errors and encourage good behaviour as I'm a bit of a Good Samaritan in that sense.