package delimited_parsing

  1. Overview
  2. Docs

Module Read.RowSource

Whole-row parsing.

Sourcetype 'a builder_t = 'a t
Sourcetype t
Sourceval get_conv_exn : t -> string -> Core.Source_code_position.t -> (string -> 'a) -> 'a

get_conv_exn t header [%here] conv extract the cell with column header from row and convert it using conv. If there is an error the error is raised including row header error and the source code position (%here).

Sourceval get_exn : t -> string -> string

get_exn t header return the column of the row corresponding to header

Sourceval get_conv_opt_exn : t -> string -> Core.Source_code_position.t -> (string -> 'a) -> 'a option

get_conv_opt_exn is like get_conv_exn, but empty strings are converted to None. Missing headers raise exceptions.

Sourceval get : t -> string -> string option

get t header same as get_exn, but returns an option when the header was not found

Sourceval get_opt_exn : t -> string -> string option

get_opt_exn is like get_exn, but empty strings are converted to None. Missing headers raise exceptions.

Sourceval nth_exn : t -> int -> string

nth_exn t i return the ith column of t (indexed from 0)

Sourceval nth_conv_exn : t -> int -> Core.Source_code_position.t -> (string -> 'a) -> 'a

nth_conv_exn t i [%here] conv extract the ith column of t and convert it using conv. If there is an error the error is raised including row i error and the source code position (%here).

Sourceval nth : t -> int -> string option

nth t i same as nth_exn, but returns an option in the case where t does not have at least i - 1 columns

Sourceval nth_conv : t -> int -> (string -> 'a) -> 'a option

nth_conv is like nth_conv_exn, but returns None if there is an error.

Sourceval to_list : t -> string list

to_list t return all columns in the order they appear in the file

Sourceval to_array : t -> string array

to_array t return all columns in the order they appear in the file

Sourceval length : t -> int

length t returns number of fields in this row

Sourceval headers : t -> int Core.String.Map.t

headers t return the header mapping (header -> position) available for the table this row is from.

list_of_headers is a list in the same order as in input file.

Sourceval list_of_headers : t -> string list
Sourceval is_empty : t -> bool

is_empty t return true if the row contains only empty strings

Sourceval to_string : t -> string
Sourceval sexp_of_t : t -> Core.Sexp.t
Sourceval fold : t -> init:'acc -> f:('acc -> header:string -> data:string -> 'acc) -> 'acc

fold folds over (header, data) pairs.

It may throw if header doesn't have a corresponding entry in data array, e.g. when row has fewer columns than headers.

Sourceval fold_opt : t -> init:'acc -> f:('acc -> header:string -> data:string option -> 'acc) -> 'acc

fold_opt just like fold but lets user handle missing data.

Sourceval iter : t -> f:(header:string -> data:string -> unit) -> unit
Sourceval create : int Core.String.Table.t -> string array -> t
Sourceval create' : int Core.String.Map.t -> string array -> t
Sourceval equal : t -> t -> bool
Sourceval compare : t -> t -> int
Sourcemodule Expert : sig ... end
Sourceval builder : t builder_t

A builder for Row.ts.

As this parses the whole row it's slower than using the builder interface directly, but simpler to use.

OCaml

Innovation. Community. Security.