Back to browse
GitHub Repository
11 starsRust

sqlc-gen-sqlx, a sqlc plugin for generating sqlx Rust code

by jrandolf·Apr 13, 2026·1 point·2 comments

AI Analysis

●●SolidNiche GemShip It

Bridges sqlc codegen with sqlx runtime for Rust Postgres projects.

Strengths
  • WASM plugin architecture means no fork of sqlc required for integration.
  • Handles transactions and connection pools via generic Queries<E> Rust executor pattern.
  • Handles complex Postgres types like enums, composites, and COPY FROM.
Weaknesses
  • Only four commits suggests early stage; may lack battle testing.
  • Native sqlx macros already solve most type-safe query needs directly.
Target Audience

Rust backend developers using PostgreSQL

Similar To

sqlc · sqlx · diesel

Post Description

`sqlc-gen-sqlx` is a `sqlc` (https://sqlc.dev) plugin that generates `sqlx`-oriented Rust code from annotated SQL queries.

The generated API is intentionally small:

- a `const SQL`

- row structs for `:one` and `:many`

- params structs when a query has multiple parameters

- methods on `Queries<E>` that work with `&PgPool`, `&mut PgConnection`, or `&mut Transaction`

Current scope is PostgreSQL. It supports the usual `sqlc` query annotations, plus enums, composite types, batch queries, `COPY FROM`, `sqlc.slice()`, `sqlc.embed()`, and type overrides.

Similar Projects

Data●●●Banger

LaminarDB – Streaming SQL database in Rust, zero-alloc hot path

Sub-microsecond streaming SQL via zero-alloc hot path; genuine advancement over SQLite+DataFusion.

WizardryNiche GemSolve My Problem
sujitn
613mo ago