Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: simplify get_sequence() and get_sequence_next_value() #16463

Merged
merged 5 commits into from
Sep 18, 2024

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Sep 18, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

chore: simplify get_sequence() and get_sequence_next_value()
refactor: simplify get_sequence() API to return Option instead of Result
  • Change return type from Result to Option
  • Return None when sequence is not found
  • This allows callers to easily distinguish between "not found" and other errors
chore: replace manually defined Sequence error with Unknown/Exist Error with generic
chore: add test to SequenceIdent

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Refactoring

Related Issues


This change is Reviewable

- Change return type from Result to Option<Sequence>
- Return None when sequence is not found
- This allows callers to easily distinguish between "not found" and other errors
@github-actions github-actions bot added the pr-chore this PR only has small changes that no need to record, like coding styles. label Sep 18, 2024
@drmingdrmer drmingdrmer marked this pull request as ready for review September 18, 2024 13:34
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. A-meta Area: databend meta serive pr-refactor this PR changes the code base without new features or bugfix labels Sep 18, 2024
@drmingdrmer drmingdrmer merged commit 10d54ae into datafuselabs:main Sep 18, 2024
95 of 96 checks passed
@drmingdrmer drmingdrmer deleted the 146-refactor-sequence branch September 18, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: databend meta serive pr-chore this PR only has small changes that no need to record, like coding styles. pr-refactor this PR changes the code base without new features or bugfix size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant