Form.Data
Form data.
type form = t
See Brr_io.Form.t
.
The type for form data entry values.
The type for FormData objects.
val create : unit -> t
create ()
is new, empty, form data.
of_form f
is a form data from the current key-values of form f
.
val is_empty : t -> bool
is_empty d
is true
if d
has no entries.
val has_file_entry : t -> bool
has_file_entry d
is true
iff d
has a file entry.
val find : t -> Jstr.t -> entry_value option
find d k
is the first value associated to k
in d
(if any).
val find_all : t -> Jstr.t -> entry_value list
find_all d k
are all the values associated to k
in d
.
val fold : (Jstr.t -> entry_value -> 'a -> 'a) -> t -> 'a -> 'a
fold f d acc
folds over all key/value entries in d
with f
starting with k
.
val set_blob : ?filename:Jstr.t -> t -> Jstr.t -> Brr.Blob.t -> unit
set d k b ~filename
sets the value of k
to b
in d
. filename
can specify the filename of b
.
val append_blob : ?filename:Jstr.t -> t -> Jstr.t -> Brr.Blob.t -> unit
append d k b ~filename
appends blob b
to the value of k
in d
. filename
can specify the filename of b
.
val of_assoc : (Jstr.t * entry_value) list -> t
of_assoc l
is form data from assoc l
, data is append
ed.
val to_assoc : t -> (Jstr.t * entry_value) list
to_assoc l
is the form data as an association list.
val of_uri_params : Brr.Uri.Params.t -> t
of_uri_params p
is a form data for p
.
val to_uri_params : t -> Brr.Uri.Params.t
to_uri_params t
is the form data as URI query parameters.
Note. If your form has file inputs this will map their keys to something like "[Object File]"
, has_file_entry
indicates whether the form data has a file entry.