Skip to content

Commit ac643ed

Browse files
committed
docs: update implementations
1 parent b09c95c commit ac643ed

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

client-sdk-references/kotlin-multiplatform.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ fun watchCustomers(): Flow<List<User>> {
242242
// TODO: implement your UI based on the result set
243243
return database.watch("SELECT * FROM customers", mapper = { cursor ->
244244
User(
245-
id = cursor.getString("id")!!,
246-
name = cursor.getString("name")!!,
247-
email = cursor.getString("email")!!
245+
id = cursor.getString("id"),
246+
name = cursor.getString("name"),
247+
email = cursor.getString("email")
248248
)
249249
})
250250
}

client-sdk-references/kotlin-multiplatform/usage-examples.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ fun watchCustomers(): Flow<List<User>> {
3030
// TODO: implement your UI based on the result set
3131
return database.watch("SELECT * FROM customers", mapper = { cursor ->
3232
User(
33-
id = cursor.getString("id")!!,
34-
name = cursor.getString("name")!!,
35-
email = cursor.getString("email")!!
33+
id = cursor.getString("id"),
34+
name = cursor.getString("name"),
35+
email = cursor.getString("email")
3636
)
3737
})
3838
}

client-sdk-references/swift.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebarTitle: "Overview"
66
<CardGroup cols={3}>
77
<Card title="Source Code" icon="github" href="https://github.com/powersync-ja/powersync-swift/">
88
Refer to the powersync-swift repo on GitHub.
9-
</Card>
9+
</Card>
1010
<Card title="API Reference (Coming soon)" icon="book" href="">
1111
A full API Reference for this SDK is not yet available. This is planned for the V1 release.
1212
</Card>
@@ -249,10 +249,10 @@ func getList(_ id: String) async throws {
249249
parameters: [id],
250250
mapper: { cursor in
251251
ListContent(
252-
id: cursor.getString(name: "id")!,
253-
name: cursor.getString(name: "name")!,
254-
createdAt: cursor.getString(name: "created_at")!,
255-
ownerId: cursor.getString(name: "owner_id")!
252+
id: try cursor.getString(name: "id")!,
253+
name: try cursor.getString(name: "name")!,
254+
createdAt: try cursor.getString(name: "created_at")!,
255+
ownerId: try cursor.getString(name: "owner_id")!
256256
)
257257
}
258258
)
@@ -271,10 +271,10 @@ func getLists() async throws {
271271
parameters: [],
272272
mapper: { cursor in
273273
ListContent(
274-
id: cursor.getString(name: "id")!,
275-
name: cursor.getString(name: "name")!,
276-
createdAt: cursor.getString(name: "created_at")!,
277-
ownerId: cursor.getString(name: "owner_id")!
274+
id: try cursor.getString(name: "id")!,
275+
name: try cursor.getString(name: "name")!,
276+
createdAt: try cursor.getString(name: "created_at")!,
277+
ownerId: try cursor.getString(name: "owner_id")!
278278
)
279279
}
280280
)
@@ -293,10 +293,10 @@ func watchLists(_ callback: @escaping (_ lists: [ListContent]) -> Void ) async {
293293
parameters: [],
294294
mapper: { cursor in
295295
ListContent(
296-
id: cursor.getString(name: "id")!,
297-
name: cursor.getString(name: "name")!,
298-
createdAt: cursor.getString(name: "created_at")!,
299-
ownerId: cursor.getString(name: "owner_id")!
296+
id: try cursor.getString(name: "id")!,
297+
name: try cursor.getString(name: "name")!,
298+
createdAt: try cursor.getString(name: "created_at")!,
299+
ownerId: try cursor.getString(name: "owner_id")!
300300
)
301301
}
302302
) {

migration-guides/mongodb-atlas.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,12 @@ Reading data in the application which uses PowerSync is very simple: we use SQLi
367367
sql: "SELECT * FROM todos",
368368
mapper: { cursor in
369369
TodoContent(
370-
list_id: cursor.getString(name: "list_id")!,
371-
description: cursor.getString(name: "description")!,
372-
completed: cursor.getBoolean(name: "completed")!,
373-
created_by: cursor.getString(name: "created_by")!,
374-
completed_by: cursor.getString(name: "completed_by")!,
375-
completed_at: cursor.getString(name: "completed_at")!
370+
list_id: try cursor.getString(name: "list_id"),
371+
description: try cursor.getString(name: "description"),
372+
completed: try cursor.getBooleanOptional(name: "completed"),
373+
created_by: try cursor.getString(name: "created_by"),
374+
completed_by: try cursor.getStringOptional(name: "completed_by"),
375+
completed_at: try cursor.getStringOptional(name: "completed_at")
376376
)
377377
}
378378
)

0 commit comments

Comments
 (0)