Skip to content

Commit 24217ed

Browse files
authored
Merge pull request #102 from qiaoyuang/main
Update version to 1.4.1
2 parents 8c5f2e7 + 67679b3 commit 24217ed

22 files changed

+198
-16
lines changed

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,26 @@
22

33
- Date format: YYYY-MM-dd
44

5+
## v1.4.1 / 2025-02-04
6+
7+
### All
8+
9+
* Update `Kotlin`'s version to `2.1.10`
10+
11+
### sqllin-dsl
12+
13+
* Update `kotlinx.coroutines`'s version to `1.10.1`
14+
* Update `kotlinx.serialization`'s version to `1.8.0`
15+
* Add some DslMaker annotations, make the DSL apis be more readable
16+
17+
### sqllin-driver
18+
19+
* Update the `sqlite-jdbc`'s version to `3.48.0.0`
20+
21+
### sqllin-processor
22+
23+
* Update `KSP`'s version to `2.1.10-1.0.29`
24+
525
## v1.4.0 / 2024-12-04
626

727
### All

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=1.4.0
1+
VERSION=1.4.1
22
GROUP=com.ctrip.kotlin
33

44
#Maven Publish Information

gradle/libs.versions.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[versions]
22

3-
kotlin = "2.1.0"
3+
kotlin = "2.1.10"
44
agp = "8.7.3"
5-
ksp = "2.1.0-1.0.29"
6-
serialization = "1.7.3"
7-
coroutines = "1.9.0"
5+
ksp = "2.1.10-1.0.29"
6+
serialization = "1.8.0"
7+
coroutines = "1.10.1"
88
androidx-annotation = "1.9.1"
99
androidx-test = "1.6.1"
1010
androidx-test-runner = "1.6.2"
11-
sqlite-jdbc = "3.47.1.0"
11+
sqlite-jdbc = "3.48.0.0"
1212

1313
[libraries]
1414

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Tue Mar 08 15:11:46 CST 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

sqllin-dsl/doc/getting-start-cn.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414
id("com.google.devtools.ksp")
1515
}
1616

17-
val sqllinVersion = "1.4.0"
17+
val sqllinVersion = "1.4.1"
1818

1919
kotlin {
2020
// ......
@@ -28,10 +28,10 @@ kotlin {
2828
implementation("com.ctrip.kotlin:sqllin-driver:$sqllinVersion")
2929

3030
// The sqllin-dsl serialization and deserialization depends on kotlinx-serialization
31-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3")
31+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.8.0")
3232

3333
// Since 1.2.2, sqllin-dsl depends on kotlinx.coroutines
34-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
34+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
3535
}
3636
}
3737
// ......

sqllin-dsl/doc/getting-start.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ plugins {
1616
id("com.google.devtools.ksp")
1717
}
1818

19-
val sqllinVersion = "1.4.0"
19+
val sqllinVersion = "1.4.1"
2020

2121
kotlin {
2222
// ......
@@ -30,10 +30,10 @@ kotlin {
3030
implementation("com.ctrip.kotlin:sqllin-driver:$sqllinVersion")
3131

3232
// The sqllin-dsl serialization and deserialization depends on kotlinx-serialization
33-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3")
33+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.8.0")
3434

3535
// Since 1.2.2, sqllin-dsl depends on kotlinx.coroutines
36-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
36+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
3737
}
3838
}
3939
// ......

sqllin-dsl/src/commonMain/kotlin/com/ctrip/sqllin/dsl/DatabaseScope.kt

+27
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.ctrip.sqllin.dsl
1818

1919
import com.ctrip.sqllin.driver.DatabaseConnection
20+
import com.ctrip.sqllin.dsl.annotation.StatementDslMaker
2021
import com.ctrip.sqllin.dsl.sql.Table
2122
import com.ctrip.sqllin.dsl.sql.X
2223
import com.ctrip.sqllin.dsl.sql.clause.*
@@ -98,18 +99,21 @@ public class DatabaseScope internal constructor(
9899
* Insert.
99100
*/
100101

102+
@StatementDslMaker
101103
public infix fun <T> Table<T>.INSERT(entities: Iterable<T>) {
102104
val statement = Insert.insert(this, databaseConnection, entities)
103105
addStatement(statement)
104106
}
105107

108+
@StatementDslMaker
106109
public infix fun <T> Table<T>.INSERT(entity: T): Unit =
107110
INSERT(listOf(entity))
108111

109112
/**
110113
* Update.
111114
*/
112115

116+
@StatementDslMaker
113117
public infix fun <T> Table<T>.UPDATE(clause: SetClause<T>): UpdateStatementWithoutWhereClause<T> =
114118
transactionStatementsGroup?.let {
115119
val statement = Update.update(this, databaseConnection, it, clause)
@@ -123,11 +127,13 @@ public class DatabaseScope internal constructor(
123127
* Delete.
124128
*/
125129

130+
@StatementDslMaker
126131
public infix fun Table<*>.DELETE(x: X) {
127132
val statement = Delete.deleteAllEntities(this, databaseConnection)
128133
addStatement(statement)
129134
}
130135

136+
@StatementDslMaker
131137
public infix fun <T> Table<T>.DELETE(clause: WhereClause<T>) {
132138
val statement = Delete.delete(this, databaseConnection, clause)
133139
addStatement(statement)
@@ -140,12 +146,16 @@ public class DatabaseScope internal constructor(
140146
/**
141147
* Select with no any clause.
142148
*/
149+
150+
@StatementDslMaker
143151
public inline infix fun <reified T> Table<T>.SELECT(x: X): FinalSelectStatement<T> =
144152
select(kSerializer(), false)
145153

154+
@StatementDslMaker
146155
public inline infix fun <reified T> Table<T>.SELECT_DISTINCT(x: X): FinalSelectStatement<T> =
147156
select(kSerializer(), true)
148157

158+
@StatementDslMaker
149159
public fun <T> Table<T>.select(serializer: KSerializer<T>, isDistinct: Boolean): FinalSelectStatement<T> {
150160
val container = getSelectStatementGroup()
151161
val statement = Select.select(this, isDistinct, serializer, databaseConnection, container)
@@ -156,9 +166,12 @@ public class DatabaseScope internal constructor(
156166
/**
157167
* Receive the 'WHERE' clause.
158168
*/
169+
170+
@StatementDslMaker
159171
public inline infix fun <reified T> Table<T>.SELECT(clause: WhereClause<T>): WhereSelectStatement<T> =
160172
select(kSerializer(), clause, false)
161173

174+
@StatementDslMaker
162175
public inline infix fun <reified T> Table<T>.SELECT_DISTINCT(clause: WhereClause<T>): WhereSelectStatement<T> =
163176
select(kSerializer(), clause, true)
164177

@@ -172,9 +185,12 @@ public class DatabaseScope internal constructor(
172185
/**
173186
* Receive the 'ORDER BY' clause.
174187
*/
188+
189+
@StatementDslMaker
175190
public inline infix fun <reified T> Table<T>.SELECT(clause: OrderByClause<T>): OrderBySelectStatement<T> =
176191
select(kSerializer(), clause, false)
177192

193+
@StatementDslMaker
178194
public inline infix fun <reified T> Table<T>.SELECT_DISTINCT(clause: OrderByClause<T>): OrderBySelectStatement<T> =
179195
select(kSerializer(), clause, true)
180196

@@ -188,9 +204,12 @@ public class DatabaseScope internal constructor(
188204
/**
189205
* Receive the 'LIMIT' clause.
190206
*/
207+
208+
@StatementDslMaker
191209
public inline infix fun <reified T> Table<T>.SELECT(clause: LimitClause<T>): LimitSelectStatement<T> =
192210
select(kSerializer(), clause, false)
193211

212+
@StatementDslMaker
194213
public inline infix fun <reified T> Table<T>.SELECT_DISTINCT(clause: LimitClause<T>): LimitSelectStatement<T> =
195214
select(kSerializer(), clause, true)
196215

@@ -204,9 +223,12 @@ public class DatabaseScope internal constructor(
204223
/**
205224
* Receive the 'GROUP BY' clause.
206225
*/
226+
227+
@StatementDslMaker
207228
public inline infix fun <reified T> Table<T>.SELECT(clause: GroupByClause<T>): GroupBySelectStatement<T> =
208229
select(kSerializer(), clause, false)
209230

231+
@StatementDslMaker
210232
public inline infix fun <reified T> Table<T>.SELECT_DISTINCT(clause: GroupByClause<T>): GroupBySelectStatement<T> =
211233
select(kSerializer(), clause, true)
212234

@@ -239,6 +261,7 @@ public class DatabaseScope internal constructor(
239261
}
240262
}
241263

264+
@StatementDslMaker
242265
public inline fun <T> Table<T>.UNION_ALL(block: Table<T>.(Table<T>) -> Unit): FinalSelectStatement<T> {
243266
beginUnion<T>()
244267
var selectStatement: SelectStatement<T>? = null
@@ -269,9 +292,11 @@ public class DatabaseScope internal constructor(
269292
* Receive the 'JOIN' clause.
270293
*/
271294

295+
@StatementDslMaker
272296
public inline infix fun <T, reified R> Table<T>.SELECT(clause: JoinClause<R>): JoinStatementWithoutCondition<R> =
273297
select(getKSerializer(), clause, false)
274298

299+
@StatementDslMaker
275300
public inline infix fun <T, reified R> Table<T>.SELECT_DISTINCT(clause: JoinClause<R>): JoinStatementWithoutCondition<R> =
276301
select(getKSerializer(), clause, true)
277302

@@ -284,9 +309,11 @@ public class DatabaseScope internal constructor(
284309
* Receive the natural join clause(includes 'NATURAL LEFT OUTER JOIN' and 'NATURAL INNER JOIN').
285310
*/
286311

312+
@StatementDslMaker
287313
public inline infix fun <T, reified R> Table<T>.SELECT(clause: NaturalJoinClause<R>): JoinSelectStatement<R> =
288314
select(getKSerializer(), clause, false)
289315

316+
@StatementDslMaker
290317
public inline infix fun <T, reified R> Table<T>.SELECT_DISTINCT(clause: NaturalJoinClause<R>): JoinSelectStatement<R> =
291318
select(getKSerializer(), clause, true)
292319

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (C) 2025 Ctrip.com.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.ctrip.sqllin.dsl.annotation
18+
19+
/**
20+
* Dsl maker annotations
21+
* @author yaqiao
22+
*/
23+
24+
@DslMarker
25+
public annotation class StatementDslMaker
26+
27+
@DslMarker
28+
public annotation class KeyWordDslMaker
29+
30+
@DslMarker
31+
public annotation class FunctionDslMaker
32+
33+
@DslMarker
34+
public annotation class ColumnNameDslMaker

sqllin-dsl/src/commonMain/kotlin/com/ctrip/sqllin/dsl/sql/X.kt

+3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616

1717
package com.ctrip.sqllin.dsl.sql
1818

19+
import com.ctrip.sqllin.dsl.annotation.KeyWordDslMaker
20+
1921
/**
2022
* Express "*" in SQL
2123
* @author yaqiao
2224
*/
2325

26+
@KeyWordDslMaker
2427
public expect object X

sqllin-dsl/src/commonMain/kotlin/com/ctrip/sqllin/dsl/sql/clause/BaseJoinClause.kt

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.ctrip.sqllin.dsl.sql.clause
1818

19+
import com.ctrip.sqllin.dsl.annotation.StatementDslMaker
1920
import com.ctrip.sqllin.dsl.sql.Table
2021
import com.ctrip.sqllin.dsl.sql.statement.JoinSelectStatement
2122
import com.ctrip.sqllin.dsl.sql.statement.JoinStatementWithoutCondition
@@ -44,11 +45,14 @@ public sealed class NaturalJoinClause<R>(vararg tables: Table<*>) : BaseJoinClau
4445

4546
public sealed class JoinClause<R>(vararg tables: Table<*>) : BaseJoinClause<R>(*tables)
4647

48+
@StatementDslMaker
4749
public infix fun <R> JoinStatementWithoutCondition<R>.ON(condition: SelectCondition): JoinSelectStatement<R> =
4850
convertToJoinSelectStatement(condition)
4951

52+
@StatementDslMaker
5053
public inline infix fun <R> JoinStatementWithoutCondition<R>.USING(clauseElement: ClauseElement): JoinSelectStatement<R> =
5154
USING(listOf(clauseElement))
5255

56+
@StatementDslMaker
5357
public infix fun <R> JoinStatementWithoutCondition<R>.USING(clauseElements: Iterable<ClauseElement>): JoinSelectStatement<R> =
5458
convertToJoinSelectStatement(clauseElements)

0 commit comments

Comments
 (0)