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.
This was done for a few different reasons:
1. This allows us to work on top of the pgx client in the future
2. This would allow our users to implement their own DBAdapters
to use with our tool.
3. This gives the users the option of using advanced configs
of any sql client they want to use and just feed us with it
after the configuration is done, which means we will not have
to worry about supporting a growing number of configurations
as we try to add support to more drivers or if we get issues
asking for more advanced config options.
This panic used to happen if the user configured a table to use
a specific ID column then tried to insert to the database
with a struct that did not have that column.
Now the 3 functions that allow you to write plain SQL queries
also work if you omit the `SELECT ...` part of the query.
If you do this the code will check and notice that the first
token of the query is a "FROM" token and then automatically
build the SELECT part of the query based on the tags of the struct.
Everything is cached, so the impact on performance should be negligible.
The affected functions are:
- Query()
- QueryOne()
- QueryChunks()