Skip to content

Conversation

@m4tx
Copy link
Member

@m4tx m4tx commented Nov 6, 2025

No description provided.

@m4tx m4tx requested review from Copilot and seqre November 6, 2025 23:45
@github-actions github-actions bot added the C-lib Crate: cot (main library crate) label Nov 6, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements bulk insert functionality for the database layer, providing significant performance improvements for inserting multiple model instances. The implementation includes support for all database backends (PostgreSQL, MySQL, SQLite) with appropriate optimizations for each.

  • Added bulk_create method to the Model trait and corresponding bulk_insert/bulk_insert_or_update methods to the database backend
  • Implemented smart batching based on database parameter limits (32,766 for SQLite, 65,535 for PostgreSQL/MySQL)
  • Comprehensive test coverage including edge cases (empty input, large batches, models with only auto fields, fixed primary keys)

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
cot/src/db.rs Implements bulk insert functionality with database-specific optimizations, adds new error types for bulk operations, and provides both insert and upsert variants
cot/tests/db.rs Adds 5 comprehensive test cases covering basic functionality, empty input handling, large batch processing, edge cases with auto-only fields, and fixed primary key scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

🐰 Bencher Report

Branchbulk-create
Testbedgithub-ubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
empty_router/empty_router📈 view plot
🚷 view threshold
6,117.00 µs
(+0.69%)Baseline: 6,075.03 µs
6,676.54 µs
(91.62%)
json_api/json_api📈 view plot
🚷 view threshold
1,032.80 µs
(+0.58%)Baseline: 1,026.88 µs
1,113.56 µs
(92.75%)
nested_routers/nested_routers📈 view plot
🚷 view threshold
952.16 µs
(+0.13%)Baseline: 950.91 µs
1,032.73 µs
(92.20%)
single_root_route/single_root_route📈 view plot
🚷 view threshold
913.18 µs
(+0.31%)Baseline: 910.35 µs
980.49 µs
(93.14%)
single_root_route_burst/single_root_route_burst📈 view plot
🚷 view threshold
17,884.00 µs
(+0.42%)Baseline: 17,808.50 µs
21,177.16 µs
(84.45%)
🐰 View full continuous benchmarking report in Bencher

@m4tx m4tx changed the title feat(db): add bulk_create feat(db)!: add bulk_create Nov 6, 2025
@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

❌ Patch coverage is 79.75460% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cot/src/db.rs 79.75% 22 Missing and 11 partials ⚠️
Flag Coverage Δ
rust 90.58% <79.75%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cot/src/db.rs 85.35% <79.75%> (-1.76%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@seqre seqre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start, please apply Copilot review as it's actually not bad

Copilot AI review requested due to automatic review settings November 29, 2025 22:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m4tx m4tx changed the title feat(db)!: add bulk_create feat(db)!: add bulk_insert Nov 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings December 5, 2025 21:00
Copy link
Member

@seqre seqre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m4tx m4tx merged commit 0643b2d into master Dec 5, 2025
48 of 54 checks passed
@m4tx m4tx deleted the bulk-create branch December 5, 2025 21:25
@cotbot cotbot bot mentioned this pull request Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants