Enumerationgrdb 7.3.0GRDB

DatabaseDataDecodingStrategy

DatabaseDataDecodingStrategy specifies how FetchableRecord types that also adopt the standard Decodable protocol decode their Data properties.

FetchableRecord.swift:904
enum DatabaseDataDecodingStrategy

For example:

struct Player: FetchableRecord, Decodable {
    static func databaseDataDecodingStrategy(for column: String) -> DatabaseDataDecodingStrategy {
        .custom { dbValue
            guard let base64Data = Data.fromDatabaseValue(dbValue) else {
                return nil
            }
            return Data(base64Encoded: base64Data)
        }
    }

    // Decoded from both database base64 strings and blobs
    var myData: Data
}