Skip to content

Feat/db interface slim - #96

Open
godronus wants to merge 13 commits into
mainfrom
feat/db-interface-slim
Open

godronus wants to merge 13 commits into
mainfrom
feat/db-interface-slim

Conversation

@godronus

@godronus godronus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

No Postgres wrapper

Meta.plan was required, so a row inserted with only id and email (meta defaults to '{}')
made GET / fail with a decode error. plan is optional and still serialises as {}, matching
the JS example's response.
wit submodule -> FastEdge-wit e41118a. Same API; example db_sql renamed
to db_postgres.
…the WIT

wit → FastEdge-wit a23194c. Column.type_name replaces type_oid; example db_sql_postgres
(named after its dialect). Secret FASTEDGE_DB_SQL_<name>.
Copilot AI balanced review requested due to automatic review settings November 6, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Invalid input in the PostgreSQL example causes a handler failure instead of HTTP 400, and generated documentation is missing the new database API coverage.

2 open issues
What changed in this PR

Adds a thin database interface to the FastEdge Rust SDK for host-managed SQL and key-value bindings, without a PostgreSQL-specific wrapper.

Changes:

  • Exposes generated database APIs with SQL parameter helpers and optional typed row decoding.
  • Adds WASI HTTP examples for PostgreSQL queries and KV-based rate limiting.
  • Extends the json feature with Serde and records the API design decisions.
File Description
src/​lib.rs Generates database bindings and exports db.
src/​db.rs Adds SQL/KV APIs, parameter helpers, and typed decoding.
examples/​README.md Lists both database examples.
examples/​http/​wasi/​db_sql_postgres/​src/​lib.rs Demonstrates parameterized queries and typed results.
examples/​http/​wasi/​db_sql_postgres/​schema.sql Provides the example schema and seed data.
examples/​http/​wasi/​db_sql_postgres/​README.md Documents SQL setup and usage.
examples/​http/​wasi/​db_sql_postgres/​Cargo.toml Declares SQL example dependencies.
examples/​http/​wasi/​db_sql_postgres/​Cargo.lock Locks SQL example dependencies.
examples/​http/​wasi/​db_kv/​src/​lib.rs Demonstrates batched rate-limit and visit counters.
examples/​http/​wasi/​db_kv/​README.md Documents KV setup and usage.
examples/​http/​wasi/​db_kv/​Cargo.toml Declares KV example dependencies.
examples/​http/​wasi/​db_kv/​Cargo.lock Locks KV example dependencies.
context/​CHANGELOG.md Records database integration decisions.
Cargo.toml Adds optional Serde to the json feature.
Cargo.lock Records the SDK’s Serde dependency.

Review effort: Balanced

.query()
.and_then(|q| q.split('&').find_map(|kv| kv.strip_prefix("id=")))
.map(str::parse::<i64>)
.transpose()?;
Comment thread src/lib.rs
Comment on lines +420 to +421
/// Customer-owned databases bound to the app by name (`gcore:db`).
pub mod db;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants