jdbigen
generates Java interfaces and classes for simple DAO functions from PostgreSQL table metadata.
This based off of the awesome dgw project.
IMPORTANT NOTE: jdbigen only supports PostgreSQL at the moment and is also a best effort generator so you may have to edit the generated code.
go install github.com/nndi-oss/jdbi-utils/jdbigen@latest
usage: jdbigen [<flags>] <conn>
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-s, --schema="public" PostgreSQL schema name
-p, --package="" package name
-t, --typemap=TYPEMAP column type and go type map file path
-x, --exclude=EXCLUDE ... table names to exclude
-o, --output=OUTPUT output file path
--sqlhandle output as SQL handlers
Args:
<conn> PostgreSQL connection string in URL format
jdbigen postgres://dbuser@localhost/dbname?sslmode=disable
- Fix and improve the tests
- I am planning on re-writing this in Java and compiling a native image with GraalVM.
- Support other database engines?