typeid-go icon indicating copy to clipboard operation
typeid-go copied to clipboard

Define binary representation for TypeIDs and implement binary marshaling

Open loreto opened this issue 2 years ago • 0 comments

As suggested in https://github.com/jetpack-io/typeid-go/issues/4, typeids could implement the encoding.BinaryMarshaler and encoding.BinaryUnmarshaler interfaces.

To do so, we would first have to define in the spec the standard binary representation for typeids. Options include:

  • Re-use the string representation and encoded in UTF-8
  • Instead of encoding the prefix as the bytes of a base32 string, be more efficient by using the "raw" 128-bit representation of the UUID. A follow up question would be how to distinguish between the prefix and suffix fields in the binary representation (use a separator? include an integer indicating the length of the prefix?)

loreto avatar Jul 12 '23 15:07 loreto