Skip to content

Commit

Permalink
runtime: url query enc/dec for float
Browse files Browse the repository at this point in the history
  • Loading branch information
andreypopp committed May 25, 2024
1 parent 0e8383b commit 5ecf4af
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions native/runtime/ppx_deriving_router_primitives.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ let string_of_url_query k xs =
| None -> Error "missing value"
| Some x -> Ok x)

let float_to_url_query k x = [ k, string_of_float x ]

let float_of_url_query k xs =
last_wins k xs (function
| None -> Error "missing value"
| Some x -> (
match float_of_string_opt x with
| None -> Error "not a float value"
| Some x -> Ok x))

let int_to_url_query k x = [ k, string_of_int x ]

let int_of_url_query k xs =
Expand Down

0 comments on commit 5ecf4af

Please sign in to comment.