Fixes#210
This commit adds the Returning method to both UpdateBuilder and DeleteBuilder,
following the same implementation pattern as InsertBuilder.
Changes:
- Add returning field to UpdateBuilder and DeleteBuilder structs
- Add updateMarkerAfterReturning and deleteMarkerAfterReturning markers
- Implement Returning methods for both builders
- Add RETURNING clause support for PostgreSQL and SQLite flavors
- Add comprehensive test coverage including:
- Basic functionality tests
- Flavor-specific behavior tests
- Edge cases (empty, single, multiple columns)
- Complex scenarios (ORDER BY, LIMIT, CTE)
- SQL injection compatibility
- Method chaining validation
The RETURNING clause is properly positioned after LIMIT and is ignored
for database flavors that don't support it (MySQL, SQL Server, CQL,
ClickHouse, Presto).
Example usage:
ub := Update("users").Set("name = ?", "John").Where("id = ?", 1).Returning("id", "updated_at")
db := DeleteFrom("users").Where("status = ?", "inactive").Returning("id", "deleted_at")
All builders add a new method called SQL to enable us to add any
arbitrary SQL when building. It's quite useful when we are using some
kinds of extension syntax or add special comments in SQL.