Module Write.Expert
Here be dragons. You may wish to use these functions over the bracketed interface above, but you MUST wait on Pipe.upstream_flushed
after closing the pipe.
val maybe_escape_field : ?quote:char -> ?sep:char -> string -> string
Escape the a CSV field if need be.
val escape_field : ?quote:char -> string -> string
Escape a CSV (even if doesn't have any characters that require escaping).
val quote_len : quote:char -> sep:char -> pos:int -> len:int -> string -> int option
Get the escaped length of one quoted field (without the quotes). Returns None if the field doesn't need to be escaped.
val quote_blit : quote:char -> src:string -> dst:Core_kernel.Bytes.t -> src_pos:int -> dst_pos:int -> len:int -> int
Copy and escapes the content of a field over from one string to another. This does not put the quotes in.
val of_writer : ?sep:char -> ?line_breaks:[ `Unix | `Windows ] -> write_header:bool -> 'a t -> Async.Writer.t -> 'a Async.Pipe.Writer.t
Make a pipe writer for
'a
s from a writer. The'a
s will be written out as CSVs.WARNING: you MUST wait on
Pipe.upstream_flushed
before doing anything with the resulting file
val of_writer_and_close : ?sep:char -> ?line_breaks:[ `Unix | `Windows ] -> write_header:bool -> 'a t -> Async.Writer.t -> 'a Async.Pipe.Writer.t
Make a pipe writer for
'a
s from a writer. The'a
s will be written out as CSVs.The writer will be closed when the pipe closes.
WARNING: you MUST wait on
Pipe.upstream_flushed
before doing anything with the resulting file
val create_writer : ?sep:char -> ?line_breaks:[ `Unix | `Windows ] -> write_header:bool -> 'a t -> string -> 'a Async.Pipe.Writer.t Async.Deferred.t
Make a pipe writer for
'a
s from a filename. The'a
s will be written out as CSVs.The writer will be closed when the pipe closes.
WARNING: you MUST wait on
Pipe.upstream_flushed
before doing anything with the resulting file
module By_row : sig ... end