-
Notifications
You must be signed in to change notification settings - Fork 24
Support custom cost factors #17
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
Conversation
|
||
enterType(type) { | ||
leaveField() { | ||
this.costFactor /= this.getFieldCostFactor(); |
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.
every time, i forget this operator exists
item: { type: Item }, | ||
expensiveItem: { | ||
type: Item, | ||
getCost: () => 50, |
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 this safe to extend like this?
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.
well, it works, doesn’t it?
How is this going to work if I write in the SDL? |
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.
great. Does it make sense to set a cost factor in a non list type?
Yeah for sure, what if one of my fields has to do 10 db queries instead of the usual 1? type Bla {
normalField: String # Cheap
someExtremelyExpensiveField: SomeExtremelyExpensiveObject # Much more expensive
} |
wouldn't that be modeled by a constant cost on the field? |
I can't think of a use case for cost factor on a non-list field, but I don't think it really matters. I don't see the harm in keeping it around. |
@mxstbr I just added SDL support in the latest commit on this PR. |
Released in v0.2.2. |
No description provided.