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 are as for 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 are as for `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 File
, InputStream
, and
Reader
values. No data is read from the input until the parser 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 `File`, `InputStream`, and `Reader` values. No data is read from the input until the parser 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 sequential cell values. Returns the
number of rows written.
Options may include:
:separator
Character to separate cells with.:quote
Character to quote cell values with.:quote?
Predicate which should return true for cells to quote. Can be true
to
always quote cells, false
to never quote, and 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 sequential cell values. Returns the number of rows written. Options may include: - `:separator` Character to separate cells with. - `:quote` Character to quote cell values with. - `:quote?` Predicate which should return true for cells to quote. Can be `true` to always quote cells, `false` to never quote, and 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 records. If headers
are provided, they will be used directly, otherwise this returns a stateful
transducer which will treat the first row as headers.
A transducer which will zip up rows of cell data into records. If `headers` are provided, they will be used directly, otherwise this returns a stateful transducer which will treat the first row as headers.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close