Skip to content
Discussion options

You must be logged in to vote

OK. I understand where the problem comes from.

While decoding PlayerInfo from a database row, it is the Decodable conformance of MedalID that is used to decode the values loaded from the database, not its DatabaseValueConvertible conformance:

// Decodable conformance runs
init(from decoder: any Decoder) throws {
    uuid = try UUID(from: decoder)
}

// DatabaseValueConvertible conformance does not run
static func fromDatabaseValue(_ dbValue: DatabaseValue) -> MedalID? {
    UUID.fromDatabaseValue(dbValue).map(MedalID.init)
}

Unfortunately, the Decodable facet of UUID has no support for blobs. It requires a String, fails to decode one from the database blob (as expected - a binary UUID is …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@groue
Comment options

Answer selected by lunacookies
@lunacookies
Comment options

@groue
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants