More cleanup

This commit is contained in:
Gwendal Roué committed 2018-08-12 10:20:10 +02:00
1 parent ef10e2e8ed
commit bf5420de26
1 file changed
+21 -22
+21 -22
View File
@@ -76,7 +76,6 @@ extension ValueConversionContext {
column: nil)
}
}
}
/// The canonical conversion error message
@@ -153,15 +152,6 @@ extension DatabaseValueConvertible {
}
extension Row {
@inline(__always)
func decodeIfPresent<Value: DatabaseValueConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int,
conversionContext: @autoclosure () -> ValueConversionContext?) -> Value?
{
return Value.decodeIfPresent(from: impl.databaseValue(atUncheckedIndex: index), conversionContext: conversionContext)
}
@inline(__always)
func decode<Value: DatabaseValueConvertible>(
_ type: Value.Type,
@@ -170,6 +160,15 @@ extension Row {
{
return Value.decode(from: impl.databaseValue(atUncheckedIndex: index), conversionContext: conversionContext)
}
@inline(__always)
func decodeIfPresent<Value: DatabaseValueConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int,
conversionContext: @autoclosure () -> ValueConversionContext?) -> Value?
{
return Value.decodeIfPresent(from: impl.databaseValue(atUncheckedIndex: index), conversionContext: conversionContext)
}
}
// MARK: - DatabaseValueConvertible & StatementColumnConvertible
@@ -195,18 +194,6 @@ extension DatabaseValueConvertible where Self: StatementColumnConvertible {
}
extension Row {
@inline(__always)
func fastDecodeIfPresent<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int,
conversionContext: @autoclosure () -> ValueConversionContext?) -> Value?
{
if let sqliteStatement = sqliteStatement {
return Value.fastDecodeIfPresent(from: sqliteStatement, index: Int32(index))
}
return impl.fastDecodeIfPresent(Value.self, atUncheckedIndex: index, conversionContext: conversionContext)
}
@inline(__always)
func fastDecode<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
@@ -218,4 +205,16 @@ extension Row {
}
return impl.fastDecode(Value.self, atUncheckedIndex: index, conversionContext: conversionContext)
}
@inline(__always)
func fastDecodeIfPresent<Value: DatabaseValueConvertible & StatementColumnConvertible>(
_ type: Value.Type,
atUncheckedIndex index: Int,
conversionContext: @autoclosure () -> ValueConversionContext?) -> Value?
{
if let sqliteStatement = sqliteStatement {
return Value.fastDecodeIfPresent(from: sqliteStatement, index: Int32(index))
}
return impl.fastDecodeIfPresent(Value.self, atUncheckedIndex: index, conversionContext: conversionContext)
}
}