Skip to content
Open
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: 3 additions & 2 deletions GRDB/Core/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import GRDBSQLite
#if !canImport(Darwin)
@preconcurrency
#endif
import Dispatch
import Foundation
import struct Dispatch.DispatchQoS
import class Dispatch.DispatchQueue


public struct Configuration: Sendable {

Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/Database+Statements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation


extension Database {

Expand Down
6 changes: 5 additions & 1 deletion GRDB/Core/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.Date
import class Foundation.FileManager
import struct Foundation.URL
import struct Foundation.TimeInterval
import struct Foundation.Notification

/// A raw SQLite connection, suitable for the SQLite C API.
public typealias SQLiteConnection = OpaquePointer
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/DatabaseCollation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import enum Foundation.ComparisonResult

/// `DatabaseCollation` is a custom string comparison function used by SQLite.
///
Expand Down
4 changes: 3 additions & 1 deletion GRDB/Core/DatabaseError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import protocol Foundation.CustomNSError
import var Foundation.NSLocalizedDescriptionKey
import var Foundation.NSLocalizedFailureReasonErrorKey

/// An SQLite result code.
///
Expand Down
6 changes: 4 additions & 2 deletions GRDB/Core/DatabasePool.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Dispatch
import Foundation

import protocol Foundation.NSObjectProtocol
import class Foundation.NotificationCenter
import class Foundation.DispatchSemaphore
#if os(iOS)
import UIKit
#endif
Expand Down
3 changes: 2 additions & 1 deletion GRDB/Core/DatabaseQueue.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import protocol Foundation.NSObjectProtocol
import class Foundation.NotificationCenter

#if os(iOS)
import UIKit
Expand Down
3 changes: 2 additions & 1 deletion GRDB/Core/DatabaseReader.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#if canImport(Combine)
import Combine
import class Dispatch.DispatchQueue
#endif
import Dispatch


/// A type that reads from an SQLite database.
///
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/DatabaseRegionObservation.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if canImport(Combine)
import Combine
#endif
import Foundation
import class Foundation.NSRecursiveLock

public struct DatabaseRegionObservation: Sendable {
/// A closure that is evaluated when the observation starts, and returns
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/DatabaseSnapshot.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Dispatch

/// A database connection that serializes accesses to an unchanging
/// database content, as it existed at the moment the snapshot was created.
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/DatabaseValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.Data

/// A value stored in a database table.
///
Expand Down
3 changes: 2 additions & 1 deletion GRDB/Core/DatabaseValueConvertible.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import class Foundation.JSONDecoder
import class Foundation.JSONEncoder

// Standard collections `Array`, `Set`, and `Dictionary` do not conform to
// `DatabaseValueConvertible`, on purpose.
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/DatabaseWriter.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#if canImport(Combine)
import Combine
import class Dispatch.DispatchQueue
#endif
import Dispatch

/// A type that writes into an SQLite database.
///
Expand Down
4 changes: 3 additions & 1 deletion GRDB/Core/DispatchQueueActor.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Dispatch
import class Dispatch.DispatchQueue
import struct Dispatch.DispatchWorkItemFlags
import func Dispatch.dispatchPrecondition

/// An actor that runs in a DispatchQueue.
///
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/Row.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.Data

/// A database row.
///
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/RowAdapter.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import struct Foundation.Data

/// Returns an array of row adapters that split a row according to the
/// provided numbers of columns.
Expand Down
3 changes: 2 additions & 1 deletion GRDB/Core/SchedulingWatchdog.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#if !canImport(Darwin)
@preconcurrency
#endif
import Dispatch
import class Dispatch.DispatchSpecificKey
import class Dispatch.DispatchQueue

/// SchedulingWatchdog makes sure that databases connections are used on correct
/// dispatch queues, and warns the user with a fatal error whenever she misuses
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/SerializedDatabase.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import class Foundation.DispatchQueue

/// A class that serializes accesses to an SQLite connection.
final class SerializedDatabase {
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/Statement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.CharacterSet

/// A raw SQLite statement, suitable for the SQLite C API.
public typealias SQLiteStatement = OpaquePointer
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/Support/Foundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.Data

/// Data is convertible to and from DatabaseValue.
extension Data: DatabaseValueConvertible, StatementColumnConvertible {
Expand Down
3 changes: 2 additions & 1 deletion GRDB/Core/Support/Foundation/DatabaseDateComponents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.DateComponents
import func Foundation.round

/// A database value that holds date components.
public struct DatabaseDateComponents: Sendable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import protocol Foundation.ReferenceConvertible

/// DatabaseValueConvertible is free for ReferenceConvertible types whose
/// ReferenceType is itself DatabaseValueConvertible.
Expand Down
8 changes: 7 additions & 1 deletion GRDB/Core/Support/Foundation/Date.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import class Foundation.NSDate
import struct Foundation.Date
import struct Foundation.DateComponents
import class Foundation.DateFormatter
import struct Foundation.Calendar
import struct Foundation.Locale
import struct Foundation.TimeZone

#if !os(Linux)
/// NSDate is stored in the database using the format
Expand Down
4 changes: 3 additions & 1 deletion GRDB/Core/Support/Foundation/Decimal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.Decimal
import class Foundation.NSDecimalNumber
import struct Foundation.Locale

/// Decimal adopts DatabaseValueConvertible
extension Decimal: DatabaseValueConvertible {
Expand Down
3 changes: 2 additions & 1 deletion GRDB/Core/Support/Foundation/NSData.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#if !os(Linux)
import Foundation
import class Foundation.NSData
import struct Foundation.Data

/// NSData is convertible to and from DatabaseValue.
extension NSData: DatabaseValueConvertible {
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/Support/Foundation/NSNull.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import class Foundation.NSNull

/// NSNull adopts DatabaseValueConvertible
extension NSNull: DatabaseValueConvertible {
Expand Down
7 changes: 6 additions & 1 deletion GRDB/Core/Support/Foundation/NSNumber.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#if !os(Linux) && !os(Windows)
import Foundation
import class Foundation.NSDecimalNumberHandler
import class Foundation.NSNumber
import class Foundation.NSDecimalNumber
import struct Foundation.Decimal
import struct Foundation.Locale


private let integerRoundingBehavior = NSDecimalNumberHandler(
roundingMode: .plain,
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/Support/Foundation/NSString.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !os(Linux)
import Foundation
import class Foundation.NSString

/// NSString adopts DatabaseValueConvertible
extension NSString: DatabaseValueConvertible {
Expand Down
4 changes: 3 additions & 1 deletion GRDB/Core/Support/Foundation/SQLiteDateParser.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Foundation
import func Foundation.strlen
import struct Foundation.DateComponents
import struct Foundation.TimeZone

// inspired by: http://jordansmith.io/performant-date-parsing/

Expand Down
3 changes: 2 additions & 1 deletion GRDB/Core/Support/Foundation/URL.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import class Foundation.NSURL
import struct Foundation.URL

#if !os(Linux) && !os(Windows)
/// NSURL stores its absoluteString in the database.
Expand Down
5 changes: 4 additions & 1 deletion GRDB/Core/Support/Foundation/UUID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import class Foundation.NSUUID
import struct Foundation.UUID
import typealias Foundation.uuid_t
import struct Foundation.Data

#if !os(Linux) && !os(Windows)
/// NSUUID adopts DatabaseValueConvertible
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import struct Foundation.Data

private struct DatabaseValueDecodingContainer: SingleValueDecodingContainer {
let dbValue: DatabaseValue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import class Foundation.JSONEncoder

private struct DatabaseValueEncodingContainer: SingleValueEncodingContainer {
let encode: (DatabaseValue) -> Void
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/TransactionClock.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import struct Foundation.Date

/// A type that provides the moment of a transaction.
///
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Dump/Database+Dump.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation


// MARK: - Dump

Expand Down
4 changes: 3 additions & 1 deletion GRDB/Dump/DumpFormats/DebugDumpFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.Data
import struct Foundation.UUID
import typealias Foundation.uuid_t

/// A format that prints one line per database row, suitable
/// for debugging.
Expand Down
3 changes: 2 additions & 1 deletion GRDB/Dump/DumpFormats/JSONDumpFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import class Foundation.JSONEncoder
import struct Foundation.Data

/// A format that prints database rows as a JSON array.
///
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Dump/DumpFormats/LineDumpFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation


/// A format that prints one line per database value. All blob values
/// are interpreted as strings.
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Dump/DumpFormats/ListDumpFormat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation


/// A format that prints one line per database row. All blob values
/// are interpreted as strings.
Expand Down
2 changes: 1 addition & 1 deletion GRDB/FTS/FTS5.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation


/// The virtual table module for the FTS5 full-text engine.
///
Expand Down
2 changes: 1 addition & 1 deletion GRDB/FTS/FTS5Tokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.Data

/// A low-level SQLite function that lets FTS5Tokenizer notify tokens.
///
Expand Down
2 changes: 1 addition & 1 deletion GRDB/FTS/FTS5WrapperTokenizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SQLite3
import GRDBSQLite
#endif

import Foundation
import struct Foundation.Data

/// Flags that tell SQLite how to register a token.
///
Expand Down
6 changes: 5 additions & 1 deletion GRDB/Migration/DatabaseMigrator.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#if canImport(Combine)
import Combine
#endif
import Foundation
import struct Foundation.URL
import class Foundation.ProcessInfo
import func Foundation.NSTemporaryDirectory
import class Foundation.FileManager
import class Foundation.DispatchQueue

// TODO: provide concurrent apis for migrations that run @Sendable closures.
/// A `DatabaseMigrator` registers and applies database migrations.
Expand Down
2 changes: 1 addition & 1 deletion GRDB/QueryInterface/Request/Association/Association.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation


/// A type that defines a connection between two tables.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation


extension AssociationToMany {
private func makeAggregate(_ expression: SQLExpression) -> AssociationAggregate<OriginRowDecoder> {
Expand Down
Loading