Skip to main content

windowKey

@forge/monorepo


@forge/monorepo / backend/src / windowKey

Function: windowKey()

windowKey(window): string

Defined in: backend/src/persistence/index.ts:616

A window as one storable string, and back — #181.

usage_limits keys its unique indexes on this single column, so the two kinds of window have to share one value space. A calendar window is its own period; a rolling one is rolling:<minutes>. Both spellings are pinned by the table's CHECK constraint, so a value that would not round-trip cannot be stored in the first place.

The codec lives here, beside the type, rather than in each adapter: two adapters spelling a key differently is two stores that cannot read each other's rows, and conformance would pass because each is self-consistent.

Parameters

window

QuotaWindow

Returns

string