feat: implement cast, right, left, replace expressions #894
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
CAST
,LEFT
,RIGHT
,REPLACE
) to the Kotlin JDSL JPQL DSL. These functions align with the JPA 3.2 specification, providing enhanced capabilities for string operations directly within JPQL queries. This change aims to expand the functionality of Kotlin JDSL to support more advanced JPQL features as defined in the latest JPA specifications.Modifications
cast
,left
,right
, andreplace
functions todsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/Jpql.kt
for use withinjpql {}
blocks.JpqlCast
,JpqlLeft
,JpqlRight
,JpqlReplace
expression types inquery-model/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/querymodel/jpql/expression/impl/
.render/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/render/jpql/serializer/impl/
.render/jpql/src/test/kotlin/com/linecorp/kotlinjdsl/render/jpql/serializer/impl/
.dsl/jpql/src/test/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/ExpressionDslTest.kt
.docs/en/jpql-with-kotlin-jdsl/expressions.md
anddocs/ko/jpql-with-kotlin-jdsl/expressions.md
) to include details and examples of the new functions, noting their addition in JPA 3.2.Result
CAST
,LEFT
,RIGHT
, andREPLACE
functions directly within their Kotlin JDSL JPQL queries, enabling more powerful and flexible string manipulation operations. The documentation will also be updated to reflect these new capabilities.Closes
동기
CAST
,LEFT
,RIGHT
,REPLACE
)를 도입합니다. 이 함수들은 JPA 3.2 스펙에 맞춰 JPQL 쿼리 내에서 문자열 연산을 위한 향상된 기능을 제공합니다. 이 변경은 최신 JPA 스펙에 정의된 고급 JPQL 기능을 지원하기 위해 Kotlin JDSL의 기능을 확장하는 것을 목표로 합니다.수정 사항
jpql {}
블록 내에서 사용할 수 있도록dsl/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/Jpql.kt
에cast
,left
,right
,replace
함수를 추가했습니다.query-model/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/querymodel/jpql/expression/impl/
에 해당JpqlCast
,JpqlLeft
,JpqlRight
,JpqlReplace
expression 타입을 구현했습니다.render/jpql/src/main/kotlin/com/linecorp/kotlinjdsl/render/jpql/serializer/impl/
에 새로운 expression 타입에 대한 Serializer를 추가했습니다.render/jpql/src/test/kotlin/com/linecorp/kotlinjdsl/render/jpql/serializer/impl/
에 새로운 Serializer에 대한 단위 테스트를 생성했습니다.dsl/jpql/src/test/kotlin/com/linecorp/kotlinjdsl/dsl/jpql/expression/ExpressionDslTest.kt
에 새로운 함수에 대한 DSL 사용 테스트를 추가했습니다.docs/en/jpql-with-kotlin-jdsl/expressions.md
및docs/ko/jpql-with-kotlin-jdsl/expressions.md
)를 업데이트했습니다.결과
CAST
,LEFT
,RIGHT
,REPLACE
함수를 직접 활용하여 더욱 강력하고 유연한 문자열 조작 작업을 수행할 수 있게 됩니다. 문서 또한 이러한 새로운 기능을 반영하여 업데이트될 것입니다.닫는 이슈