Skip to content

Instance Method

decode(_:context:file:line:)

Decode the cell into a Swift type that conforms to PostgresDecodable.
func decode<T, JSONDecoder>(_: T.Type, context: PostgresDecodingContext<JSONDecoder>, file: String = #fileID, line: Int = #line) throws -> T where T : PostgresDecodable, JSONDecoder : PostgresJSONDecoder

Parameters

_

The Swift type, which conforms to PostgresDecodable, to decode from the cell’s bytes value.

context

A PostgresDecodingContext to supply a custom PostgresJSONDecoder for decoding JSON fields.

file

The source file in which this method was called. Used in the error case in PostgresDecodingError.

line

The source file line in which this method was called. Used in the error case in PostgresDecodingError.

Return Value

A decoded Swift type.