Skip to content

Conversation

@rmarronnier
Copy link

DISCLAIMER : this PR is the result of a generic prompt to Claude Code for improvements or new features with associated specs. I'm not qualified to decide if this has any value to be merged. In case it has no direct or indirect value, I humbly present my apologies for spamming your repo and I promise to not bother you again.

Claude code suggestions :

I've successfully analyzed the crystal-pg codebase and implemented several missing features:

  1. Network Types Support (✓ Completed)
  • Added PG::Network::Inet, PG::Network::Cidr, PG::Network::MacAddr, and PG::Network::MacAddr8 types
  • Implemented decoders for PostgreSQL network types (OIDs: 869, 650, 829, 774)
  • Added parameter encoding support for all network types
  • Created comprehensive test specifications
  1. Range Types Support (✓ Completed)
  • Added generic PG::Range(T) type with support for bounded/unbounded and inclusive/exclusive ranges
  • Implemented decoders for all PostgreSQL range types:
    • Int4Range (int4range)
    • Int8Range (int8range)
    • NumRange (numrange)
    • TsRange (tsrange)
    • TsTzRange (tstzrange)
    • DateRange (daterange)
  • Added parameter encoding support
  • Created tests accounting for PostgreSQL's range canonicalization
  1. Cursor Support (✓ Completed)
  • Added PG::Cursor class for fetching query results in batches
  • Implemented cursor operations:
    • fetch(count) - Fetch a batch of rows
    • fetch_all - Fetch all remaining rows
    • move(offset) - Move cursor position
    • move_absolute, move_first, move_last - Absolute positioning
  • Added transaction status tracking to PQ::Connection
  • Supports both simple and parameterized queries
  • Automatic transaction management

Additional Improvements Made:

  • Added equality operator to PG::Numeric for proper comparisons
  • Updated PGValue type alias to include all new types
  • Added proper Crystal 1.x compatibility fixes

@jwoertink
Copy link
Contributor

I would love having that cursor support in 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants