node icon indicating copy to clipboard operation
node copied to clipboard

Fuzzy get fails for [UInt8]

Open vzsg opened this issue 8 years ago • 1 comments

This is an older issue I forgot to report, but still happening with the latest versions of the framework. It's easiest to reproduce with Fluent, but the underlying issue is here.

Consider an entity that has a Bytes property inside, and its init(row:) initializer.

The linked file works, but if line 16 was written naively as one would expect to work:

content = try row.get("content")

A cryptic error is thrown instead:

[Node Error: Unable to convert 'Node(wrapped: [91, 49, 48, 48, 44, 49, 49, 55, 44, 49, 48, 57, 44, 49, 48, 57, 44, 49, 50, 49, 44, 52, 56, 44, 52, 56, 44, 52, 57, 93], context: MySQL.MySQLContext)' to 'UInt8' for path ''] [Identifier: Node.NodeError.unableToConvert]

Which suggests that for some dark reason, the function tried to convert the bytes SD into a single byte.

vzsg avatar Jul 12 '17 23:07 vzsg

@LoganWright any ideas here?

I vaguely remember this being related to an ambiguity that we couldn't resolve when determining if we should init a single object or an array of objects.

let user: User = try row.get("user")
let user: [User] = try row.get("users")

tanner0101 avatar Jul 19 '17 17:07 tanner0101