Skip to main content

Module operations

Module operations 

Source
Expand description

Logical data operations shared by apps and primary-backend implementations. App code supplies validated entity and field names; an adapter owns physical queries, connections, migrations, and durable transaction semantics.

Structs§

ActiveSession
An unrevoked browser session resolved against the caller’s clock.
AggregateQuery
One aggregate against an entity and optional filter.
AppSchema
The app-owned logical schema that every configured backend must implement.
Claim
Atomically selects one matching record and applies its lease or status fields. The adapter returns the selected numeric identity after the update commits.
Entity
One logical entity with declared uniqueness and lookup requirements.
Field
One logical field, independent of a SQL column or document representation.
Index
Indexes may be unique and conditional without embedding vendor SQL.
JoinedQuery
One bounded, backend-neutral join of two declared entities.
JoinedRecord
One join result retains the two entity namespaces to avoid field collisions.
ManagedBusiness
One business visible through an active tenant membership.
Migration
One ordered migration whose checksum must match the committed ledger entry.
Query
A logical read; explicit fields and a bounded page prevent accidental scans.
QueryResultBudget
Bounds one returned page without creating a second serialized copy of its records.
Record
One record in a bounded export page or import batch.
RelatedRowsQuery
Declares one bounded relationship read independently of its configured adapter.
ReservationExpiry
Expiry transition applied before reservation capacity is measured.
SessionExpiry
Validated UTC expiry used by each backend’s native session representation.
SnapshotCollector
Shared keyset pagination and accounting. Adapters must keep every page in the same database read transaction; separate calls to query are insufficient.
SnapshotLimits
Explicit resource bounds for a consistent operator snapshot.
SortKey
One sort key for a bounded read; ascending puts nulls first and descending last. Include a unique identity key to make equal-value paging deterministic.
Transaction
A transaction must commit every step or none, including guard decisions.
TransactionResult
Per-step affected row counts and numeric identities of inserted or ensured records.
UserCredentials
Credentials and account status for shared password verification.

Enums§

Aggregate
Aggregates required by declared summaries and guarded writes.
DatabaseError
Stable failure categories; an unavailable backend never appears as empty data.
FieldConstraint
Portable field checks retained when app SQL migrations become declarative.
FieldDefault
A portable schema default, including database-generated current time.
FieldType
Declared field types. Decimal values use an exact, two-place decimal string.
Identity
A generated numeric key or a declared compound primary key.
IndexKey
A physical index key derived from a declared field.
Mutation
A mutation evaluated as one part of a durable transaction.
OnDelete
Referential action applied when a referenced record is deleted.
Predicate
A bounded, parameterized predicate over declared fields.
SchemaChange
Additive schema changes with a backend-independent migration identity.
WriteValue
A write value can refer to an earlier inserted or ensured record.

Constants§

MAX_TEXT_LENGTH
Maximum declared text length; stored values also obey the one-MiB byte bound.
MAX_TRANSACTION_STEPS
Maximum atomic write steps, independently bounded by the eight-MiB payload limit.

Traits§

DatabaseOperations
Executable logical operations implemented by every registered adapter. App-facing services resolve this operation contract through the configured registry.

Functions§

aggregate_result_kind
Identifies the logical type of an aggregate result for exact decoding.
binary_bytes
Decodes a logical byte array without interpreting ordinary JSON arrays as binary.
bytes_fingerprint
Computes a lowercase SHA-256 fingerprint without retaining source bytes.
canonical_json 🔒
Writes JSON with recursively sorted object keys so migration and replay hashes cannot depend on map insertion order or Serde feature unification.
canonical_json_value
Canonicalizes bounded JSON values so equivalent integral numeric representations and object-key order do not acquire backend-specific equality semantics. Arrays retain their order, and strings never undergo numeric coercion.
canonical_stored_timestamp
Decodes persisted UTC timestamp text without losing fractional seconds. RFC 3339 represents logical timestamps; native UTC date-time storage may omit its zone. Adapters normalize that physical representation at adoption.
canonical_timestamp_boundary
Encodes a whole-second comparison boundary using the canonical storage representation.
decimal_cents
Parses a bounded two-place decimal without floating-point arithmetic. JSON numbers are accepted at the input boundary; storage and reads use canonical strings so adapters cannot silently round monetary values.
decimal_from_cents
Encodes scaled integer storage as the public exact decimal representation.
decode_aggregate_text
Decodes a relational aggregate without guessing a text field’s logical type.
entity
Finds a declared entity without accepting a physical table name from a request.
field_value_type_matches 🔒
generated_index_name
Derives one portable physical index name from a declared logical key.
guard_read_set
Guards a bounded read set while preserving transaction capacity for its writes. Complete identities permit grouped checks; projections without identities use single-row checks.
identity_page
Converts a primary-key cursor to a lexicographic page filter and ordering. Composite cursors carry every key field in one JSON object.
materialize_generated_predicate
Replaces transaction-local identity references with identities produced by earlier steps.
normalize_stored_record
Returns canonical typed values from an already-loaded projection without I/O.
numeric_constraint_value 🔒
Converts a typed numeric constraint operand to its exact comparison unit.
operation_fingerprint
Computes a stable SHA-256 fingerprint for a serialized logical operation.
query_related_rows
Reads a bounded relationship set using the contract’s operand and result limits. Duplicate keys are removed before paging; no vendor query escapes the operation interface.
replace_resource_marker 🔒
Replaces only declared resource keys within bounded JSON nesting.
reservation_expiry_filter
Combines reservation scope and expiry eligibility identically for every adapter.
resolve_field_write
Resolves transaction-local expressions and validates the resulting field value before a physical adapter binds it. Template admission alone cannot certify the size or constraints of the generated result.
resolve_write_value
Resolves generated references uniformly before any adapter binds parameters. JSON replacement matches the full declared resource marker, never substrings.
stored_session_expiry_epoch
Returns the first whole second at which an exact stored session expiry has passed.
valid_app_identifier 🔒
Keeps app declarations separate from adapter metadata and derived storage keys.
valid_identifier
Accepts a name only if it is a bounded, portable identifier.
valid_tenant_role
Accepts a bounded tenant role identifier without interpreting its authority.
validate_claim
Validates a bounded claim and its deterministic selection order.
validate_copy_field
Validates a historical field copy before any backend updates existing records.
validate_field_value
Checks a logical value before any adapter can map it to a driver parameter.
validate_generated_predicate_steps 🔒
Rejects an identity reference unless an earlier transaction step produces it.
validate_json_value
Validates JSON depth, node count and encoded size without copying the value tree.
validate_managed_business_read
Bounds one managed-business read before any adapter executes a query.
validate_password_hash_update
Bounds a pre-hashed credential update before an adapter opens a connection.
validate_predicate
Validates a nested predicate against one declared entity and a fixed depth bound.
validate_query
Validates one bounded query before lowering it to a backend operation.
validate_rate_limit_event
Enforces audit row bounds without interpreting user input as query syntax.
validate_rate_limit_request
Enforces the same bounded security keys before any adapter touches storage.
validate_schema
Validates the logical schema before an adapter can execute it.
validate_session_issue
Validates session input and preserves the exact expiry instant.
validate_session_lookup
Reject malformed or unbounded session lookups before reaching a backend.
validate_stored_record
Validates a projected stored record against the same typed contract as writes. Malformed persisted values indicate storage corruption, not invalid user input. This operates on already-loaded rows and performs no additional database reads.
validate_transaction
Validates a write transaction without exposing a backend statement surface.
validate_username_lookup
validate_value 🔒