@@ -74,77 +74,3 @@ public struct PostgreSQLRowEncoder {
74
74
}
75
75
}
76
76
}
77
-
78
-
79
- public struct SQLRowEncoder < Database> where Database: SQLSupporting {
80
- public init ( ) { }
81
-
82
- public func encode< E> ( _ encodable: E , tableName: String ? = nil ) throws -> [ Query < Database > . DML . Column : Query < Database > . DML . Value ]
83
- where E: Encodable
84
- {
85
- let encoder = _Encoder ( tableName: tableName)
86
- try encodable. encode ( to: encoder)
87
- return encoder. row
88
- }
89
-
90
- // MARK: Private
91
-
92
- private final class _Encoder : Encoder {
93
- let codingPath : [ CodingKey ] = [ ]
94
- var userInfo : [ CodingUserInfoKey : Any ] = [ : ]
95
- var row : [ Query < Database > . DML . Column : Query < Database > . DML . Value ]
96
- let tableName : String ?
97
-
98
- init ( tableName: String ? ) {
99
- self . row = [ : ]
100
- self . tableName = tableName
101
- }
102
-
103
- func container< Key> ( keyedBy type: Key . Type ) -> KeyedEncodingContainer < Key > where Key : CodingKey {
104
- return . init( _KeyedEncodingContainer ( encoder: self ) )
105
- }
106
-
107
- func unkeyedContainer( ) -> UnkeyedEncodingContainer {
108
- fatalError ( )
109
- }
110
-
111
- func singleValueContainer( ) -> SingleValueEncodingContainer {
112
- fatalError ( )
113
- }
114
- }
115
-
116
- private struct _KeyedEncodingContainer < Key> : KeyedEncodingContainerProtocol where Key: CodingKey {
117
- let codingPath : [ CodingKey ] = [ ]
118
- let encoder : _Encoder
119
- init ( encoder: _Encoder ) {
120
- self . encoder = encoder
121
- }
122
-
123
- mutating func encodeNil( forKey key: Key ) throws {
124
- encoder. row [ . init( table: encoder. tableName, name: key. stringValue) ] = . null
125
- }
126
-
127
- mutating func encode< T> ( _ value: T , forKey key: Key ) throws where T : Encodable {
128
- encoder. row [ . init( table: encoder. tableName, name: key. stringValue) ] = . bind( value)
129
- }
130
-
131
- mutating func nestedContainer< NestedKey> ( keyedBy keyType: NestedKey . Type , forKey key: Key ) -> KeyedEncodingContainer < NestedKey > where NestedKey : CodingKey {
132
- fatalError ( )
133
- }
134
-
135
- mutating func nestedUnkeyedContainer( forKey key: Key ) -> UnkeyedEncodingContainer {
136
- fatalError ( )
137
- }
138
-
139
- mutating func superEncoder( ) -> Encoder {
140
- fatalError ( )
141
- }
142
-
143
- mutating func superEncoder( forKey key: Key ) -> Encoder {
144
- fatalError ( )
145
- }
146
- }
147
- }
148
-
149
-
150
-
0 commit comments