Skip to content

Commit

Permalink
Support for Decodable (#39)
Browse files Browse the repository at this point in the history
Thanks to @khanlou for the idea and initial code.

Co-authored-by: Soroush Khanlou (@khanlou)
  • Loading branch information
pitfield committed Aug 30, 2022
1 parent 1d7cef4 commit c270d75
Show file tree
Hide file tree
Showing 27 changed files with 2,067 additions and 297 deletions.
27 changes: 27 additions & 0 deletions Docs/API/Enums/PostgresError.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,33 @@ <h4>Declaration</h4>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:17PostgresClientKit0A5ErrorO26columnMetadataNotAvailableyA2CmF"></a>
<a name="//apple_ref/swift/Element/columnMetadataNotAvailable" class="dashAnchor"></a>
<a class="token" href="#/s:17PostgresClientKit0A5ErrorO26columnMetadataNotAvailableyA2CmF">columnMetadataNotAvailable</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p><code><a href="../Classes/Cursor.html#/s:17PostgresClientKit6CursorC7columnsSayAA14ColumnMetadataVGSgvp">Cursor.columns</a></code> is nil, indicating column metadata is not available.</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">columnMetadataNotAvailable</span></code></pre>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
Expand Down
16 changes: 10 additions & 6 deletions Docs/API/Structs.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,8 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresByteA</span> <span class="p">:</span> <span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresByteA</span><span class="p">:</span>
<span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -310,7 +311,8 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresDate</span> <span class="p">:</span> <span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresDate</span><span class="p">:</span>
<span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -351,7 +353,8 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresTime</span> <span class="p">:</span> <span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresTime</span><span class="p">:</span>
<span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -397,7 +400,7 @@ <h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresTimeWithTimeZone</span><span class="p">:</span>
<span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -450,7 +453,8 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresTimestamp</span> <span class="p">:</span> <span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresTimestamp</span><span class="p">:</span>
<span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -501,7 +505,7 @@ <h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresTimestampWithTimeZone</span><span class="p">:</span>
<span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<span class="kt"><a href="Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down
40 changes: 39 additions & 1 deletion Docs/API/Structs/PostgresByteA.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
<h1>PostgresByteA</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresByteA</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresByteA</span><span class="p">:</span>
<span class="kt"><a href="../Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -258,6 +259,43 @@ <h4>Declaration</h4>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Decodable"></a>
<a name="//apple_ref/swift/Section/Decodable" class="dashAnchor"></a>
<a href="#/Decodable">
<h3 class="section-name">Decodable</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:Se4fromxs7Decoder_p_tKcfc"></a>
<a name="//apple_ref/swift/Method/init(from:)" class="dashAnchor"></a>
<a class="token" href="#/s:Se4fromxs7Decoder_p_tKcfc">init(from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">from</span> <span class="nv">decoder</span><span class="p">:</span> <span class="kt">Decoder</span><span class="p">)</span> <span class="k">throws</span></code></pre>

</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/CustomStringConvertible"></a>
Expand Down
40 changes: 39 additions & 1 deletion Docs/API/Structs/PostgresDate.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
<h1>PostgresDate</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresDate</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresDate</span><span class="p">:</span>
<span class="kt"><a href="../Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -421,6 +422,43 @@ <h4>Declaration</h4>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Decodable"></a>
<a name="//apple_ref/swift/Section/Decodable" class="dashAnchor"></a>
<a href="#/Decodable">
<h3 class="section-name">Decodable</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:Se4fromxs7Decoder_p_tKcfc"></a>
<a name="//apple_ref/swift/Method/init(from:)" class="dashAnchor"></a>
<a class="token" href="#/s:Se4fromxs7Decoder_p_tKcfc">init(from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">from</span> <span class="nv">decoder</span><span class="p">:</span> <span class="kt">Decoder</span><span class="p">)</span> <span class="k">throws</span></code></pre>

</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/CustomStringConvertible"></a>
Expand Down
40 changes: 39 additions & 1 deletion Docs/API/Structs/PostgresTime.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
<h1>PostgresTime</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresTime</span> <span class="p">:</span> <span class="kt"><a href="../Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">PostgresTime</span><span class="p">:</span>
<span class="kt"><a href="../Protocols/PostgresValueConvertible.html">PostgresValueConvertible</a></span><span class="p">,</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">Decodable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>

</div>
</div>
Expand Down Expand Up @@ -442,6 +443,43 @@ <h4>Declaration</h4>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Decodable"></a>
<a name="//apple_ref/swift/Section/Decodable" class="dashAnchor"></a>
<a href="#/Decodable">
<h3 class="section-name">Decodable</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:Se4fromxs7Decoder_p_tKcfc"></a>
<a name="//apple_ref/swift/Method/init(from:)" class="dashAnchor"></a>
<a class="token" href="#/s:Se4fromxs7Decoder_p_tKcfc">init(from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">from</span> <span class="nv">decoder</span><span class="p">:</span> <span class="kt">Decoder</span><span class="p">)</span> <span class="k">throws</span></code></pre>

</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/CustomStringConvertible"></a>
Expand Down
Loading

0 comments on commit c270d75

Please sign in to comment.