-
Notifications
You must be signed in to change notification settings - Fork 508
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
feat(bindings/nodejs): generate types and add typed create_operator method #5465
Conversation
10ec06d
to
7f4176a
Compare
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.
I'm fine with most of the changes, but do you think it's better to complete the task on the python side first and then expand to other bindings?
|
||
# NOTE: this is the feature we used to build pypi wheels. | ||
# When enable or disable some features, | ||
# also need to update dev/src/generate/binding_nodejs.rs `enabled_service` to match it. |
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.
We have repeated this pattern once again. Let's implement a utility function to retrieve all enabled services by cargo metadata.
value_field?: string | ||
} | ||
|
||
export interface Redb_Config { |
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 it normal for js to jave types like Xxx_Yyy
? Should we use XxxYyy
instead?
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.
we may need some template filter to convert nebula_graph
to NebulaGraph
@@ -137,6 +137,10 @@ Writer.prototype.createWriteStream = function (options) { | |||
return new WriteStream(this, options) | |||
} | |||
|
|||
module.exports.create_operator = function (scheme, options) { |
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.
Can we modify the Operator
's constructor API instead of introducing a new API to build the operator?
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.
we can't since type of Operator
is also generated
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.
Then we need to design new APIs instead of adding another one. Maybe we can impelment Operator
class in js instead of exposing from native binding?
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.
any idea how? do you suggest to wrap all method of Operator
?
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.
any idea how? do you suggest to wrap all method of
Operator
?
It seems like a possible approach. I'm not sure if we can have multiple constructors
on the Rust side; perhaps we could generate Rust code as well.
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.
It's getting messy...
I haven't start using nodejs binding yet, maybe I'll try this some days later.
Which issue does this PR close?
Closes #.
Rationale for this change
What changes are included in this PR?
generate types for nodejs binding.
type of
Operator
is already generated and it's hard to interactive, so we will need to add a new typed functioncreate_operator
to create operator.Are there any user-facing changes?
Yes, new typed method
create_operator
.