Numeric Entity IDs Across Rust, Java, Go, Python, SQL, and JSON
· 6 min read
An entity ID looks like a small implementation detail until the same value has to survive a database join, a Rust service, a Java service, a Go worker, a Python script, and a browser. Each environment can represent a different set of integers, and accepting the widest type in one layer can make the whole system less portable.
TeaQL therefore separates three decisions:
- persistence identities and foreign keys are compact numeric values;
- their portable persisted range is the positive signed 64-bit range;
- IDs crossing a JSON boundary are encoded as decimal strings.
The range is enormous for an identity space, but small enough to have a direct, unambiguous representation in the database and in the major server languages TeaQL supports.
