File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
Sources/FluentSQLiteDriver
Tests/FluentSQLiteDriverTests Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -120,15 +120,23 @@ private struct SQLiteDialect: SQLDialect {
120120}
121121
122122extension SQLiteRow : DatabaseOutput {
123+ public func contains( field: String ) -> Bool {
124+ return self . column ( field) != nil
125+ }
126+
123127 public func decode< T> ( field: String , as type: T . Type ) throws -> T where T : Decodable {
124128 return try self . decode ( column: field, as: T . self)
125129 }
126130}
127131
128132extension SQLiteRow : SQLRow {
133+ public func contains( column: String ) -> Bool {
134+ return self . column ( column) != nil
135+ }
136+
129137 public func decode< D> ( column: String , as type: D . Type ) throws -> D where D : Decodable {
130138 guard let data = self . column ( column) else {
131- fatalError ( )
139+ fatalError ( " no value found for \( column ) " )
132140 }
133141 return try SQLiteDataDecoder ( ) . decode ( D . self, from: data)
134142 }
@@ -183,6 +191,10 @@ private struct LastInsertRow: DatabaseOutput {
183191
184192 let lastAutoincrementID : Int64 ?
185193
194+ func contains( field: String ) -> Bool {
195+ return field == " fluentID "
196+ }
197+
186198 func decode< T> ( field: String , as type: T . Type ) throws -> T where T : Decodable {
187199 #warning("TODO: fixme, better logic")
188200 switch field {
Original file line number Diff line number Diff line change 1+ import NIO
12import Foundation
23
34public struct SQLiteDataEncoder {
Original file line number Diff line number Diff line change @@ -87,6 +87,18 @@ final class FluentSQLiteDriverTests: XCTestCase {
8787 try self . benchmarker. testAsyncCreate ( )
8888 }
8989
90+ func testSoftDelete( ) throws {
91+ try self . benchmarker. testSoftDelete ( )
92+ }
93+
94+ func testTimestampable( ) throws {
95+ try self . benchmarker. testTimestampable ( )
96+ }
97+
98+ func testLifecycleHooks( ) throws {
99+ try self . benchmarker. testLifecycleHooks ( )
100+ }
101+
90102 var benchmarker : FluentBenchmarker {
91103 return . init( database: self . connectionPool)
92104 }
You can’t perform that action at this time.
0 commit comments