Public interface to the separator codec.
Public interface to the separator codec.
(parse-error? x)True if the given value is a parser error.
True if the given value is a parser error.
(read-records input & {:as opts})Parse delimiter-separated row data from the input, as in read-rows. This
function returns a wrapped parser which will convert all rows into record
maps by applying headers.
Options the same as read-rows, with the addition of:
:headers
A known sequence of header values to use for the row data. If not provided,
they will be read from the first row of input.Parse delimiter-separated row data from the input, as in `read-rows`. This function returns a wrapped parser which will convert all rows into record maps by applying headers. Options the same as `read-rows`, with the addition of: - `:headers` A known sequence of header values to use for the row data. If not provided, they will be read from the first row of input.
(read-rows input & {:as opts})Parse delimiter-separated row data from the input. Returns a parser, which is an iterable and reducible collection where each entry is either a vector of strings representing the cells in a single row, or a parse error with details about the error encountered while parsing that row.
This accepts a variety of input types, including String, File,
InputStream, and Reader values. No data is read from the input until the
collection is consumed. The parser can only be consumed once, and will
not automatically close the input.
Options may include:
:separator
Character which separates row cells.:quote
Character which quotes field contents.:escape
Character which escapes other separator chars in unquoted fields.:unescape?
Whether escape sequences should be replaced with the literal character.:max-cell-size
Limit on number of characters in a single field.:max-row-width
Limit on number of cells in a single row.:error-mode
One of the following values:
:ignore to ignore all parsing errors:include to include errors in the parsed sequence as values:throw to throw as errors are encounteredSee default-options for default values.
Parse delimiter-separated row data from the input. Returns a parser, which
is an iterable and reducible collection where each entry is either a vector
of strings representing the cells in a single row, or a parse error with
details about the error encountered while parsing that row.
This accepts a variety of input types, including `String`, `File`,
`InputStream`, and `Reader` values. No data is read from the input until the
collection is consumed. The parser can only be consumed **once**, and will
not automatically close the input.
Options may include:
- `:separator`
Character which separates row cells.
- `:quote`
Character which quotes field contents.
- `:escape`
Character which escapes other separator chars in unquoted fields.
- `:unescape?`
Whether escape sequences should be replaced with the literal character.
- `:max-cell-size`
Limit on number of characters in a single field.
- `:max-row-width`
Limit on number of cells in a single row.
- `:error-mode`
One of the following values:
- `:ignore` to ignore all parsing errors
- `:include` to include errors in the parsed sequence as values
- `:throw` to throw as errors are encountered
See `default-options` for default values.(write-rows output rows & {:as opts})Write data to the output Writer as separator-delimited text. The rows
should be a reducible collection of sequences of cell values. Each cell is
converted to a string with str before writing.
Returns the number of rows written.
Options may include:
:separator
Character to separate cells with.:quote
Character to quote cell values with.:quote?
Controls whether cells are quoted. May be true to always quote cells,
false to never quote, or a predicate which should return truthy on cell
values that need quoting. Defaults to quoting only when necessary.:newline
Keyword option for newlines, either :lf for a single \n or :crlf
for Windows-style \r\n.See default-options for default values.
Write data to the output `Writer` as separator-delimited text. The `rows` should be a reducible collection of sequences of cell values. Each cell is converted to a string with `str` before writing. Returns the number of rows written. Options may include: - `:separator` Character to separate cells with. - `:quote` Character to quote cell values with. - `:quote?` Controls whether cells are quoted. May be `true` to always quote cells, `false` to never quote, or a predicate which should return truthy on cell values that need quoting. Defaults to quoting only when necessary. - `:newline` Keyword option for newlines, either `:lf` for a single `\n` or `:crlf` for Windows-style `\r\n`. See `default-options` for default values.
(zip-headers)(zip-headers headers)A transducer which will zip up rows of cell data into record maps. If headers are provided, they will be used directly, otherwise this will treat the first row as headers.
A transducer which will zip up rows of cell data into record maps. If headers are provided, they will be used directly, otherwise this will treat the first row as headers.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |