File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 6060 ULIDGenerator * = ref object
6161 # # A `ULID` generator object, contains details needed to follow the spec.
6262 # # A generator was made to be compliant with the ULID spec and also to be
63- # # threadsafe not use globals that could change .
63+ # # threadsafe.
6464 when NoLocks :
6565 lastTime: int64 # Timestamp of last ULID, 48 bits
6666 when not defined (js):
@@ -330,9 +330,12 @@ func `$`*(ulid: ULID): string =
330330 result = JsBigInt .encode (ulid.toInt128 (), 26 )
331331
332332# std/json support
333- proc `%` * (u: ULID ): JsonNode = newJString ($ u)
333+ proc `%` * (u: ULID ): JsonNode =
334+ # # Serializes a `ULID` to JSON.
335+ newJString ($ u)
334336
335337proc to * (j: JsonNode , _: typedesc [ULID ]): ULID =
338+ # # Deserializes a `ULID` from JSON.
336339 if j.kind != JString :
337340 raise newException (JsonKindError , " Expected a string!" )
338341
You can’t perform that action at this time.
0 commit comments