read(_:)
DatabasePool.swift:339func read<T>(_ value: (Database) throws -> T) throws -> T
func read<T>(_ value: (Database) throws -> T) throws -> T
import GRDB
A toolkit for SQLite databases, with a focus on application development
final class DatabasePool
A database connection that allows concurrent accesses to an SQLite database.
final class Database
An SQLite connection.
init(path: String, configuration: Configuration = Configuration()) throws
Opens or creates an SQLite database.
var configuration: Configuration { get }
var path: String { get }
The path to the database.
func _add<Reducer>(observation: ValueObservation<Reducer>, scheduling scheduler: some ValueObservationScheduler, onChange: @escaping (Reducer.Value) -> Void) -> AnyDatabaseCancellable where Reducer : ValueReducer
func asyncBarrierWriteWithoutTransaction(_ updates: @escaping (Result<Database, Error>) -> Void)
func asyncConcurrentRead(_ value: @escaping (Result<Database, Error>) -> Void)
Performs an asynchronous read access.
func asyncRead(_ value: @escaping (Result<Database, Error>) -> Void)
func asyncUnsafeRead(_ value: @escaping (Result<Database, Error>) -> Void)
func asyncWriteWithoutTransaction(_ updates: @escaping (Database) -> Void)
func barrierWriteWithoutTransaction<T>(_ updates: (Database) throws -> T) throws -> T
func barrierWriteWithoutTransaction<T>(_ updates: @escaping (Database) throws -> T) async throws -> T where T : Sendable
func close() throws
func interrupt()
func invalidateReadOnlyConnections()
Invalidates open read-only SQLite connections.
func makeSnapshot() throws -> DatabaseSnapshot
Creates a database snapshot that serializes accesses to an unchanging database content, as it exists at the moment the snapshot is created.
func makeSnapshotPool() throws -> DatabaseSnapshotPool
Creates a database snapshot that allows concurrent accesses to an unchanging database content, as it exists at the moment the snapshot is created.
func read<T>(_ value: @escaping (Database) throws -> T) async throws -> T where T : Sendable
func releaseMemory()
Frees as much memory as possible, by disposing non-essential memory.
func releaseMemoryEventually()
Eventually frees as much memory as possible, by disposing non-essential memory.
func spawnConcurrentRead(_ value: @escaping (Result<Database, Error>) -> Void)
func unsafeRead<T>(_ value: (Database) throws -> T) throws -> T
func unsafeRead<T>(_ value: @escaping (Database) throws -> T) async throws -> T where T : Sendable
func unsafeReentrantRead<T>(_ value: (Database) throws -> T) throws -> T
func unsafeReentrantWrite<T>(_ updates: (Database) throws -> T) rethrows -> T
func writeInTransaction(_ kind: Database.TransactionKind? = nil, _ updates: (Database) throws -> Database.TransactionCompletion) throws
Wraps database operations inside a database transaction.
func writeWithoutTransaction<T>(_ updates: (Database) throws -> T) rethrows -> T
func writeWithoutTransaction<T>(_ updates: @escaping (Database) throws -> T) async throws -> T where T : Sendable