how to retrieve blob types from mysql using fluent

25 views Asked by At

I'm a vapor/fluent newbie. I have a backend running which retrieves data from a mysql database. Records with strings and ints are working fine. However,

   let q = "select idArtwork, image, notes from artwork, peopleItemIndex where personID = " + pid! + " and artwork.idArtwork = peopleItemIndex.itemid;";
   let compList = try await sql.raw(sq).all(decoding: artwork.self)

with the model (artwork);

@Field(key: "image")
var image : Data

 @Field(key: "idArtwork")
 var idArtwork : Int?

 @Field(key: "notes")
 var notes : String?

fails with;

invalid field: 'image', type: Data, error: dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.",

Is there a way to retrieve blob Types?

0

There are 0 answers