I have been using some uint64 types in my database (MySQL supports BIGINT UNSIGNED) and having trouble using database/sql with it:
_, err = db.Exec("INSERT INTO ... ?", myUint64Value)
sql: converting argument #2's type: uint64 values with high bit set are not supported
I looked at the code quickly and it seems that database/sql's idea of a Value is something that might be NULL. The high bit is used to determine whether the value is NULL or not. Is that correct?
If so, this is not a great design IMO. I'm not sure what the right design is, but this is a limitation I will have to think hard to design around... I think the best way so far is for me to fmt.Sprintf("%d", myUint64Value). But that is not what I want to litter through my code :-( The other option I can see is to use an array of bytes instead of a uint64, but that's pretty clumsy to convert back and forth too.
It might be better to use boxing and unboxing to represent a Value, rather than saying "we reserve one bit of your data for our own uses, sorry."
Thoughts? Suggestions?
- Boris