forked from vapor/postgres-nio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPostgresMessage+Password.swift
29 lines (24 loc) · 1.02 KB
/
PostgresMessage+Password.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
29
import NIOCore
extension PostgresMessage {
/// Identifies the message as a password response. Note that this is also used for
/// GSSAPI and SSPI response messages (which is really a design error, since the contained
/// data is not a null-terminated string in that case, but can be arbitrary binary data).
@available(*, deprecated, message: "Will be removed from public API")
public struct Password: PostgresMessageType {
public static var identifier: PostgresMessage.Identifier {
return .passwordMessage
}
public init(string: String) {
self.string = string
}
/// The password (encrypted, if requested).
public var string: String
public var description: String {
return "Password(\(string))"
}
/// Serializes this message into a byte buffer.
public func serialize(into buffer: inout ByteBuffer) {
buffer.writeString(self.string + "\0")
}
}
}