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

Reconsider interface #7

Open
mootpointer opened this issue Nov 8, 2016 · 3 comments
Open

Reconsider interface #7

mootpointer opened this issue Nov 8, 2016 · 3 comments

Comments

@mootpointer
Copy link
Contributor

At the moment the interface for setting the ranking column is a set_order/4 which is fine, but makes things inconvenient if you only want to set the scope column (which is something I've done in Zova's implementation).

So, perhaps set_order/2 with a keyword list of options is more appropriate.

To continue along that line, then maybe a __using__ macro would make sense to push that config out of the normal flow.

@zachdaniel
Copy link

What do you mean by only wanting to set the scope column? I do support the idea of making set_order/2 take options as opposed to multiple different arity functions regardless.

@mootpointer
Copy link
Contributor Author

Sorry that wasn't super clear. Right now I use the default fields for rank_field and position_field, but I scope based on a foreign key (question_id in this case) which means I need to specify the full args for set_order/4 which gets a bit noisy.

@zachdaniel
Copy link

zachdaniel commented Nov 13, 2016

@mootpointer we do the same thing :). I like the idea of making the arguments to set_order just a changeset and opts, with default values.

The defaults being [rank_field: :rank, position_field: :position] (scope having no default). What do you think? I like to avoid using modules where I can, because it often makes things more confusing than they have to be, especially for one function call in this case. Although I'm absolutely open to the idea if there are other gains that I'm not considering.

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