This PR fixes a few issues that were found with complete when writing PR #42.
The first issue is that we were still using ? in the query but in complete were generating named parameters of the form @sqlair_0. We use named parameters to avoid issues with users add their own ? to the query and displacing the parameters passed to the DB.
The second issue is that the error messages thrown when a user passes a pointer to a struct instead of a copy the error message was confusing. I found this issue when I made that mistake. Similarly if they passed a none struct type. Both of these problems have now been fixed with explicit checks of the Kind that throw the appropriate errors.
The error tests for Complete in expr_test.go have also been refactored into a table driven format.
This PR fixes a few issues that were found with complete when writing PR #42.
The first issue is that we were still using
?
in the query but in complete were generating named parameters of the form@sqlair_0
. We use named parameters to avoid issues with users add their own?
to the query and displacing the parameters passed to the DB.The second issue is that the error messages thrown when a user passes a pointer to a struct instead of a copy the error message was confusing. I found this issue when I made that mistake. Similarly if they passed a none struct type. Both of these problems have now been fixed with explicit checks of the
Kind
that throw the appropriate errors.The error tests for Complete in
expr_test.go
have also been refactored into a table driven format.