Derived from gradle-jooq-plugin, this plugin is designed for code generation with additional default configurations for ease of use. It utilizes flyway
and testcontainer
to generate code from a local database.
plugins {
id 'io.github.alexritian.codegenGradlePlugin'
}
jooq {
configurations {
main {
database {
schema = 'public'
includes = '.*'
}
output {
packageName = 'io.github.alexritian.codegen'
}
forcedTypes {
timestampToInstant()
}
}
}
}
Note
The extension name follows gradle-jooq-plugin conventions. Multiple configurations are supported as well.
By default, testcontainer
will start a database instance. To use a different database, you can specify the url
, driver
, user
, and password
parameters.
You can configure some forced type conversions.
The timestampToInstant
function converts the following database types to java.time.Instant
:
timestamp
timestamp without time zone
timestamp with time zone
timestamptz
Note
Currently, only the timestampToInstant
method is available, but additional type conversion methods will be added in the future.
Some default configurations are provided based on gradle-jooq-plugin.