Skip to content

Commit bd9e7c4

Browse files
CodingAnarchyclaude
andcommitted
Fix compilation issues and clean up code
- Add UUID error conversion to HammerworkError for MySQL compatibility - Replace SQLx tuple queries with FromRow structs to avoid 16-field limit - Add required-features to examples in Cargo.toml - Clean up clippy warnings: remove needless borrows and use or_default() - Remove unused imports from examples - Fix MySQL implementation to use JobRow and DeadJobRow structs - All tests now pass for both postgres and mysql features 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent be1043c commit bd9e7c4

File tree

8 files changed

+64
-266
lines changed

8 files changed

+64
-266
lines changed

.claude/settings.local.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Cargo.lock
33

44
# CLAUDE
5-
.claude/local.settings.json
5+
.claude/settings.local.json

Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,15 @@ mysql = ["sqlx/mysql"]
5757
[dev-dependencies]
5858
tokio-test = { workspace = true }
5959
tracing-subscriber = { workspace = true }
60+
61+
[[example]]
62+
name = "postgres_example"
63+
required-features = ["postgres"]
64+
65+
[[example]]
66+
name = "mysql_example"
67+
required-features = ["mysql"]
68+
69+
[[example]]
70+
name = "cron_example"
71+
required-features = ["postgres"]

examples/cron_example.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ use hammerwork::{
22
cron::{CronSchedule, presets},
33
job::Job,
44
queue::JobQueue,
5-
stats::{InMemoryStatsCollector, StatisticsCollector, JobEvent, JobEventType},
5+
stats::{InMemoryStatsCollector, StatisticsCollector},
66
worker::{Worker, WorkerPool},
77
Result,
88
};
99
use serde_json::json;
1010
use sqlx::{Pool, Postgres};
1111
use std::sync::Arc;
1212
use tracing::info;
13-
use chrono::Utc;
1413

1514
#[tokio::main]
1615
async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {

examples/postgres_example.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
use hammerwork::{
22
job::Job,
33
queue::JobQueue,
4-
stats::{InMemoryStatsCollector, StatisticsCollector, JobEvent, JobEventType},
4+
stats::{InMemoryStatsCollector, StatisticsCollector},
55
worker::{Worker, WorkerPool},
66
Result,
77
};
88
use serde_json::json;
99
use sqlx::{Pool, Postgres};
1010
use std::sync::Arc;
1111
use tracing::info;
12-
use chrono::Utc;
1312

1413
#[tokio::main]
1514
async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {

src/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ pub enum HammerworkError {
1111
#[error("Serialization error: {0}")]
1212
Serialization(#[from] serde_json::Error),
1313

14+
#[error("UUID parsing error: {0}")]
15+
UuidParsing(#[from] uuid::Error),
16+
1417
#[error("Worker error: {message}")]
1518
Worker { message: String },
1619

0 commit comments

Comments
 (0)