Skip to content

Latest commit

 

History

History
41 lines (35 loc) · 1.54 KB

File metadata and controls

41 lines (35 loc) · 1.54 KB

Kind

We support a specific set of Kinds:

  • '_': Void (also Null or Unit)
  • 'i': Elem (a list element)
  • 't': True
  • 'f': False
  • 'x': Bytes (Bytes)
  • '"': String (String)
  • '-': Int (Int64)
  • '.': Float64 (Float64)
  • '/': Decimal (String)
  • '9': Nanoseconds (Int64) (used for duration and time)
  • 'z': Date Time ISO 8601 (String)
  • '#': Custom Tag (String)

Survey

The decision was made by making a survey of the most common serialization formats. We found that a limited amount of scalar types need to be supported:

SurveyedSupported as
Null/Void/UnitKind
BoolKind
StringString
BytesBytes
Int64Int64
Float64Float64
DecimalString (TODO: What is that exact string format)
Uint64Int64 (if in range) or fallback to String (if out of int64 range, same as decimal)
DateString: yyyy-mm-dd (ISO 8601)
TimeInt64 (nanoseconds since January 1, 1970 UTC) or fallback to String (RFC 3339)
DurationInt64 (nanoseconds)
UUIDBytes (16 bytes)
EnumString (the string representation of the Enum) or fallback to Int64

Types can be mapped from rarer types to these supported types. For example, UUID is mapped to Bytes and Dates to String via RFC 3339.