aboutsummaryrefslogtreecommitdiff
path: root/lib/models/id/channel_id_t.ml
diff options
context:
space:
mode:
authorMatias Goldfeld <[email protected]>2021-01-29 13:40:29 -0500
committerMatias Goldfeld <[email protected]>2021-01-29 13:40:29 -0500
commit7ad203a0249bd9db50dfb1df4adb9b7483406e30 (patch)
tree52696cb3e1c16a84513fb90fe50c3738ce4539cb /lib/models/id/channel_id_t.ml
parentStarted conversion to ppx_yojson_conv (diff)
downloaddisml-7ad203a0249bd9db50dfb1df4adb9b7483406e30.tar.xz
disml-7ad203a0249bd9db50dfb1df4adb9b7483406e30.zip
Revert "Started conversion to ppx_yojson_conv"
This reverts commit c937240fdd2036edd493debb76117165e4084e8b.
Diffstat (limited to 'lib/models/id/channel_id_t.ml')
-rw-r--r--lib/models/id/channel_id_t.ml10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/models/id/channel_id_t.ml b/lib/models/id/channel_id_t.ml
index 74588b1..c6b80ec 100644
--- a/lib/models/id/channel_id_t.ml
+++ b/lib/models/id/channel_id_t.ml
@@ -1,7 +1,15 @@
open Core
-type t = [ `Channel_id of Snowflake.t ] [@@deriving sexp, yojson]
+type t = [ `Channel_id of Snowflake.t ] [@@deriving sexp]
let compare (`Channel_id t) (`Channel_id t') = Int64.compare t t'
+let of_yojson a : (t, string) result =
+ match Snowflake.of_yojson a with
+ | Ok id -> Ok (`Channel_id id)
+ | Error err -> Error err
+
+let of_yojson_exn a : t = `Channel_id (Snowflake.of_yojson_exn a)
+let to_yojson (`Channel_id id) = (Snowflake.to_yojson id)
+
let get_id (`Channel_id id) = id \ No newline at end of file