Skip to content

Add a Kotlin DSL #133

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

Merged
merged 46 commits into from
Aug 26, 2019
Merged

Add a Kotlin DSL #133

merged 46 commits into from
Aug 26, 2019

Conversation

jeffgbutler
Copy link
Member

This PR adds a set of Kotlin extensions that support an idiomatic Kotlin DSL. Included are full examples and documentation for using the Kotlin DSL with MyBatis3.

Several minor changes were made to the underlying Java code to support Kotlin, but non caused an issue with the existing function of the library.

Also added is a new CountDSL - a specialization of a select statement that supports joins and a where clause, but no other parts of a select statement. This will be used by MyBatis Generator and the canonical Kotlin mapper.

Squash the commits in this PR when merging!

This enables a more Kotlin friendly syntax
This resolves some issues with idiomatic Kotlin with no loss of function
to the basic library. We can now use a Kotlin function with receiver to
repeatedly call methods on the QueryExpressionDSL without causing a
duplicate expression to be added to the query.
Basically, delay creating the paging model until the entire select model
is built.

This does not change the paging experience for the base library, but
makes the paging experience more compatible with Kotlin. We can now use
a receiver function for the paging operation.
Conflicts:
	src/main/java/org/mybatis/dynamic/sql/select/QueryExpressionDSL.java
	src/main/java/org/mybatis/dynamic/sql/select/SelectDSL.java
@jeffgbutler jeffgbutler added this to the 1.1.3 milestone Aug 26, 2019
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling f711b30 on jeffgbutler:kotlin-support into baabdb0 on mybatis:master.

@jeffgbutler jeffgbutler merged commit 8222fb2 into mybatis:master Aug 26, 2019
@jeffgbutler jeffgbutler deleted the kotlin-support branch August 26, 2019 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants