Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Breaking Version dev-0.5.0 Branch #8

Closed
vsch opened this issue Nov 30, 2018 · 1 comment
Closed

API Breaking Version dev-0.5.0 Branch #8

vsch opened this issue Nov 30, 2018 · 1 comment
Labels

Comments

@vsch
Copy link
Owner

vsch commented Nov 30, 2018

ℹ️ This branch is a rework with breaking changes to refactor models and related classes to eliminate having to specify identifier quoting in the model by creating the model for a database session. Which makes sense for a database model class.

Biggest change is that the model now takes two template arguments: main model class and its associated data class with an optional session instance and identifier quoting string.

If session is not given or null then default session will be used.

If quote if not given or null then the connection metaData.identifierQuoteString will be used, anything else will use whatever string is passed in. Unless your jdbc driver does not provide identifier quoting, there is no need to use anything but the default.

Companion object now only has the table name constant string.

All other functions implemented in the Model with two abstract members: toData() returning the data class for the model and operator invoke for the factory function for the model. To get another instance of a model myModel invoke the model instance as a function myModel().

For models that do not need a data class ModelNoData is also available which only takes a single template argument, as was the case for the Model class in previous releases.

Having the session instance information in the model simplifies using models because session no longer has to be specified for every method performing database access.

Additionally, list results are simplified because neither the session nor the extractor needs to be passed, with myModel.listData() variations can be used or myModel.listModel() variations.

Additionally there is now an alias:String? = null argument available for sql generating functions which will add a table alias to the table name and use the alias for disambiguating column names. If generating queries with multiple tables, set the alias to empty string "" or the table name to have it added to the column references. An empty table alias or one equal to the table name will only be used for column references.

Generate Kotlin-Model.groovy has been updated to generate the new model format from tables in the database.

@vsch vsch added enhancement New feature or request help wanted Extra attention is needed labels Nov 30, 2018
@vsch
Copy link
Owner Author

vsch commented Nov 30, 2018

Feedback regarding these changes is welcome and desired. Please post your questions and suggestions here.

@vsch vsch added ⚠️ feedback request and removed help wanted Extra attention is needed labels Dec 1, 2018
@vsch vsch pinned this issue Oct 11, 2019
@vsch vsch closed this as completed Dec 17, 2019
@vsch vsch added this to the Release 0.50.0 milestone Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant