package brr

  1. Overview
  2. Docs
On This Page
  1. Converting
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Form.DataSource

Form data.

Sourcetype form = t
Sourcetype entry_value = [
  1. | `String of Jstr.t
  2. | `File of Brr.File.t
]

The type for form data entry values.

Sourcetype t

The type for FormData objects.

Sourceval create : unit -> t

create () is new, empty, form data.

Sourceval of_form : form -> t

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

Sourceval is_empty : t -> bool

is_empty d is true if d has no entries.

Sourceval has_file_entry : t -> bool

has_file_entry d is true iff d has a file entry.

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

mem d k is true if d has key k.

Sourceval find : t -> Jstr.t -> entry_value option

find d k is the first value associated to k in d (if any).

Sourceval find_all : t -> Jstr.t -> entry_value list

find_all d k are all the values associated to k in d.

Sourceval 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.

Sourceval set : t -> Jstr.t -> Jstr.t -> unit

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

Sourceval 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.

Sourceval append : t -> Jstr.t -> Jstr.t -> unit

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

Sourceval 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.

Sourceval delete : t -> Jstr.t -> unit

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

Converting

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

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

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

to_assoc l is the form data as an association list.

Sourceval of_uri_params : Brr.Uri.Params.t -> t

of_uri_params p is a form data for p.

Sourceval 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.