mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
Remove all @inline(__always)
This commit is contained in:
1 parent
728c3b28ed
commit
a0c85f093c
6 files changed
-25
No files matched your search
@@ -302,7 +302,6 @@ private struct TableRegion: Equatable {
|
||||
return TableRegion(columns: columnsUnion, rowIds: rowIdsUnion)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func contains(rowID: Int64) -> Bool {
|
||||
guard let rowIds = rowIds else {
|
||||
return true
|
||||
|
||||
@@ -150,7 +150,6 @@ func fatalConversionError<T>(to: T.Type, sqliteStatement: SQLiteStatement, index
|
||||
|
||||
/// Lossless conversions from database values and rows
|
||||
extension DatabaseValueConvertible {
|
||||
@inline(__always)
|
||||
static func decode(from dbValue: DatabaseValue, conversionContext: @autoclosure () -> ValueConversionContext?) -> Self {
|
||||
if let value = fromDatabaseValue(dbValue) {
|
||||
return value
|
||||
@@ -159,14 +158,12 @@ extension DatabaseValueConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
static func decode(from row: Row, atUncheckedIndex index: Int) -> Self {
|
||||
return decode(
|
||||
from: row.impl.databaseValue(atUncheckedIndex: index),
|
||||
conversionContext: ValueConversionContext(row).atColumn(index))
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
static func decodeIfPresent(from dbValue: DatabaseValue, conversionContext: @autoclosure () -> ValueConversionContext?) -> Self? {
|
||||
// Use fromDatabaseValue before checking for null: this allows DatabaseValue to convert NULL to .null.
|
||||
if let value = fromDatabaseValue(dbValue) {
|
||||
@@ -178,7 +175,6 @@ extension DatabaseValueConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
static func decodeIfPresent(from row: Row, atUncheckedIndex index: Int) -> Self? {
|
||||
return decodeIfPresent(
|
||||
from: row.impl.databaseValue(atUncheckedIndex: index),
|
||||
@@ -190,7 +186,6 @@ extension DatabaseValueConvertible {
|
||||
|
||||
/// Lossless conversions from database values and rows
|
||||
extension DatabaseValueConvertible where Self: StatementColumnConvertible {
|
||||
@inline(__always)
|
||||
static func fastDecode(from sqliteStatement: SQLiteStatement, index: Int32) -> Self {
|
||||
if sqlite3_column_type(sqliteStatement, index) == SQLITE_NULL {
|
||||
fatalConversionError(
|
||||
@@ -201,7 +196,6 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
|
||||
return self.init(sqliteStatement: sqliteStatement, index: index)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
static func fastDecode(from row: Row, atUncheckedIndex index: Int) -> Self {
|
||||
if let sqliteStatement = row.sqliteStatement {
|
||||
return fastDecode(from: sqliteStatement, index: Int32(index))
|
||||
@@ -209,7 +203,6 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
|
||||
return row.impl.fastDecode(Self.self, atUncheckedIndex: index)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
static func fastDecodeIfPresent(from sqliteStatement: SQLiteStatement, atUncheckedIndex index: Int32) -> Self? {
|
||||
if sqlite3_column_type(sqliteStatement, index) == SQLITE_NULL {
|
||||
return nil
|
||||
@@ -217,7 +210,6 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
|
||||
return self.init(sqliteStatement: sqliteStatement, index: index)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
static func fastDecodeIfPresent(from row: Row, atUncheckedIndex index: Int) -> Self? {
|
||||
if let sqliteStatement = row.sqliteStatement {
|
||||
return fastDecodeIfPresent(from: sqliteStatement, atUncheckedIndex: Int32(index))
|
||||
|
||||
@@ -140,7 +140,6 @@ extension Row {
|
||||
return index(ofColumn: columnName) != nil
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func index(ofColumn name: String) -> Int? {
|
||||
return impl.index(ofColumn: name)
|
||||
}
|
||||
@@ -151,7 +150,6 @@ extension Row {
|
||||
// MARK: - Extracting Values
|
||||
|
||||
/// Fatal errors if index is out of bounds
|
||||
@inline(__always)
|
||||
private func checkIndex(_ index: Int, file: StaticString = #file, line: UInt = #line) {
|
||||
GRDBPrecondition(index >= 0 && index < count, "row index out of range", file: file, line: line)
|
||||
}
|
||||
|
||||
@@ -191,7 +191,6 @@ private struct RowDecoder<Record: FetchableRecord>: Decoder {
|
||||
|
||||
// Helper methods
|
||||
|
||||
@inline(__always)
|
||||
private func decode<T>(_ type: T.Type, fromRow row: Row, codingPath: [CodingKey]) throws -> T where T: Decodable {
|
||||
if let type = T.self as? FetchableRecord.Type {
|
||||
// Prefer FetchableRecord decoding over Decodable.
|
||||
@@ -210,7 +209,6 @@ private struct RowDecoder<Record: FetchableRecord>: Decoder {
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
private func decode<T>(_ type: T.Type, fromRow row: Row, columnAtIndex index: Int, key: Key) throws -> T where T: Decodable {
|
||||
do {
|
||||
// This decoding will fail for types that decode from keyed
|
||||
@@ -310,7 +308,6 @@ fileprivate var iso8601Formatter: ISO8601DateFormatter = {
|
||||
}()
|
||||
|
||||
private extension DatabaseDateDecodingStrategy {
|
||||
@inline(__always)
|
||||
func decodeIfPresent(fromRow row: Row, columnAtIndex index: Int) -> Date? {
|
||||
if let sqliteStatement = row.sqliteStatement {
|
||||
return decodeIfPresent(
|
||||
@@ -323,7 +320,6 @@ private extension DatabaseDateDecodingStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func decode(fromRow row: Row, columnAtIndex index: Int) -> Date {
|
||||
if let sqliteStatement = row.sqliteStatement {
|
||||
return decode(
|
||||
@@ -336,7 +332,6 @@ private extension DatabaseDateDecodingStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func decode(sqliteStatement: SQLiteStatement, index: Int32) -> Date {
|
||||
switch self {
|
||||
case .deferredToDate:
|
||||
@@ -375,7 +370,6 @@ private extension DatabaseDateDecodingStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func decodeIfPresent(sqliteStatement: SQLiteStatement, index: Int32) -> Date? {
|
||||
if sqlite3_column_type(sqliteStatement, index) == SQLITE_NULL {
|
||||
return nil
|
||||
@@ -383,7 +377,6 @@ private extension DatabaseDateDecodingStrategy {
|
||||
return decode(sqliteStatement: sqliteStatement, index: index)
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func decode(from dbValue: DatabaseValue, conversionContext: @autoclosure () -> ValueConversionContext?) -> Date {
|
||||
if let date = dateFromDatabaseValue(dbValue) {
|
||||
return date
|
||||
@@ -392,7 +385,6 @@ private extension DatabaseDateDecodingStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
func decodeIfPresent(from dbValue: DatabaseValue, conversionContext: @autoclosure () -> ValueConversionContext?) -> Date? {
|
||||
if dbValue.isNull {
|
||||
return nil
|
||||
@@ -404,7 +396,6 @@ private extension DatabaseDateDecodingStrategy {
|
||||
}
|
||||
|
||||
// Returns nil if decoding fails
|
||||
@inline(__always)
|
||||
private func dateFromDatabaseValue(_ dbValue: DatabaseValue) -> Date? {
|
||||
switch self {
|
||||
case .deferredToDate:
|
||||
|
||||
@@ -118,12 +118,10 @@ private class RecordEncoder<Record: MutablePersistableRecord>: Encoder {
|
||||
}
|
||||
|
||||
/// Helper methods
|
||||
@inline(__always)
|
||||
fileprivate func persist(_ value: DatabaseValueConvertible?, forKey key: CodingKey) {
|
||||
_persistenceContainer[key.stringValue] = value
|
||||
}
|
||||
|
||||
@inline(__always)
|
||||
fileprivate func encode<T>(_ value: T, forKey key: CodingKey) throws where T : Encodable {
|
||||
if let date = value as? Date {
|
||||
persist(Record.databaseDateEncodingStrategy.encode(date), forKey: key)
|
||||
@@ -331,7 +329,6 @@ fileprivate var iso8601Formatter: ISO8601DateFormatter = {
|
||||
}()
|
||||
|
||||
private extension DatabaseDateEncodingStrategy {
|
||||
@inline(__always)
|
||||
func encode(_ date: Date) -> DatabaseValueConvertible? {
|
||||
switch self {
|
||||
case .deferredToDate:
|
||||
@@ -359,7 +356,6 @@ private extension DatabaseDateEncodingStrategy {
|
||||
}
|
||||
|
||||
private extension DatabaseUUIDEncodingStrategy {
|
||||
@inline(__always)
|
||||
func encode(_ uuid: UUID) -> DatabaseValueConvertible? {
|
||||
switch self {
|
||||
case .deferredToUUID:
|
||||
|
||||
@@ -46,7 +46,6 @@ extension Optional : _OptionalProtocol {
|
||||
// MARK: - Internal
|
||||
|
||||
/// Reserved for GRDB: do not use.
|
||||
@inline(__always)
|
||||
func GRDBPrecondition(_ condition: @autoclosure() -> Bool, _ message: @autoclosure() -> String = "", file: StaticString = #file, line: UInt = #line) {
|
||||
/// Custom precondition function which aims at solving
|
||||
/// https://bugs.swift.org/browse/SR-905 and
|
||||
|
||||
Reference in new issue
Block a user