This PR includes one breaking change:
- The `Provider.Exec` function now returns 2 values instead of only the error, the extra argument is the number of affected rows.
This PR also adds:
- CI with tests and linter
- Dockertest for making tests easier to run not only on CI but also on local machines for contributors
- Some bug fixes: Now we are handling a few edge cases better:
* If a struct has duplicated ksql tag names we will return an error instead of failing silently
* If a struct has no ksql tags we will return an error instead of failing on the query
* If a struct has attributes with no ksql tags they will be safely ignored instead of causing an error
* If a jointed table struct has an extra attribute with no `tablename` tag it will be ignored too because having an error for this would be more confusing than just ignoring it.
Before this commit the user would need to setup a local postgres
database manually in order to run the tests.
Now we are setting it up using docker-test which makes it easier.
We still require manual setup of sqlserver and mysql databases,
we'll fix these soon so that running the tests become trivial.
This change was finally made because the Delete function was the
only helper function that was not returning the ksql.ErrRecordNotFound
when no rows were found.
The other reason for this change is that we the most common use case is
by far for deleting a single element, and the philosophy of the library
is to optimize for the most common use-cases.
For making it easier to write queries for deleting many items
as well as many other less common use cases we
are already implementing the `kbuilder` package which is a
query builder.
This new package kpgx was created so that in the future we can
make it a separate module.
This will be important in order to prevent users from having to
import all the backend libraries even when they might only be
using one of them.