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

在createQuery的select里直接查找字段时,报错找不到字段对应的ScalarProvider #73

Open
ClearPlume opened this issue Apr 24, 2023 · 2 comments
Labels
pending Postpone plans because of more important tasks

Comments

@ClearPlume
Copy link
Contributor

设置字段的ScalarProvider
图片

以表为单位查询时,是正常的

fun findParamsById(id: Int): List<String> {
    return sql
            .createQuery(ScanDimension::class) {
                where(table.id eq id)
                select(table) // table.fetchBy { params() }
            }
            .fetchOne()
            .params
}

直接以字段为单位查询,就会报错“找不到ScanDimension.params对应的ScalarProvider

fun findParamsById(id: Int, dummy: Boolean = false): List<String> {
    return sql
            .createQuery(ScanDimension::class) {
                where(table.id eq id)
                select(table.params)
            }
            .fetchOne()
}
@ClearPlume
Copy link
Contributor Author

Applying a function to a direct query of a field, this problem arises again

val userExternalInfo = sqlClient.createQuery(User::class) {
    where(table.id eq userId)
    select(table.externalInfo.asNonNull()) // If I remove this `asNonNull`, the query executes correctly.
}.fetchOne()

@ClearPlume ClearPlume reopened this Apr 10, 2024
@Enaium
Copy link
Contributor

Enaium commented Nov 30, 2024

0.9.23复现不了

@babyfish-ct babyfish-ct added the pending Postpone plans because of more important tasks label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending Postpone plans because of more important tasks
Projects
None yet
Development

No branches or pull requests

3 participants