volatiletech/sqlboiler-sqlite3

Sqlite field mapping to time.Time

naetraga opened this issue · 1 comments

is there any way to automatically parse receiving data of type string to time.Time?

what is the idea behind it:
we wanna do systemtest with our application by calling its api. as we need a database behind it our idea was to use sqlite instead our default - as its more convenient with the handling.
to get it work I would need the returning for some fields to be time.Time as the other entities from different DB do so.
do you have or see any way to realize this except I do it my own?

You can implement a custom type that wraps time.Time that understands how to properly serialize back and forth. Then you can instruct sqlboiler to use that type instead of string for that particular column name/type combination.

Depending on how time.Time itself works you may be able to skip creating your own type and just substitute time.Time directly. Who knows, might just work.