-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support for defining indexes on models #13
base: main
Are you sure you want to change the base?
Conversation
Hey @soderluk ! 🙂 I think one way to tackle this a bit more cleanly would be to create classes for the different types of index, so What do you think? |
So something like indexes = [
HashIndex(fields=["_from", "_to", "type"], unique=True)
] |
@lietu Good idea! Will look into it :) |
@lietu Made some updates to the PR. Please have a look, when you have the time. |
Overall I'd say I like it, with some luck @joakimnordling has the time to take a look at some point as well 👍 |
Support ensuring indexes on collections. The `Model.ensure_indexes()` function supports any indexing function that ArangoDB Collection supports.
Instead of using magic methods, set up index classes to handle all the different indexing cases.
Mypy doesn't really understand what is returned from the add_*_index function.
1e55b26
to
5f8cd69
Compare
Fix the tests for ensuring indexes. Make BaseIndex abstract base class, and make the add_index function as abstract as well. Move fields away from the BaseIndex to their respective sub-classes.
@joakimnordling Updated the tests and fixed a few things according to code review. |
Support ensuring indexes on collections. The
Model.ensure_indexes()
function supports any indexing function that ArangoDB Collection
supports.