Skip to content

Releases: Phundrak/georm

Georm 0.2.1 - Configuration fix for crates.io

10 Jun 10:47
13c7a41

Choose a tag to compare

A maintenance release that updates the version number to 0.2.1.

What's Changed

🔧 Maintenance

  • Version bump: Updated package version to 0.2.1

This release contains no functional changes from 0.2.0. It only contains a fix that allows for publishing on crates.io.

Getting This Release

Update your Cargo.toml:

[dependencies]
georm = "0.2.1"
sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "postgres", "macros"] }

What's Next?

We continue working on upcoming features:

  • Transaction Support (high priority)
  • Composite Key Relationships: Relationship support for entities with composite primary keys
  • Multi-Database Support: MySQL and SQLite support
  • Field-Based Queries: Generate find_by_{field} methods

Full Changelog: 0.2.0...0.2.1

Georm 0.2.0 - Major Feature Release

10 Jun 10:45
fcd0f57

Choose a tag to compare

We're excited to announce Georm 0.2.0, a major release packed with new features, performance improvements, and comprehensive documentation updates! 🚀

What's New

🆕 Major Features

Composite Primary Key Support

  • Multi-field primary keys: Use multiple #[georm(id)] fields to create composite primary keys
  • Auto-generated ID structs: Automatically creates {EntityName}Id structs for type-safe composite key handling
  • Full CRUD support: All operations (find, create, update, delete, create_or_update) work seamlessly with composite keys
#[derive(Georm)]
#[georm(table = "user_roles")]
pub struct UserRole {
    #[georm(id)]
    pub user_id: i32,
    #[georm(id)]
    pub role_id: i32,
    pub assigned_at: chrono::DateTime<chrono::Utc>,
}

// Auto-generated ID struct
let id = UserRoleId { user_id: 1, role_id: 2 };
let user_role = UserRole::find(pool, &id).await?;

Defaultable Fields with Companion Structs

  • Database defaults support: Mark fields with #[georm(defaultable)] for auto-generated or default values
  • Companion struct generation: Creates {Entity}Default structs where defaultable fields become Option<T>
  • Easier entity creation: Simplifies creating entities when some fields have database defaults
#[derive(Georm)]
#[georm(table = "posts")]
pub struct Post {
    #[georm(id, defaultable)]
    pub id: i32,                    // Auto-generated serial
    pub title: String,
    #[georm(defaultable)]
    pub published: bool,            // Database default (false)
    #[georm(defaultable)]
    pub created_at: chrono::DateTime<chrono::Utc>, // DEFAULT NOW()
}

// Use the generated companion struct
let post_default = PostDefault {
    id: None,                       // Let database auto-generate
    title: "My Post".to_string(),
    published: None,                // Use database default
    created_at: None,               // Use database default
};
let created_post = post_default.create(pool).await?;

Foreign One-to-One Relationships

  • Enhanced relationship support: Complete support for one-to-one relationships with foreign keys
  • Automatic method generation: Generates getter methods for related entities

🚀 Performance & Reliability

Atomic Upsert Operations

  • Race condition elimination: Replaced two-query create_or_update with single atomic PostgreSQL upsert
  • Performance improvement: Reduced database round trips from 2-3 queries to 1
  • PostgreSQL ON CONFLICT: Uses native PostgreSQL INSERT ... ON CONFLICT ... DO UPDATE SET for reliability

Modern Rust Support

  • Rust 1.86 & Edition 2024: Updated to the latest Rust version and edition
  • Dependency updates: Updated SQLx to 0.8.6 and other dependencies
  • Security fixes: Updated tokio to address RUSTSEC-2025-0023

📚 Documentation & Examples

Comprehensive Documentation Rewrite

  • Complete README overhaul: Comprehensive guide covering all features with examples
  • Enhanced API documentation: Detailed method documentation with usage patterns
  • Performance characteristics: Documentation of zero-cost abstractions and compile-time guarantees

Real-World Example

  • PostgreSQL example: Full-featured example with user management, comments, and follower relationships
  • Interactive CLI: Demonstrates CRUD operations and relationship handling
  • Database migrations: Complete schema setup and migration examples

🛠️ Developer Experience

Improved Development Environment

  • Devenv migration: Switched from Nix flakes to devenv for better developer experience
  • Modular code organization: Split trait implementations into separate modules by operation type
  • Enhanced tooling: Better IDE support and development workflow

Breaking Changes

⚠️ Important: This release includes breaking changes to the create_or_update method implementation. The method signature remains the same, but the implementation now uses atomic upserts instead of separate find/create/update operations.

Migration Guide

From 0.1.x to 0.2.0

  1. Update your Cargo.toml:
[dependencies]
georm = "0.2.0"
sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "postgres", "macros"] }
  1. Review create_or_update usage: The method now uses atomic upserts, which may have different error handling characteristics.

  2. Consider using defaultable fields: If you have entities with database defaults, consider marking fields with #[georm(defaultable)] for easier creation.

What's Next?

Looking ahead to future releases:

  • Transaction Support (high priority)
  • Composite Key Relationships: Relationship support for entities with composite primary keys
  • Multi-Database Support: MySQL and SQLite support
  • Field-Based Queries: Generate find_by_{field} methods

Acknowledgments

This release represents a significant step forward in Georm's capabilities. Special thanks to the SQLx team for their excellent foundation that makes Georm's compile-time safety possible.


Full Changelog: 0.1.1...0.2.0

Georm 0.1.1 - Documentation Fix

10 Jun 10:40
4ff2df1

Choose a tag to compare

A small patch release to fix documentation links and repository references.

What's Fixed

🔧 Documentation

  • Fixed docs.rs link: Corrected the documentation link to point to the proper docs.rs URL
  • Updated repository references: Switched all references to point to the official GitHub repository

Getting This Release

Update your Cargo.toml:

[dependencies]
georm = "0.1.1"
sqlx = { version = "0.8", features = ["runtime-tokio-rustls", "postgres", "macros"] }

What's Next?

We're continuing work on enhancing Georm's relationship capabilities and performance. Stay tuned for upcoming features like remote one-to-one relationships and query optimizations.


Full Changelog: 0.1.0...0.1.1

Georm 0.1.0 — A new journey begins!

10 Jun 10:38
d82f9fe

Choose a tag to compare

We're excited to announce the first release of Georm, a simple and type-safe ORM for PostgreSQL built on top of SQLx! 🎉

What is Georm?

Georm is a lightweight, opinionated Object-Relational Mapping (ORM) library that provides a clean, type-safe interface for common database operations. It leverages SQLx's compile-time query verification to ensure your database interactions are both safe and efficient.

Features in 0.1.0

✅ Core CRUD Operations

  • Complete Georm trait implementation with all essential database operations:
  • find_all() — Query all records
  • find() — Find by ID
  • create() — Insert new records
  • update() — Update existing records
  • delete() — Remove records
  • delete_by_id() — Remove by ID

✅ Relationship Support

  • Local One-to-One Relationships: When your struct has a foreign key field, Georm automatically generates getter methods to fetch the related entity
  • One-to-Many Relationships: Full support for querying related entities where the foreign key exists in the related table
  • Many-to-Many Relationships: Complete support for complex relationships through junction tables

✅ Type Safety & Performance

  • Compile-time SQL verification using SQLx macros
  • Zero runtime overhead — no reflection or dynamic query building
  • Simple derive macros for easy entity definition

✅ PostgreSQL Native

  • Built specifically for PostgreSQL with full support for its data types
  • Leverages PostgreSQL-specific features and optimizations

Basic Usage

use georm::Georm;

#[derive(Georm)]
#[georm(table = "users")]
pub struct User {
    #[georm(id)]
    pub id: i32,
    pub name: String,
    pub email: String,
}

// All these methods are now available:
let users = User::find_all(&pool).await?;
let user = User::find(&pool, &1).await?;
let new_user = user.create(&pool).await?;

What's Included

  • Comprehensive test suite covering all relationship types
  • CI/CD pipeline with automated testing and quality checks
  • Developer tooling with Nix flakes for reproducible development environment
  • Complete documentation with examples and API reference

Getting Started

Add Georm to your Cargo.toml:

[dependencies]
georm = "0.1.0"
sqlx = { version = "0.8", features = ["runtime-tokio-rustls", "postgres", "macros"] }

Have a look at our README for detailed examples and usage instructions.

What's Next?

This initial release provides a solid foundation for PostgreSQL ORM operations. Future releases will focus on:

  • Remote one-to-one relationships
  • Enhanced relationship querying capabilities
  • Performance optimizations
  • Extended PostgreSQL feature support

Acknowledgments

Built on the excellent SQLx library, Georm aims to provide a simple yet powerful ORM experience for Rust developers working with PostgreSQL.


Full Changelog: https://github.com/Phundrak/georm/commits/0.1.0