line / kotlin-jdsl

Kotlin library that makes it easy to build and execute queries without generated metamodel
https://kotlin-jdsl.gitbook.io/docs/
Apache License 2.0
711 stars 88 forks source link

Support for creating queries via initialized JpqlDsl object. #563

Closed shouwn closed 8 months ago

shouwn commented 10 months ago

Backgrounds

Objects

Benefits

Requirements

Contribution

jbl428 commented 9 months ago

I have some question before working on this issue. I would like to confirm if I understood the issue correctly.

The following changes are needed.

fun <T : Any, DSL : JpqlDsl> findAll(
    dsl: DSL,
    init: DSL.() -> JpqlQueryable<SelectQuery<T>>,
): List<T?>

// and other methods and modules

After, the user can register custom beans in Spring as follows:

@Component
class MyJpql(
    private val encryptor: Encryptor,
) : Jpql() {

    fun myFunction(value: String): Expression<String> {
        val encrypted = encryptor.encrypt(value)
        return function(String::class, "myFunction", listOf(value(encrypted)))
    }
}

If this is right, I would like to take this issue.

shouwn commented 8 months ago

@jbl428 Oh, I'm so sorry.... I wasn't notified of this issue and didn't realize you had commented.

You're right. If you're still interested in working on this, please comment again.

I'm really sorry for this late response... 😢

jbl428 commented 8 months ago

@shouwn It's okay. I'm glad that I understood correctly. 😄 I want to take on this task.

shouwn commented 8 months ago

I appreciate your thoughtfulness. I have changed the assignee to you.