Skip to content

Commit f9d8c4c

Browse files
authored
Surface @FetchAll.load(), etc. (#38)
* Surface `@FetchAll.load()`, etc. While database observation should automatically refresh things, there are cases when you may want to refresh things manually, like external changes or in tests to avoid a thread hop. * Bump CI
1 parent a2d5453 commit f9d8c4c

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: macOS
1919
strategy:
2020
matrix:
21-
xcode: ['16.1']
21+
xcode: ['16.3']
2222
config: ['debug', 'release']
2323
runs-on: macos-15
2424
steps:

Sources/SharingGRDBCore/Fetch.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public struct Fetch<Value: Sendable>: Sendable {
5454
sharedReader.isLoading
5555
}
5656

57+
/// Reloads data from the database.
58+
public func load() async throws {
59+
try await sharedReader.load()
60+
}
61+
5762
#if canImport(Combine)
5863
/// A publisher that emits events when the database observes changes to the query.
5964
public var publisher: some Publisher<Value, Never> {

Sources/SharingGRDBCore/FetchAll.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ public struct FetchAll<Element: Sendable>: Sendable {
5656
sharedReader.isLoading
5757
}
5858

59+
/// Reloads data from the database.
60+
public func load() async throws {
61+
try await sharedReader.load()
62+
}
63+
5964
#if canImport(Combine)
6065
/// A publisher that emits events when the database observes changes to the query.
6166
public var publisher: some Publisher<[Element], Never> {

Sources/SharingGRDBCore/FetchOne.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public struct FetchOne<Value: Sendable>: Sendable {
5454
sharedReader.isLoading
5555
}
5656

57+
/// Reloads data from the database.
58+
public func load() async throws {
59+
try await sharedReader.load()
60+
}
61+
5762
#if canImport(Combine)
5863
/// A publisher that emits events when the database observes changes to the query.
5964
public var publisher: some Publisher<Value, Never> {

0 commit comments

Comments
 (0)