Skip to content

refactor: replace magic string constants with enums#68

Merged
YuweiXiao merged 1 commit into
mainfrom
refactor/replace-magic-consts-with-enums
Apr 3, 2026
Merged

refactor: replace magic string constants with enums#68
YuweiXiao merged 1 commit into
mainfrom
refactor/replace-magic-consts-with-enums

Conversation

@qsliu2017

Copy link
Copy Markdown
Contributor

Summary

  • Add SyncMode enum (Upsert/Append) to replace ~30 bare "upsert"/"append" string comparisons across the codebase
  • Change TableMapping.state from String to the existing SyncState enum, eliminating stringly-typed state comparisons
  • Add ChangeType::as_i32() to replace inline numeric mapping (0/1/2) in the DuckDB buffer path
  • All conversions happen at DB/API boundaries (metadata.rs, api.rs); internal code uses typed enums with matches!() throughout

Test plan

  • CI passes (make installcheck -- regression + daemon tests)
  • cargo check on all three workspace crates (core, pg, daemon)
  • cargo fmt --all --check passes

🤖 Generated with Claude Code

Add SyncMode enum (Upsert/Append) to replace bare "upsert"/"append"
string comparisons across the codebase (~30 sites). Change
TableMapping.state from String to the existing SyncState enum,
eliminating stringly-typed state comparisons. Add ChangeType::as_i32()
to replace the inline numeric mapping in the DuckDB buffer path.

All conversions happen at DB/API boundaries (metadata.rs, api.rs);
internal code uses typed enums with matches!() throughout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@YuweiXiao YuweiXiao merged commit ea88203 into main Apr 3, 2026
5 checks passed
@YuweiXiao YuweiXiao deleted the refactor/replace-magic-consts-with-enums branch April 3, 2026 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants