-
Notifications
You must be signed in to change notification settings - Fork 0
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
Added wasm and created extract_table_names method #1
base: master
Are you sure you want to change the base?
Added wasm and created extract_table_names method #1
Conversation
extern { pub fn alert(s: &str); } | ||
|
||
#[wasm_bindgen] | ||
pub fn extract_table_names(sql: String) -> JsValue { |
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.
@Anks I'm not sure which is the best option here monadic error handling or raising alerts.
type Error = String;
pub fn extract_table_names(sql: String) -> (Error, JsValue)
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.
For now, I have just made the function return a string (in case of error) or an array of strings in case of success. Not a great interface, but it allows the caller to distinguish between parsing failure and empty state
Return value = string: parsing failed, this is the error message Return value = array: parsing succeeded, these are table names
…ry as well as wasm versions
No description provided.