interface BigtableRowKeyMapping
Since 0.2.0

How an entity's logical fields compose its single row key.

Bigtable's row key is one lexicographically-sorted string, and composing it from several logical fields is the platform's standard practice. That is a MAPPING concern rather than the composite-key CONTRACT concern M79 added: the repository still addresses a row by an EntityKey, and this decides how that key becomes bytes.

Examples

Example 1

const rowKey = { fields: ['tenantId', 'userId'], separator: '#', prefix: 'u/' };
// findById({ tenantId: 't1', userId: 'u2' }) reads row key 'u/t1#u2'

Properties

readonly
fields: readonly string[]

The logical fields the row key is composed from, in order. The order is load-bearing: it is both the byte order the key sorts in and the order the portable cursor carries key values in.

readonly
optional
separator: string

The separator joining the fields. Defaults to '#'. Ignored for a single-field key, which is the field's own string form.

readonly
optional
prefix: string

A constant prefix prepended to every row key of this entity.

Usage

import { type BigtableRowKeyMapping } from "database-plugin/src/index.ts";