diff options
Diffstat (limited to 'lib/serializer.ml')
-rw-r--r-- | lib/serializer.ml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/serializer.ml b/lib/serializer.ml new file mode 100644 index 0000000..35464ac --- /dev/null +++ b/lib/serializer.ml @@ -0,0 +1,16 @@ +let transaction (t : Operation.transaction) = + let transaction_type = + match t.transaction_type with + | `Credit -> "c" + | `Debit -> "d" + in + `Assoc + [ "valor", `Int t.value + ; "tipo", `String transaction_type + ; "descricao", `String t.description + ; ( "realizada_em" + , `String + (Format.asprintf "%a" (Ptime.pp_rfc3339 ~tz_offset_s:(-10800) ()) t.created_at) + ) + ] +;; |