Skip to main content

encode_key

Function encode_key 

Source
pub fn encode_key(values: &[Value]) -> Key
Expand description

Encodes a composite key from multiple values.

Each value is tagged and encoded to enable unambiguous decoding and to preserve lexicographic ordering.

§Encoding Format

For each value:

  • 1 byte: Type tag (0x00=Null, 0x01=BigInt, 0x02=Text, 0x03=Boolean, 0x04=Timestamp, 0x05=Bytes, 0x06=Integer, 0x07=SmallInt, 0x08=TinyInt, 0x09=Real, 0x0A=Decimal, 0x0B=Uuid, 0x0C=Json, 0x0D=Date, 0x0E=Time)
  • Variable: Encoded value

For variable-length types (Text, Bytes):

  • N bytes: Data with embedded nulls escaped as 0x00 0xFF
  • 1 byte: Terminator 0x00

§Panics

Panics if the value is a Placeholder or Json (JSON is not indexable).