forked from vapor/postgres-nio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPostgresMessage+ParameterStatus.swift
28 lines (24 loc) · 1.14 KB
/
PostgresMessage+ParameterStatus.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import NIOCore
extension PostgresMessage {
@available(*, deprecated, message: "Will be removed from public API")
public struct ParameterStatus: PostgresMessageType, CustomStringConvertible {
/// Parses an instance of this message type from a byte buffer.
public static func parse(from buffer: inout ByteBuffer) throws -> ParameterStatus {
guard let parameter = buffer.readNullTerminatedString() else {
throw PostgresError.protocol("Could not read parameter from parameter status message")
}
guard let value = buffer.readNullTerminatedString() else {
throw PostgresError.protocol("Could not read value from parameter status message")
}
return .init(parameter: parameter, value: value)
}
/// The name of the run-time parameter being reported.
public var parameter: String
/// The current value of the parameter.
public var value: String
/// See `CustomStringConvertible`.
public var description: String {
return "\(parameter): \(value)"
}
}
}