-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
sqlite: add aggregate function #56600
base: main
Are you sure you want to change the base?
Conversation
V(ack_string, "ack") \ | ||
V(step_string, "step") \ | ||
V(start_string, "start") \ |
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.
These should be ordered alphabetically
Local<Object> options = args[1].As<Object>(); | ||
Local<Value> step_v; | ||
if (!options->Get(env->context(), env->step_string()).ToLocal(&step_func)) { | ||
// TODO: throw an error; step is required |
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.
If Get returns nothing and this is false, then v8 should already be scheduling an error to be thrown. There shouldn't be a need to throw another error.
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.
Oh, great! Thanks for letting me know!
: env_(env), fn_(env->isolate(), fn) {} | ||
|
||
static void xStep(sqlite3_context* ctx, int argc, sqlite3_value** argv) {} | ||
|
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.
Style nit: can you remove the extra blank lines.
// database.aggregate(name, { start, step, inverse, result, directOnly, | ||
// deterministic, varargs }) |
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.
// database.aggregate(name, { start, step, inverse, result, directOnly, | |
// deterministic, varargs }) |
Also, tests and docs are needed. |
Closes #56511
inspired by https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#aggregatename-options---this