Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The example’s {} metadata default lacks the required plan field, causing reads of otherwise valid inserts to return 500 errors, and generated documentation for the public API changes is missing.
2 open issues
What changed in this PR
Adds PostgreSQL access to the FastEdge Rust SDK through named database bindings, with credentials managed by the host.
Changes:
- Exposes
fastedge::db::sql, SQL parameter helpers, and typed row decoding behind thejsonfeature. - Adds a WASI HTTP example with schema, sample data, and setup instructions.
- Updates dependencies and records implementation decisions and follow-up work.
| File | Description |
|---|---|
src/lib.rs |
Configures SQL bindings and exposes the database module. |
src/db.rs |
Adds SQL types, parameter conversion, and typed queries. |
examples/README.md |
Lists the new database example. |
examples/http/wasi/db_sql/src/lib.rs |
Demonstrates querying users and returning JSON responses. |
examples/http/wasi/db_sql/schema.sql |
Defines the example table and seed data. |
examples/http/wasi/db_sql/README.md |
Documents setup, usage, errors, and build commands. |
examples/http/wasi/db_sql/Cargo.toml |
Declares the example and its dependencies. |
examples/http/wasi/db_sql/Cargo.lock |
Locks example dependencies. |
context/CHANGELOG.md |
Records database integration decisions and follow-ups. |
Cargo.toml |
Adds optional Serde support to the json feature. |
Cargo.lock |
Records the SDK’s direct Serde dependency. |
Review effort: Balanced
| email text not null unique, | ||
| nickname text, | ||
| created timestamptz not null default now(), | ||
| meta jsonb not null default '{}' |
Comment on lines
+415
to
+416
| /// Customer-owned databases bound to the app by name (`gcore:db`). | ||
| pub mod db; |
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
fastedge::db::sql: Rust API for thegcore:db/sql-syncinterface (customer-owned Postgres bound to the app by name; Neon first).src/db.rs: re-exportsDatabase,Value,QueryResult,Error, ...;ToSql+params![...]for plain Rust parameters (bool,i32,i64,f64,&str/String,Vec<u8>,Option<T>)jsonfeature:QueryAs::query_as::<T>()/rows_as()decode rows into anyserde::Deserializetype by column name (non-finite floats stay strings so they fail to decode rather than read asnull)src/lib.rs:generate!also generatesgcore:db/sql-types+sql-syncwitsubmodule → G-Core/FastEdge-witfeat/db-interfaceexamples/http/wasi/db_sql(wstd), mirrors the JS example (same table, routes, responses)Calls block (sync interface). Rust stays on
sql-sync; the async interface (separate PR in FastEdge-wit / FastEdge / sdk-js) targets JS.Decisions needed
fastedge::db::sql(mirrorsgcore:db/sql*); KV later asfastedge::db::kv, apart fromfastedge::key_value(Edge Storage)jsonfeature (pulls optionalserde), not a new featurewstd's reactor if the async interface shipsMerge / release
main).gcore:dbwhen they use it.Testing
cargo build --all-features; example built forwasm32-wasip2and run onfastedge-runagainst Neon (list, by id, 404, missing binding →NoSuchDatabase).Related: G-Core/FastEdge#659, G-Core/FastEdge-wit#8, G-Core/FastEdge-sdk-js#155