1
1
Fork 0
mirror of https://github.com/mcuadros/ascode synced 2024-06-02 21:06:09 +02:00
ascode/docs/reference/csv/index.html
2020-04-12 20:51:23 +00:00

4 lines
7.0 KiB
HTML

<!doctype html><html lang=en><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="ie=edge"><title>encoding/csv - AsCode - Terraform Alternative Syntax</title><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=https://ascode.run/images/favicon.png><link rel=stylesheet href=/css/style.min.df49831c6872564dff31a5f0978a9571f2c8110b513d4b3b1fc8ead41dcdc9f0.css></head><body class="page page-default-single"><div id=main-menu-mobile class=main-menu-mobile><ul><li class=menu-item-home><a href=/><span>Home</span></a></li><li class=menu-item-docs><a href=/docs/><span>Docs</span></a></li><li class=menu-item-github><a href=https://github.com/mcuadros/ascode><span>GitHub</span></a></li></ul></div><div class=wrapper><div class=header><div class=container><div class=logo><a href=https://ascode.run><img alt=Logo src=/images/logo-header.svg></a></div><div class=logo-mobile><a href=https://ascode.run><img alt=Logo src=/images/logo-header.svg></a></div><div id=main-menu class=main-menu><ul><li class=menu-item-home><a href=/><span>Home</span></a></li><li class=menu-item-docs><a href=/docs/><span>Docs</span></a></li><li class=menu-item-github><a href=https://github.com/mcuadros/ascode><span>GitHub</span></a></li></ul></div><button id=toggle-main-menu-mobile class="hamburger hamburger--slider" type=button>
<span class=hamburger-box><span class=hamburger-inner></span></span></button></div></div><div class="main container pt-2 pt-md-6 pb-3 pb-md-6"><div class=row><div class="col-12 col-md-3 mb-3"><div class=sidebar><div class=docs-menu><h4><a href=/docs/reference/>API Reference</a></h4><ul><li><a href=/docs/reference/types/>built-in</a></li><li><a href=/docs/reference/docker/>docker</a></li><li><a href=/docs/reference/base64/>encoding/base64</a></li><li><a class=active href=/docs/reference/csv/>encoding/csv</a></li><li><a href=/docs/reference/json/>encoding/json</a></li><li><a href=/docs/reference/yaml/>encoding/yaml</a></li><li><a href=/docs/reference/http/>http</a></li><li><a href=/docs/reference/math/>math</a></li><li><a href=/docs/reference/os/>os</a></li><li><a href=/docs/reference/filepath/>path/filepath</a></li><li><a href=/docs/reference/re/>re</a></li><li><a href=/docs/reference/time/>time</a></li></ul></div><div style=font-size:90%;margin-top:40px><a href=/docs/>« Documentation</a></div></div></div><div class="col-12 col-md-9"><h1 class=title>encoding/csv</h1><div class=content><h2 id=index>Index</h2><div class=toc><nav id=TableOfContents><ul><li><a href=#overview>Overview</a></li><li><a href=#functions>Functions</a><ul><li><a href=#def-bread_allb>def <b>read_all</b></a></li><li><a href=#def-bwrite_allb>def <b>write_all</b></a></li></ul></li></ul></nav></div><h2 id=overview>Overview</h2><p>csv reads comma-separated values files</p><h2 id=functions>Functions</h2><h3 id=def-bread_allb>def <b>read_all</b></h3><div class=highlight><pre class=chroma><code class=language-go data-lang=go><span class=nf>read_all</span><span class=p>(</span><span class=nx>source</span><span class=p>,</span> <span class=nx>comma</span><span class=p>=</span><span class=s>&#34;,&#34;</span><span class=p>,</span> <span class=nx>comment</span><span class=p>=</span><span class=s>&#34;&#34;</span><span class=p>,</span> <span class=nx>lazy_quotes</span><span class=p>=</span><span class=nx>False</span><span class=p>,</span> <span class=nx>trim_leading_space</span><span class=p>=</span><span class=nx>False</span><span class=p>,</span> <span class=nx>fields_per_record</span><span class=p>=</span><span class=mi>0</span><span class=p>,</span> <span class=nx>skip</span><span class=p>=</span><span class=mi>0</span><span class=p>)</span> <span class=p>[][]</span><span class=kt>string</span>
</code></pre></div><p>read all rows from a source string, returning a list of string lists</p><h6 id=arguments>Arguments</h6><table><thead><tr><th>name</th><th>type</th><th>description</th></tr></thead><tbody><tr><td><code>source</code></td><td><code>string</code></td><td>input string of csv data</td></tr><tr><td><code>comma</code></td><td><code>string</code></td><td>comma is the field delimiter, defaults to &ldquo;,&rdquo; (a comma).comma must be a valid character and must not be \r, \n,or the Unicode replacement character (0xFFFD).</td></tr><tr><td><code>comment</code></td><td><code>string</code></td><td>comment, if not &ldquo;", is the comment character. Lines beginning with thecomment character without preceding whitespace are ignored.With leading whitespace the comment character becomes part of thefield, even if trim_leading_space is True.comment must be a valid character and must not be \r, \n,or the Unicode replacement character (0xFFFD).It must also not be equal to comma.</td></tr><tr><td><code>lazy_quotes</code></td><td><code>bool</code></td><td>If lazy_quotes is True, a quote may appear in an unquoted field anda non-doubled quote may appear in a quoted field.</td></tr><tr><td><code>trim_leading_space</code></td><td><code>bool</code></td><td>If trim_leading_space is True, leading white space in a field is ignored.This is done even if the field delimiter, comma, is white space.</td></tr><tr><td><code>fields_per_record</code></td><td><code>int</code></td><td>fields_per_record is the number of expected fields per record.If fields_per_record is positive, read_all requires each record tohave the given number of fields. If fields_per_record is 0, read_all sets it tothe number of fields in the first record, so that future records musthave the same field count. If fields_per_record is negative, no check ismade and records may have a variable number of fields.</td></tr><tr><td><code>skip</code></td><td><code>int</code></td><td>number of rows to skip, omitting from returned rows</td></tr></tbody></table><h3 id=def-bwrite_allb>def <b>write_all</b></h3><div class=highlight><pre class=chroma><code class=language-go data-lang=go><span class=nf>write_all</span><span class=p>(</span><span class=nx>source</span><span class=p>,</span><span class=nx>comma</span><span class=p>=</span><span class=s>&#34;,&#34;</span><span class=p>)</span> <span class=kt>string</span>
</code></pre></div><p>write all rows from source to a csv-encoded string</p><h6 id=arguments-1>Arguments</h6><table><thead><tr><th>name</th><th>type</th><th>description</th></tr></thead><tbody><tr><td><code>source</code></td><td><code>[][]string</code></td><td>array of arrays of strings to write to csv</td></tr><tr><td><code>comma</code></td><td><code>string</code></td><td>comma is the field delimiter, defaults to &ldquo;,&rdquo; (a comma).comma must be a valid character and must not be \r, \n,or the Unicode replacement character (0xFFFD).</td></tr></tbody></table></div></div></div></div></div></div><div class=sub-footer><div class=container><div class=row><div class=col-12><div class=sub-footer-inner><ul><li><a href=https://github.com/mcuadros/ascod>Documentation version v1.1.1</a></li><li>Template by <a href=https://www.zerostatic.io>Robert Austin</a></li></ul></div></div></div></div><script type=text/javascript src=/js/scripts.min.be6fe1294698d6acd837c5182149cd1a24daae9fa1903ce810c264539d254d62.js></script></body></html>