v icon indicating copy to clipboard operation
v copied to clipboard

V ORM: Missing features master issue

Open watzon opened this issue 5 months ago • 4 comments

Description

The V ORM currently provides basic CRUD operations but lacks many features that are standard in modern ORMs. This master issue tracks all the improvements needed to make V's ORM production-ready and competitive with established solutions.

This roadmap is based on a comprehensive audit comparing V's ORM implementation with mature ORMs, identifying critical missing features, architectural limitations, and areas for improvement.

Overview

The V ORM has a solid foundation with:

  • Basic CRUD operations
  • Multi-database support (SQLite, MySQL, PostgreSQL)
  • Type-safe queries through compiler integration
  • Two API styles (SQL syntax and functional)

However, it currently lacks essential features for production use, including transactions, advanced queries, and proper connection management.

Feature Implementation Checklist

🔴 Critical Priority

SQL Query Features

  • [ ] JOIN Operations (see #21635)
    • [ ] INNER JOIN
    • [ ] LEFT JOIN
    • [ ] RIGHT JOIN
    • [ ] FULL OUTER JOIN
  • [ ] Aggregate Functions
    • [ ] SUM
    • [ ] AVG
    • [ ] MIN
    • [ ] MAX
    • [ ] Custom aggregates
  • [ ] GROUP BY and HAVING clauses
  • [ ] DISTINCT support
  • [ ] Subqueries
  • [ ] Raw SQL query support
  • [ ] UNION/INTERSECT/EXCEPT operations

Transaction Management

  • [ ] ORM-level transaction API
  • [ ] Automatic rollback on errors
  • [ ] Nested transactions/savepoints
  • [ ] Transaction isolation levels
  • [ ] Batch operations within transactions

🟡 High Priority

Connection Management

  • [ ] Connection pooling for all databases (MySQL has basic implementation)
    • [ ] SQLite connection pool
    • [ ] PostgreSQL connection pool
  • [ ] Connection lifecycle management
  • [ ] Connection retry logic
  • [ ] Connection health checks
  • [ ] Read/write splitting for replicas

Advanced Operations

  • [ ] UPSERT support (see #23957)
  • [ ] Bulk insert optimization
  • [ ] Bulk update operations
  • [ ] Prepared statement reuse

Relationship Handling

  • [ ] Explicit preload/eager loading (see #21635)
  • [ ] Lazy loading strategies
  • [ ] Many-to-many relationships
  • [ ] Self-referential relationships
  • [ ] Polymorphic relationships
  • [ ] Cascade operations (DELETE, UPDATE)

🟢 Medium Priority

Developer Experience

  • [ ] Query logging and debugging
  • [ ] Better error messages
  • [ ] Rails-style model updates (see #22531)
  • [ ] Query builder with method chaining
  • [ ] Model mixins/traits

Schema Features

  • [ ] Table and column comments (see #19354)
  • [ ] Composite primary keys
  • [ ] Composite indexes
  • [ ] Partial indexes
  • [ ] CHECK constraints
  • [ ] Database views support

Data Validation

  • [ ] Field validation framework
  • [ ] Custom validators
  • [ ] Validation hooks
  • [ ] Constraint validation messages

🔵 Nice to Have

Advanced Features

  • [ ] Soft deletes
  • [ ] Query result caching
  • [ ] Event hooks/signals system
    • [ ] Pre-save/post-save
    • [ ] Pre-delete/post-delete
  • [ ] Audit logging
  • [ ] Full-text search integration
  • [ ] JSON field operations
  • [ ] UUID primary keys
  • [ ] Encrypted fields
  • [ ] Temporal tables/versioning

Parser/Language Features

  • [ ] ORM expressions in if statements (see #23680)
  • [ ] More flexible SQL syntax parsing

Related Issues

  • #21635 - Add explicit preload/join feature to ORM
  • #23957 - Add upsert sql method in orm
  • #19354 - ORM need to support comments
  • #22531 - Add rails style updates for ORM Struct
  • #22797 - ORM: support h2database
  • #23680 - Cannot use ORM as a value in if expressions

[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

watzon avatar Jul 19 '25 17:07 watzon

Connected to Huly®: V_0.6-23400

huly-for-github[bot] avatar Jul 19 '25 17:07 huly-for-github[bot]

One quick note... V recently got the pool module, which should take care of your "Connection Pooling" section. If it doesn't, it needs to be fixed, since that's what it is for.

If the ORM doesn't support it (I don't think it does, yet), then it's just a matter of making them work together.

JalonSolov avatar Jul 19 '25 17:07 JalonSolov

Thanks for that @JalonSolov! I will look into whether they work correctly together or not, and if they do, I'll go ahead and remove that.

watzon avatar Jul 19 '25 21:07 watzon

One quick note... V recently got the pool module, which should take care of your "Connection Pooling" section. If it doesn't, it needs to be fixed, since that's what it is for.

If the ORM doesn't support it (I don't think it does, yet), then it's just a matter of making them work together.

In Linux, the pool as a database connection pool is already available.

Avey777 avatar Aug 03 '25 23:08 Avey777