sqlx-mapping

Crates.iosqlx-mapping
lib.rssqlx-mapping
version0.1.4
created_at2025-08-20 01:40:54.055206+00
updated_at2025-09-05 10:24:13.594089+00
descriptionA tool for automatically generating Rust structs and CRUD functions from PostgreSQL tables
homepage
repositoryhttps://github.com/yymm120/any-creator
max_upload_size
id1802766
size15,095,115
allen (yymm120)

documentation

README

✨ sqlx-mapping ✨

PostgreSQL to Rust Code Generator

Crates.io License CI

Only support Postgres

Unstable!

Unstable!

Unstable!

The tool is currently unstable

🚀 Features

Feature Description
Instant Models Generate Rust structs
🔄 Full CRUD Generate Rust Simple CRUD operations

📦 Installation

cargo install sqlx-mapping

🏁 Quick Start

# 1. Set connection (or use --db parameter)
export DATABASE_URL="postgresql://user:password@localhost:5432/db_name"

sqlx-mapping map --output examples/model/pg --watch

sqlx-mapping map --output examples/model/pg --watch -m

sqlx-mapping map --output examples/model/pg --watch --crud

📜 Command Reference

Usage: sm map [OPTIONS]

Options:
  -w, --watch            watch mode
  -m, --model            mapping struct model
  -c, --create           mapping create sql function
  -r, --retrieve         mapping retrieve sql function
  -u, --update           mapping update sql function
  -d, --delete           mapping delete sql function
      --crud             mapping all (create/retrieve/update/delete) sql function
      --db <DB>          specify DATABASE_URL. etc.: postgres://user:password@localhost/postgres
      --output <OUTPUT>  specify where to write [default: src/model/pg]
  -h, --help             Print help
Commit count: 0

cargo fmt