@@ -89,28 +89,47 @@ extension PostgresEncodable {
8989 }
9090}
9191
92- struct PostgresEncodingContext < JSONEncoder: PostgresJSONEncoder > {
93- let jsonEncoder : JSONEncoder
92+ /// A context that is passed to Swift objects that are encoded into the Postgres wire format. Used
93+ /// to pass further information to the encoding method.
94+ public struct PostgresEncodingContext < JSONEncoder: PostgresJSONEncoder > {
95+ /// A ``PostgresJSONEncoder`` used to encode the object to json.
96+ public var jsonEncoder : JSONEncoder
9497
95- init ( jsonEncoder: JSONEncoder ) {
98+
99+ /// Creates a ``PostgresEncodingContext`` with the given ``PostgresJSONEncoder``. In case you want
100+ /// to use the a ``PostgresEncodingContext`` with an unconfigured Foundation `JSONEncoder`
101+ /// you can use the ``default`` context instead.
102+ ///
103+ /// - Parameter jsonEncoder: A ``PostgresJSONEncoder`` to use when encoding objects to json
104+ public init ( jsonEncoder: JSONEncoder ) {
96105 self . jsonEncoder = jsonEncoder
97106 }
98107}
99108
100109extension PostgresEncodingContext where JSONEncoder == Foundation . JSONEncoder {
101- static let `default` = PostgresEncodingContext ( jsonEncoder: JSONEncoder ( ) )
110+ /// A default ``PostgresEncodingContext`` that uses a Foundation `JSONEncoder`.
111+ public static let `default` = PostgresEncodingContext ( jsonEncoder: JSONEncoder ( ) )
102112}
103113
104- struct PostgresDecodingContext < JSONDecoder: PostgresJSONDecoder > {
105- let jsonDecoder : JSONDecoder
106-
107- init ( jsonDecoder: JSONDecoder ) {
114+ /// A context that is passed to Swift objects that are decoded from the Postgres wire format. Used
115+ /// to pass further information to the decoding method.
116+ public struct PostgresDecodingContext < JSONDecoder: PostgresJSONDecoder > {
117+ /// A ``PostgresJSONDecoder`` used to decode the object from json.
118+ public var jsonDecoder : JSONDecoder
119+
120+ /// Creates a ``PostgresDecodingContext`` with the given ``PostgresJSONDecoder``. In case you want
121+ /// to use the a ``PostgresDecodingContext`` with an unconfigured Foundation `JSONDecoder`
122+ /// you can use the ``default`` context instead.
123+ ///
124+ /// - Parameter jsonDecoder: A ``PostgresJSONDecoder`` to use when decoding objects from json
125+ public init ( jsonDecoder: JSONDecoder ) {
108126 self . jsonDecoder = jsonDecoder
109127 }
110128}
111129
112130extension PostgresDecodingContext where JSONDecoder == Foundation . JSONDecoder {
113- static let `default` = PostgresDecodingContext ( jsonDecoder: Foundation . JSONDecoder ( ) )
131+ /// A default ``PostgresDecodingContext`` that uses a Foundation `JSONDecoder`.
132+ public static let `default` = PostgresDecodingContext ( jsonDecoder: Foundation . JSONDecoder ( ) )
114133}
115134
116135extension Optional : PostgresDecodable where Wrapped: PostgresDecodable , Wrapped. _DecodableType == Wrapped {
0 commit comments