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

Separate sequence property specifiers #36

Closed
alfawal opened this issue Mar 31, 2023 · 2 comments
Closed

Separate sequence property specifiers #36

alfawal opened this issue Mar 31, 2023 · 2 comments

Comments

@alfawal
Copy link

alfawal commented Mar 31, 2023

When using

get_next_value("orders", initial_value=100, reset_value=500)

I can easily tell what this function does and what values to expect, but if this sequence name was used in multiple files as

get_next_value("orders")

it wouldn't be obvious or it would be hard to figure out what the initial_value or the rest_value is.

My proposal is doing one of:

  1. allowing a declarative class usage:
orders_sequence = DjangoSequence("orders", initial_value=100, reset_value=500)

get_next_value(orders_sequence)
  1. enum-like usage:
class DjangoSequences:
    ORDERS = DjangoSequence("orders", initial_value=100, reset_value=500)

get_next_value(DjangoSequences.ORDERS)

My current usage is like the following:

orders_sequence = {"sequence_name": "orders", "initial_value": 100, "reset_value": 500}

get_next_value(**orders_sequence)
@aaugustin
Copy link
Owner

Search for "object-oriented API" in the README. I believe that it does what you want. If not, could you clarify why it doesn't?

@alfawal
Copy link
Author

alfawal commented Mar 31, 2023

Yes this is what I was looking for, I thought it was something else. I will give it a try. Thanks a lot.

@alfawal alfawal closed this as completed Mar 31, 2023
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

No branches or pull requests

2 participants