jmoiron / modl

golang database modelling library
MIT License
479 stars 48 forks source link

Work around database/sql not being able to write large uint64 values #24

Closed roblillack closed 9 years ago

roblillack commented 9 years ago

Go's sql package has this extremely weird restriction of not allowing to store uint64 with the highest bit set:

I needed a quick solution for a project, so I worked around this using the applied patch. It is tested with SQLite only.

Please decide if this is the right way to work around the issue and how to proceed from here.

roblillack commented 9 years ago

The possibility of this code working is highly dependent of the used column type, as SQLite does not really support uint64 INTEGER columns. Therefore, more work is needed if you want to use uint64 values with Go, modl, and SQLite.

My proposed solution is to create a private type deriving from int64 and use this in your models.

Please disregard this patch.