package octez-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13
doc/octez-libs.rpc/Tezos_rpc/Query/index.html
Module Tezos_rpc.QuerySource
include module type of struct include Resto.Query end
A type for representing query parameters.
The type for key-value pairs that constitute a query. The first type parameter is for whole-query store and the second is for the type of value carried by the field.
field ?descr key arg default get is a field for the query parameters, i.e., it describes one key-value pair.
The key is given by key and the value is parsed as specified in arg or, if absent from the URI suffix, default.
Finally, get is for retrieving the value from the whole-query store. More on the whole-query store below.
val opt_field :
?descr:string ->
string ->
'a Resto.Arg.t ->
('b -> 'a option) ->
('b, 'a option) fieldval multi_field :
?descr:string ->
string ->
'a Resto.Arg.t ->
('b -> 'a list) ->
('b, 'a list) fieldQueries are constructed by adding fields to an open query and sealing it into a query. This is done using the functions below. Typically, it is done as follow: query c |+ field1 |+ field2 |> seal
As the types require, you must provide the correct argument to the successive building steps. Here is an example: query (fun timeout shade -> (timeout, shade)) |+ field "timeout" Arg.float 10. (fun (timeout, _) -> timeout) |+ field "shade" Arg.string "fuchsia" (fun (_, shade) -> shade) |> seal
The initial query function takes a whole-query store builder (a function that assemble all the fields into a single store of values), and each field takes a function to recover the value from the whole-query store.