-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the issue
MysqlNIO is missing MySQLData conformance for Data
Vapor version
4.92.4
Operating system and version
macOS 14.3.x
Swift version
5.10
Steps to reproduce
Create an Entity with .data
type, and try to write Swift Data to it. It'll end up encoded base64.
Adding the missing conformance fixes it:
import MySQLNIO
import NIOFoundationCompat
extension Foundation.Data: MySQLDataConvertible {
init?(mysqlData: MySQLData) {
guard [.blob, .mediumBlob, .longBlob, .tinyBlob].contains(mysqlData.type),
mysqlData.format == .binary,
let buffer = mysqlData.buffer else {
return nil
}
self = .init(buffer: buffer)
}
var mysqlData: MySQLData? {
.init(type: .blob, buffer: ByteBufferAllocator().buffer(data: self))
}
}
Outcome
Can't store Data
type.
Additional notes
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working