anitnilay20 / anitnilay20/beatrix

Complete INSERT operation support for PostgreSQL

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
high-priority postgres query-builder
Dominant language
Rust
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Description
Currently, Beatrix only supports SELECT operations for PostgreSQL. We need to implement INSERT functionality to allow creating new records.

## Requirements
- [ ] Implement INSERT query builder
- [ ] Add INSERT method to Select struct
- [ ] Support batch inserts
- [ ] Handle primary key generation
- [ ] Add proper error handling
- [ ] Write comprehensive tests

## Acceptance Criteria
- User can call `User::insert().values(user).execute(&db)`
- Support for single and batch inserts
- Proper handling of auto-increment fields
- Detailed error messages for constraint violations

## Files to modify
- `beatrix_core/src/relational/insert.rs` (new file)
- `beatrix_core/src/relational/mod.rs`
- `beatrix_macro/src/relational.rs`

## Example Usage
```rust
let user = User { name: "John".to_string(), email: "john@example.com".to_string() };
let result = User::insert().values(user).execute(&db).await?;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.