-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Infer the Kotlin type of bind parameter, if possible, or fail with a …
…better error message (#3413) Co-authored-by: hfhbd <hfhbd@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
sqldelight-gradle-plugin/src/test/custom-dialect/src/test/kotlin/Testing.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import app.cash.sqldelight.Query | ||
import app.cash.sqldelight.driver.jdbc.JdbcDriver | ||
import org.junit.Test | ||
import schema.FooQueries | ||
import java.sql.Connection | ||
import kotlin.time.Duration | ||
import kotlin.time.Duration.Companion.seconds | ||
|
||
class Testing { | ||
@Test fun inferredCompiles() { | ||
val fakeDriver = object : JdbcDriver() { | ||
override fun getConnection() = TODO() | ||
override fun closeConnection(connection: Connection) = Unit | ||
override fun addListener(listener: Query.Listener, queryKeys: Array<String>) = Unit | ||
override fun removeListener(listener: Query.Listener, queryKeys: Array<String>) = Unit | ||
override fun notifyListeners(queryKeys: Array<String>) = Unit | ||
} | ||
FooQueries(fakeDriver).inferredType(1.seconds) | ||
} | ||
|
||
@Test fun customFunctionReturnsDuration() { | ||
val fakeDriver = object : JdbcDriver() { | ||
override fun getConnection() = TODO() | ||
override fun closeConnection(connection: Connection) = Unit | ||
override fun addListener(listener: Query.Listener, queryKeys: Array<String>) = Unit | ||
override fun removeListener(listener: Query.Listener, queryKeys: Array<String>) = Unit | ||
override fun notifyListeners(queryKeys: Array<String>) = Unit | ||
} | ||
val unused: Duration = FooQueries(fakeDriver).selectFooWithId().executeAsOne() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters