Skip to content

Commit 4435811

Browse files
author
Shaun Hubbard
committed
@MrMage had an excellent insight into the base decoder, and the length of words, wow I can't belive I missed this
1 parent 910c51f commit 4435811

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/PostgreSQL/Message/PostgreSQLNotificationResponse.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import Foundation
22

33
struct PostgreSQLNotificationResponse: Decodable {
44
/// The message coming from PSQL
5+
let channel: String
56
let message: String
67
init(from decoder: Decoder) throws {
78
let container = try decoder.singleValueContainer()
8-
_ = try container.decode(Int32.self) // message length
9-
_ = try container.decode(Int32.self) // process id of message
10-
let channelId = try container.decode(String.self)
11-
let message = try? container.decode(String.self)
12-
self.message = message ?? channelId
9+
_ = try container.decode(Int32.self)
10+
channel = try container.decode(String.self)
11+
message = try container.decode(String.self)
12+
NSLog("Found self \(channel) \(message)")
1313
}
1414
}

0 commit comments

Comments
 (0)