-
Notifications
You must be signed in to change notification settings - Fork 174
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
Support case_match()
#1020
Support case_match()
#1020
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.
Looks great, thanks for working on this!
R/translate-sql-conditional.R
Outdated
|
||
x_expr <- enexpr(.x) | ||
if (!is_symbol(x_expr)) { | ||
msg <- "{.arg .x} must be a variable, not a {.obj_type_friendly {.x}}." |
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.
msg <- "{.arg .x} must be a variable, not a {.obj_type_friendly {.x}}." | |
msg <- "{.arg .x} must be a variable, not {.obj_type_friendly {.x}}." |
This always trips me up too, but obj_type_friendly
adds the article because sometimes its "a" and sometimes its "an"
R/translate-sql-conditional.R
Outdated
@@ -1,3 +1,87 @@ | |||
sql_case_match <- function(.x, ..., .default = NULL, .ptype = NULL, error_call = current_call()) { |
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 don't think you need error_call
here?
R/translate-sql-conditional.R
Outdated
|
||
env <- environment(f) | ||
f_query <- f[[2]] | ||
# must handle `c(...)` specially because `translate_sql()` doesn't do what |
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.
What does it do?
R/translate-sql-conditional.R
Outdated
} | ||
|
||
# catch things like `f(y)` | ||
if (!vctrs::vec_is(f_query)) { |
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 is_call()
would be more evocative of the purpose?
}) | ||
}) | ||
|
||
test_that(".x must be a symbol", { |
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.
Couldn't it also be a function?
No description provided.