Releases: jonbodner/proteus
Release v0.14.0
This release adds the ability to return a sql.Result
from a ContextExecutor or Executor function. The proteus.Builder
has a new method ExecResult
that returns a sql.Result
and an error.
Thanks to @kalexmills for his contribution!
Release v0.13.0
You can now build queries with values from arrays and slices. There are limits; references to elements in arrays and slices are int literals, so you must be sure that the array or slice is at least as long as the specified literals.
The README has been updated with examples of accessing nested fields and arrays.
The errors are now using github.com/jonbodner/stackerr to provide stack traces when they are formatted with %+v
Release v0.12.2
Finally got to the root of the problem with MySQL's Go driver (https://github.com/go-sql-driver/mysql). It won't translate numbers in the response when the text protocol is used (which happens when a query is run without any parameters). Multiple issues have been filed against this for years, but the developers have responded with a wontfix
due to the dubious claim that it's too much of a performance hit. See go-sql-driver/mysql#861 for an example.
This update checks to see if a query has no query args. If it does, it checks to see if the Querier/ContextQuerier also implements Prepare/PrepareContext and if so, it creates a statement, forcing MySQL to use the binary protocol. (Postgres will also be using a prepared statement unnecessarily, but it probably has minimal performance difference).
Release v0.12.1
Apparently MySQL was broken. Now it works, and there are tests that cover both mysql and postgres via docker-compose.
Release v0.12.0
Minor release that changes the errors returned by proteus.Build
to include any errors caused by badly formed function struct fields.
Also, the tests no longer require sqlite, which greatly speeds them up. If you want to run the tests, a docker-compose.yml file is included that stands up a Postgres Docker image. The new Makefile
starts it when you invoke make test
The README has been updated to clarify that using context.Context
is preferred.
Release v0.11.0
For its GopherCon 2019 release, Proteus can now build individual functions and run ad-hoc queries!
In addition to generating function fields on a struct, Proteus can now generate individual functions, or (if type safety is not a high priority) run queries without defining a function first. See the README for details.
There are also tweaks to:
- logging support (specifying the logging level in the
context.Context
passed into a Proteus-generated function now overrides the logging level set with the package-levelproteus.SetLogLevel
function) - error messages (they should now have lowercase first letters)
Release v0.10.0
Context support!
Proteus now generates functions that invoke ExecContext
and QueryContext
when you declare function fields that have a context.Context
as the first parameter.
Also, proteus.Wrap
was an interesting idea, but I've decided that it's a failed experiment. Wrap
is now a no-op function, and Proteus is written in terms of *sql.Rows
explicitly, and not its own Rows
interface. Any existing code that uses Wrap
should continue to work; if it does not, that's a bug that will be fixed. Any code that takes advantage of context support cannot use Wrap
. If I ever get around to declaring a 1.0 version of Proteus, Wrap
will be removed.
Release v0.9.0
Module support! Starting with v0.9.0, Proteus has module support. Please report any issues or backward compatibility problems.
Also fixed a few minor problems with code that didn't vet due to stricter checks in *f methods.
Release v0.8.3
Clean up some tests and resolve issue with sql.NullXXX fields in embedded structs.
Thanks to @brianchizhang for finding the bug and creating a test case!
Release v0.8.2
Remove debugging print statements accidentally left in the code.