package granary

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Granary_encoding.Index_keySource

Order-preserving encoding of SQL values for use as B+-tree index keys. Encoded bytes compare correctly under Bytes.compare for all supported types. NULL sorts before all non-null values. Type ordering: NULL < INTEGER < REAL < TEXT < BLOB

Sourcetype value =
  1. | IK_null
  2. | IK_int of int64
  3. | IK_real of float
  4. | IK_text of string
  5. | IK_blob of bytes
Sourceval encode_value : value -> bytes

Encode a single value. Result is order-preserving under Bytes.compare.

Sourceval encode : value list -> rowid:int64 -> bytes

Encode a multi-column key with a rowid suffix. Result: concat of encode_value for each column + rowid suffix (8 bytes).

Sourceval decode : bytes -> (value list * int64, string) result

Decode a key produced by encode. Returns (column_values, rowid).