PersistenceContainer

public struct PersistenceContainer

Use persistence containers in the encode(to:) method of your encodable records:

struct Player: EncodableRecord {
    var id: Int64?
    var name: String?

    func encode(to container: inout PersistenceContainer) {
        container["id"] = id
        container["name"] = name
    }
}
  • Accesses the value associated with the given column.

    It is undefined behavior to set different values for the same column. Column names are case insensitive, so defining both name and NAME is considered undefined behavior.

    Declaration

    Swift

    @inlinable
    public subscript(column: String) -> DatabaseValueConvertible? { get set }
  • Accesses the value associated with the given column.

    It is undefined behavior to set different values for the same column. Column names are case insensitive, so defining both name and NAME is considered undefined behavior.

    Declaration

    Swift

    @inlinable
    public subscript<Column>(column: Column) -> DatabaseValueConvertible? where Column : ColumnExpression { get set }