Skip to content

sqllin-processor always adds comma at createSQL #118

@qingshu-ui

Description

@qingshu-ui

The sqllin-processor always adds a comma at the end of the last parameter in createSQL

My code:

@DBRow("at_record")
@Serializable
data class AtRecord(
    @PrimaryKey(isAutoincrement = true) val id: Long?,
    val groupId: Long,
    val senderId: Long,
    val targetId: Long,
    val message: String,
    val messageTimeMillis: Long
) {
    val messageTime: LocalDateTime
        get() {
            val instant = Instant.fromEpochMilliseconds(messageTimeMillis)
            return instant.toLocalDateTime()
        }
}

generated code:

object AtRecordTable : Table<AtRecord>("at_record") {

    ......

    override val createSQL = "CREATE TABLE at_record(id INTEGER PRIMARY KEY AUTOINCREMENT,groupId BIGINT NOT NULL,senderId BIGINT NOT NULL,targetId BIGINT NOT NULL,message TEXT NOT NULL,messageTimeMillis BIGINT NOT NULL,)"
}

Project script:

kotlin {

    compilerOptions {
        freeCompilerArgs.addAll(
            listOf(
                "-Xexpect-actual-classes",
                "-Xcontext-parameters",
                "-Xskip-prerelease-check"
            )
        )
    }

    sourceSets {
        commonMain {
            kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
            dependencies {
                ......
                // sqllin
                implementation(libs.bundles.sqllin)
            }
        }
    }
}

dependencies {
    // add("kspCommonMainMetadata", "com.ctrip.kotlin:sqllin-processor:2.2.0")
    kspCommonMainMetadata(libs.sqllinProcessor)
}

libs.versions.toml:

[versions]
kotlin = "2.2.21"
kotlinxCoroutines = "1.10.2"
kotlinxSerialization = "1.9.0"
sqllin = "2.2.0"
ksp = "2.3.3"

[libraries]
sqllinDsl = { module = "com.ctrip.kotlin:sqllin-dsl", version.ref = "sqllin" }
sqllinDriver = { module = "com.ctrip.kotlin:sqllin-driver", version.ref = "sqllin" }
sqllinProcessor = { module = "com.ctrip.kotlin:sqllin-processor", version.ref = "sqllin" }


[bundles]
sqllin = ["sqllinDriver", "sqllinDsl"]

[plugins]
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions