-
Notifications
You must be signed in to change notification settings - Fork 12
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
Global Unique Index #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall 👍
Minor changes requested
/** | ||
* Is unique index type | ||
*/ | ||
boolean unique() default false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "unique" an index type or a property of any index that can be created? If it's a dedicated index type, we should use an enum instead, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to enum
} | ||
|
||
private Map<String, Object> buildIndexValues(Schema.Index index, T entity) { | ||
Map<String, Object> cells = schema.flatten(entity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, Schema.flatten()
is not guaranteed to return a mutable map (but in practice, it does).
I would probably use .entrySet().stream().filter(...).collect(toMap(...));
instead, to filter out fields not belonging to the index (and it would create a new map).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe new HashMap<>(...);
=)? Same result - less code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make a new HashMap<>()
👍
No description provided.