Skip to main content

Crate sqlx_cloudflare_core

Crate sqlx_cloudflare_core 

Source
Expand description

The shared internals of the sqlx-cloudflare drivers.

You want sqlx-cloudflare-d1 or sqlx-cloudflare-do instead. Both are SQLite behind a JavaScript API, so they share what this crate holds:

  • the value model – Value, bound and read alike, and TypeInfo – and the ±(2^53 − 1) rule JavaScript numbers impose on integers;
  • the Type, Encode and Decode impls, written into each driver by impl_types!;
  • the conversion to and from JavaScript values (js);
  • DatabaseError, read from SQLite’s message text;
  • QueryResult, BatchResult and the typing of a result’s columns (rows).

What a driver keeps for itself is the part the orphan rule will not let it share: its Database type and the row, column, value and arguments types whose sqlx traits name it.

This API serves those drivers and carries no stability promise of its own.

Modules§

js
The conversions between JavaScript values and this crate’s.

Macros§

impl_types
Writes Type, Encode and Decode for the Rust types these backends can store, for the driver’s database type $db.

Structs§

BatchResult
What one statement of a batch did, and the rows it returned.
DatabaseError
An error the database returned for a statement.
QueryResult
What a statement did.

Enums§

TypeInfo
The storage class of a single value, which is all these backends report.
Value
One SQLite value on the Rust side of the JavaScript boundary, in either direction: a parameter a query binds, or a value a result row holds.

Constants§

MAX_SAFE_INTEGER
The largest integer a JavaScript number holds exactly: 2^53 − 1. Number.MAX_SAFE_INTEGER, in other words.

Traits§

AsValue
The Value behind a driver’s ValueRef, which is what the Decode impls impl_types! writes read from.

Functions§

add_argument
Encodes value onto values, as one placeholder’s worth.
rows
The rows of one result, from its column names and its rows of values.
safe_integer
value, if a JavaScript number can carry it without rounding.