ids/typeid
Module for generating TypeIDs.
Functions
pub fn decode(tid: String) -> Result(#(String, String), String)
Decode a TypeID into a tuple of #(prefix, uuid)
Usage
decode("user_01hz7c1d2bfkhb31sf10t9qtns") // Ok(#("user", "018fcec0-b44b-7ce2-b187-2f08349beab9"))
pub fn from_uuid(
prefix prefix: String,
uuid uuid: String,
) -> Result(String, String)
Generate a TypeID using the supplied prefix and UUID. Prefix may be an empty string.
Usage
from_uuid("user", "018fcec0-b44b-7ce2-b187-2f08349beab9") // Ok("user_01hz7c1d2bfkhb31sf10t9qtns")