This PR adds a check during decoding which will return nulls.Time as a NULL value (i.e. its value for Valid will be false). Without this check, the value of nulls.Time{} will be:
This ends up storing the value 0001-01-01 00:00:00 +0000 UTC in the database, as opposed to a NULL value.
What are the main choices made to get to this solution?
One option was to make the model Bindable and write a custom Bind() method which could handle empty values, but the default Bind handler does so much that bypassing it seemed extreme.
What was discovered while working on it? (Optional)
Type in here a description of the discoveries made while working on this PR.
List the manual test cases you've covered before sending this PR:
What is being done in this PR?
This PR adds a check during decoding which will return
nulls.Time
as a NULL value (i.e. its value forValid
will be false). Without this check, the value of nulls.Time{} will be:This ends up storing the value
0001-01-01 00:00:00 +0000 UTC
in the database, as opposed to a NULL value.What are the main choices made to get to this solution?
One option was to make the model
Bindable
and write a customBind()
method which could handle empty values, but the default Bind handler does so much that bypassing it seemed extreme.What was discovered while working on it? (Optional)
List the manual test cases you've covered before sending this PR:
Fizz (using Postgres):
Model:
Plush form: