Skip to main content

Module peek

Module peek 

Source
Expand description

#3147: D1.peek(<participant>.<Cap>), the case-only handle on a participant’s test D1 database.

A system (or integration) case drives the whole deployable app through its real boundaries, so it cannot name a capability. D1.peek is the one built-in that reaches behind them, and only to read: the handle offers all, first, select[T] and firstAs[T], with the capability’s own signatures, and the SQL of each is checked against the migrations’ schema like any other D1 call. A write is refused: by operation here, and by the prepared statement’s readonly flag in crate::d1_sql (and at run time).

The handle is a case-local value, bound by let (let db = D1.peek(shop.orders.Orders), bynk.test.peek_not_bound otherwise), whose only use is as the receiver of those four operations.

Structs§

PeekCap
One capability of a participant: its signatures, and for a D1 instance the Worker binding its database is on.
PeekEnv
The capabilities a case can peek: each participant’s own, by participant name. Present only while checking an integration or system case.

Constants§

LOCAL_PREFIX
Whether cap is the name of a peeked capability on deps (see local_name), as a call on a handle records it.