You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
saving and retrieving an array of arrays of a custom type is not possible.
To Reproduce
I have a person struct like this
public struct Person: Codable {
public let name: String
public let id: String?
public init(name: String, id: String? = nil) {
self.name = name
self.id = id
}
}
and in my model I have a field like this
@Field(key: "teams")
var teams: [[Person]]?
Expected behavior
I want to be able to save it in my Postgres database.
I have used .field("teams", .array(of: .json))
and .field("teams", .json)
and
.field("teams", .array(of:.array(of: .json)))
as the field definition in my migration but none of them work.
Environment
Vapor Framework version: 4.36.2
Vapor Toolbox version:
OS version: 11.1
The text was updated successfully, but these errors were encountered:
Describe the bug
saving and retrieving an array of arrays of a custom type is not possible.
To Reproduce
I have a person struct like this
and in my model I have a field like this
Expected behavior
I want to be able to save it in my Postgres database.
I have used
.field("teams", .array(of: .json))
and
.field("teams", .json)
and
.field("teams", .array(of:.array(of: .json)))
as the field definition in my migration but none of them work.
Environment
The text was updated successfully, but these errors were encountered: