File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,8 +187,9 @@ public struct SwiftGenerator: Language {
187187 queries: [ Query ]
188188 ) throws -> SourceFileSyntax {
189189 return try SourceFileSyntax {
190+ try ImportDeclSyntax ( " import Foundation " )
190191 try ImportDeclSyntax ( " import Feather " )
191-
192+
192193 for table in tables {
193194 table
194195 }
Original file line number Diff line number Diff line change 66//
77
88import SQLite3
9+ import Foundation
910
1011@usableFromInline let SQLITE_TRANSIENT = unsafeBitCast ( - 1 , to: sqlite3_destructor_type. self)
1112
@@ -102,3 +103,21 @@ extension Optional: DatabasePrimitive where Wrapped: DatabasePrimitive {
102103 }
103104 }
104105}
106+
107+ extension UUID : DatabasePrimitive {
108+ @inlinable public init ( from cursor: OpaquePointer , at index: Int32 ) throws ( FeatherError) {
109+ guard let ptr = sqlite3_column_text ( cursor, index) else {
110+ throw . columnIsNil( index)
111+ }
112+
113+ guard let value = UUID ( uuidString: String ( cString: ptr) ) else {
114+ throw . invalidUuidString
115+ }
116+
117+ self = value
118+ }
119+
120+ @inlinable public func bind( to statement: OpaquePointer , at index: Int32 ) throws ( FeatherError) {
121+ try uuidString. bind ( to: statement, at: index)
122+ }
123+ }
Original file line number Diff line number Diff line change @@ -20,4 +20,5 @@ public enum FeatherError: Error {
2020 /// A query observation was attempted
2121 /// to be started twice.
2222 case subscriptionAlreadyStarted
23+ case invalidUuidString
2324}
You can’t perform that action at this time.
0 commit comments