Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 1.6.1 (unreleased)
## 1.7.0

* Update Kotlin SDK to 1.7.0.
* Add `close(deleteDatabase:)` method to `PowerSyncDatabaseProtocol` for deleting SQLite database files when closing the database. This includes the main database file and all WAL mode files (.wal, .shm, .journal). Files that don't exist are ignored, but an error is thrown if a file exists but cannot be deleted.
Expand All @@ -14,6 +14,9 @@ try await database.close(deleteDatabase: false)
// or simply
try await database.close()
```
* Add `PowerSyncDataTypeConvertible` protocol for casting query parameters to SQLite supported types.
* [Internal] Removed unnecessary `Task` creation in Attachment helper `FileManagerStorageAdapter`.

## 1.6.0

* Update core extension to 0.4.6 ([changelog](https://github.com/powersync-ja/powersync-sqlite-core/releases/tag/v0.4.6))
Expand Down
8 changes: 4 additions & 4 deletions Sources/PowerSync/Kotlin/db/KotlinConnectionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ final class KotlinTransactionContext: Transaction, KotlinConnectionContextProtoc
func mapParameters(_ parameters: [Any?]?) -> [Any] {
parameters?.map { item in
switch item {
case .none: NSNull()
case let item as PowerSyncDataTypeConvertible:
item.psDataType?.unwrap() ?? NSNull()
default: item
case .none: NSNull()
case let item as PowerSyncDataTypeConvertible:
item.psDataType?.unwrap() ?? NSNull()
default: item as Any
}
} ?? []
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@testable import PowerSync
import struct Foundation.UUID
@testable import PowerSync
import XCTest

final class KotlinPowerSyncDatabaseImplTests: XCTestCase {
Expand Down Expand Up @@ -164,11 +164,11 @@ final class KotlinPowerSyncDatabaseImplTests: XCTestCase {
parameters: [uuid, "Test User", "test@example.com"]
)

let _ = try await database.getOptional(
_ = try await database.getOptional(
sql: "SELECT id, name, email FROM users WHERE id = ?",
parameters: [uuid]
) { cursor throws in
try (
try (
cursor.getString(name: "id"),
cursor.getString(name: "name"),
cursor.getString(name: "email")
Expand Down Expand Up @@ -719,9 +719,8 @@ final class KotlinPowerSyncDatabaseImplTests: XCTestCase {
}
}


extension UUID: @retroactive PowerSyncDataTypeConvertible {
extension UUID: PowerSyncDataTypeConvertible {
public var psDataType: PowerSyncDataType? {
.string(uuidString)
}
}
}