sqlx-types

Map Postgres column types to Rust types for SQLx applications.

Updated May 26, 2026
One-click install
npx skills add https://github.com/adelabdelgawad/rust-fullstack-agents --skill sqlx-types
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sqlx-types
Source: https://github.com/adelabdelgawad/rust-fullstack-agents/tree/main/plugins/rusty/skills/sqlx-types
Command: npx skills add https://github.com/adelabdelgawad/rust-fullstack-agents --skill sqlx-types

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automatically align Postgres column types with safe, idiomatic Rust types in SQLx, preventing runtime type mismatches and cryptic errors.

Core Features & Use Cases

  • Pattern-driven mappings for common Postgres types to Rust equivalents.
  • Guidance for enabling sqlx features (uuid, chrono, json, rust_decimal) and using sqlx::Type derives and Json<T> wrappers.
  • Use cases include deriving sqlx::FromRow, mapping UUIDs, timestamps, JSONB, and numeric types.

Quick Start

Add sqlx features to Cargo.toml and derive FromRow on your structs to begin mapping Postgres types.

Frequently Asked Questions about sqlx-types

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I map Postgres types to Rust types in sqlx without runtime errors?▼

Map Postgres types to Rust types in sqlx by deriving FromRow on your structs and enabling the correct Cargo.toml features. This pattern-driven approach aligns UUIDs, timestamps, and JSONB with idiomatic Rust types to prevent type mismatches.

What sqlx features do I need to enable for Postgres UUID and JSONB columns?▼

To handle Postgres UUID and JSONB columns in sqlx, enable the uuid and json features in your Cargo.toml. You must also use the Json<T> wrapper for JSONB data to ensure accurate type-safety and decoding.

How does sqlx handle Postgres numeric and decimal types in Rust?▼

Sqlx handles Postgres numeric and decimal types by mapping them to Rust types using the rust_decimal crate. Enable the rust_decimal feature in Cargo.toml to ensure correct, lossless numeric mapping.

Why does my sqlx FromRow derive fail to map custom Postgres types?▼

Your sqlx FromRow derive fails to map custom Postgres types because you need to implement the sqlx::Type wrapper. Deriving sqlx::Type ensures your custom Rust structs correctly decode from their corresponding Postgres column types.

Can I use chrono for Postgres timestamp mapping in sqlx?▼

Yes, you can use chrono for Postgres timestamp mapping in sqlx by enabling the chrono feature in Cargo.toml. This allows accurate, type-safe conversion of timestamp and timestamptz columns into chrono Rust types.

What is the best way to prevent cryptic sqlx type mismatch errors with Postgres?▼

The best way to prevent cryptic sqlx type mismatch errors is to strictly align Postgres column types with their exact Rust equivalents using sqlx::Type and Json<T> wrappers. Enabling the appropriate Cargo.toml features ensures correct type decoding.