package octez-libs

  1. Overview
  2. Docs
A package that contains multiple base libraries used by the Octez suite

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65

doc/octez-libs.rpc/Tezos_rpc/Query/index.html

Module Tezos_rpc.QuerySource

include module type of struct include Resto.Query end
Sourcetype 'a t = 'a Resto.Query.t

A type for representing query parameters.

Sourcetype 'a query = 'a t
Sourceval empty : unit query

empty is for services that expects no query parameters.

Sourcetype ('a, 'b) field = ('a, 'b) Resto.Query.field

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.

Sourceval field : ?descr:string -> string -> 'a Resto.Arg.t -> 'a -> ('b -> 'a) -> ('b, 'a) 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.

Sourceval opt_field : ?descr:string -> string -> 'a Resto.Arg.t -> ('b -> 'a option) -> ('b, 'a option) field
Sourceval flag : ?descr:string -> string -> ('b -> bool) -> ('b, bool) field
Sourceval multi_field : ?descr:string -> string -> 'a Resto.Arg.t -> ('b -> 'a list) -> ('b, 'a list) field
Sourcetype ('a, 'b, 'c) open_query = ('a, 'b, 'c) Resto.Query.open_query

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

Sourceval query : 'b -> ('a, 'b, 'b) open_query
Sourceval (|+) : ('a, 'b, 'c -> 'd) open_query -> ('a, 'c) field -> ('a, 'b, 'd) open_query
Sourceval seal : ('a, 'b, 'a) open_query -> 'a t
OCaml

Innovation. Community. Security.