Hi,
I'm trying to fetch a single column from an association, but it fails to decode. It does decode correctly when I fetch the whole association.
My helper type:
struct ElementWithApertureData: Decodable, FetchableRecord {
let element: Element
let polygonData: Data?
}
And the request:
let request = Element.including(optional: Element.aperture.select(Column("polygonData")))
The row looks like this in de debugger:
▿ 106 :
▿ [id:107 type:4 lineNumber:780 imageId:1 layerId:1 parentId:NULL xRepeat:NULL yRepeat:NULL xStep:NULL yStep:NULL clearPolarity:0 polarityIndex:0 rotation:0.0 scale:1.0 x1:NULL x2:NULL x3:NULL y1:NULL y2:NULL y3:NULL xMirror:0 yMirror:0 apertureId:NULL width:NULL height:NULL]
unadapted: [id:107 type:4 lineNumber:780 imageId:1 layerId:1 parentId:NULL xRepeat:NULL yRepeat:NULL xStep:NULL yStep:NULL clearPolarity:0 polarityIndex:0 rotation:0.0 scale:1.0 x1:NULL x2:NULL x3:NULL y1:NULL y2:NULL y3:NULL xMirror:0 yMirror:0 apertureId:NULL width:NULL height:NULL polygonData:NULL]
- aperture: [polygonData:NULL]
No mater how I played with forKey()
or other constructs, I can't get it to decode the single column association. I should add that my Aperture.init(for row:)
has indexed subscriptions, as I have a feeling that that also messes things up here.
Is it possible to decode the single column into its own variable?
Thanks in advance.
Kind regards,
Remco Poelstra