Module Form.Data

Form data.

type form = t

See Brr_io.Form.t.

type entry_value = [
| `String of Jstr.t
| `File of Brr.File.t

The type for form data entry values.

type t

The type for FormData objects.

val create : unit -> t

create () is new, empty, form data.

val of_form : form -> t

of_form f is a form data from the current key-values of form f.

val mem : t -> Jstr.t -> bool

mem d k is true if d has key k.

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 : t -> Jstr.t -> Jstr.t -> unit

set d k v sets the value of k to v in d.

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 : t -> Jstr.t -> Jstr.t -> unit

append d k v appends value v to the value of k in d.

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 delete : t -> Jstr.t -> unit

delete d k deletes the values of key k in d.


val of_assoc : (Jstr.t * entry_value) list -> t

of_assoc l is form data from assoc l, data is appended.

val to_assoc : t -> (Jstr.t * entry_value) list

to_assoc l is the form data as an association list.