Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Write CSVs & CSV-like delimited formats.
include module type of struct include Write end
Write CSVs & CSV-like delimited formats.
type -'a t = 'a Delimited_kernel.Write.t
Used to describe a way to create a single row of a CSV from a given type.
val empty : 'a t
val column : ('a -> string) -> header:string -> 'a t
val column_m :
(module Delimited_kernel__.Write_intf.To_string with type t = 'a) ->
header:string ->
'a t
val column_opt :
?default:string ->
('a -> string) ->
header:string ->
'a option t
default
is printed in place of None
, and if not supplied is the empty string.
val column_m_opt :
?default:string ->
(module Delimited_kernel__.Write_intf.To_string with type t = 'a) ->
header:string ->
'a option t
default
is used for every column in the case of None
.
val headers : 'a t -> string list
val to_columns : 'a t -> 'a -> string list
val to_string :
?quote:char ->
?sep:char ->
?line_breaks:[ `Unix | `Windows ] ->
write_header:bool ->
'a t ->
'a list ->
string
Convert a list of 'a
to a CSV document in a string.
module Fields_O = Delimited_kernel.Write.Fields_O
Open for prefix operators useful for using with Fields.to_list.
module O = Delimited_kernel.Write.O
val with_writer :
?sep:char ->
?line_breaks:[ `Unix | `Windows ] ->
write_header:bool ->
'a t ->
Async.Writer.t ->
f:('a Async.Pipe.Writer.t -> 'b Async.Deferred.t) ->
'b Async.Deferred.t
Make a pipe writer for 'a
s from a writer. The 'a
s will be written out as CSVs.
Once with_writer
's return Deferred becomes determined, it is guaranteed that the whole CSV has hit the OS buffer.
The writer will NOT be closed when the pipe closes.
val with_file :
?sep:char ->
?line_breaks:[ `Unix | `Windows ] ->
write_header:bool ->
'a t ->
string ->
f:('a Async.Pipe.Writer.t -> 'b Async.Deferred.t) ->
'b Async.Deferred.t
Make a pipe writer for 'a
s from a filename, using the given CSV converter.
module By_row : sig ... end
module Expert : sig ... end
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.
module Without_expert : module type of Write with module Expert := Write.Expert
Helper for converting from the old interface. Use this snippet in files to disable the expert interface: