Skip to content

Commit fe3e0fe

Browse files
committed
Mark the new APIs as ExperimentalDSLDatabaseAPI.kt
1 parent 819eabd commit fe3e0fe

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import com.ctrip.sqllin.driver.DatabaseConfiguration
2020
import com.ctrip.sqllin.driver.DatabasePath
2121
import com.ctrip.sqllin.driver.JournalMode
2222
import com.ctrip.sqllin.driver.SynchronousMode
23+
import com.ctrip.sqllin.dsl.annotation.ExperimentalDSLDatabaseAPI
2324

2425
/**
2526
* DSL-level database configuration with [DatabaseScope] callbacks.
@@ -42,6 +43,7 @@ import com.ctrip.sqllin.driver.SynchronousMode
4243
*
4344
* @author Yuang Qiao
4445
*/
46+
@ExperimentalDSLDatabaseAPI
4547
public data class DSLDBConfiguration(
4648
val name: String,
4749
val path: DatabasePath,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package com.ctrip.sqllin.dsl
1919
import com.ctrip.sqllin.driver.DatabaseConfiguration
2020
import com.ctrip.sqllin.driver.DatabasePath
2121
import com.ctrip.sqllin.driver.openDatabase
22+
import com.ctrip.sqllin.dsl.annotation.ExperimentalDSLDatabaseAPI
2223

2324
/**
2425
* Factory functions for creating [Database] instances.
@@ -73,6 +74,7 @@ public fun Database(
7374
* @param enableSimpleSQLLog Whether to enable simple SQL logging for debugging
7475
* @return A new database instance
7576
*/
77+
@ExperimentalDSLDatabaseAPI
7678
public fun Database(
7779
dsldbConfiguration: DSLDBConfiguration,
7880
enableSimpleSQLLog: Boolean = false,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package com.ctrip.sqllin.dsl
1818

1919
import com.ctrip.sqllin.driver.DatabaseConnection
2020
import com.ctrip.sqllin.dsl.annotation.AdvancedInsertAPI
21+
import com.ctrip.sqllin.dsl.annotation.ExperimentalDSLDatabaseAPI
2122
import com.ctrip.sqllin.dsl.annotation.StatementDslMaker
2223
import com.ctrip.sqllin.dsl.sql.Table
2324
import com.ctrip.sqllin.dsl.sql.X
@@ -544,6 +545,7 @@ public class DatabaseScope internal constructor(
544545
* PersonTable.CREATE()
545546
* ```
546547
*/
548+
@ExperimentalDSLDatabaseAPI
547549
@StatementDslMaker
548550
public infix fun <T> CREATE(table: Table<T>) {
549551
val statement = Create.create(table, databaseConnection)
@@ -553,6 +555,7 @@ public class DatabaseScope internal constructor(
553555
/**
554556
* Creates this table from its definition (extension function variant).
555557
*/
558+
@ExperimentalDSLDatabaseAPI
556559
@StatementDslMaker
557560
@JvmName("create")
558561
public fun <T> Table<T>.CREATE(): Unit = CREATE(this)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
* Marks declarations that are **experimental** in SQLlin DSL database API.
21+
*
22+
* This annotation indicates that the API is still being refined and may undergo changes
23+
* in future releases. These APIs include experimental features that provide additional
24+
* functionality but may not be as stable as the core APIs.
25+
*
26+
* Any usage of a declaration annotated with `@ExperimentalDSLDatabaseAPI` must be accepted either by
27+
* annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalDSLDatabaseAPI::class)`,
28+
* or by using the compiler argument `-opt-in=com.ctrip.sqllin.dsl.annotation.ExperimentalDSLDatabaseAPI`.
29+
*
30+
* @see OptIn
31+
* @see RequiresOptIn
32+
*/
33+
@RequiresOptIn(
34+
message = "This is an experimental API for SQLlin DSL database operations. " +
35+
"It may be changed or removed in future releases. " +
36+
"Use with caution and be prepared for potential breaking changes.",
37+
level = RequiresOptIn.Level.WARNING
38+
)
39+
@Target(
40+
AnnotationTarget.CLASS,
41+
AnnotationTarget.FUNCTION,
42+
AnnotationTarget.PROPERTY,
43+
AnnotationTarget.TYPEALIAS
44+
)
45+
@Retention(AnnotationRetention.BINARY)
46+
public annotation class ExperimentalDSLDatabaseAPI

0 commit comments

Comments
 (0)