-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have one file per exported function
- Loading branch information
Showing
5 changed files
with
33 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#' @export | ||
#' @title Transform a vector into a SQL-interpreted array. | ||
#' | ||
#' @param vector character vector | ||
#' @return | ||
#' List with a single string that's interpreted as a SQL array to interpolate in a query. | ||
as_sql_array <- function(vector) { | ||
array <- paste0("(", paste(paste0("'", vector, "'"), collapse = ", "), ")") | ||
list(array) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#' @export | ||
#' @title Create a tbl that references a schema.table in the `conn` database. | ||
#' | ||
#' @param conn A database connection. | ||
#' @param schema A string with schema name. | ||
#' @param table A string with table name. | ||
#' | ||
#' @return | ||
#' A reference to a database table. | ||
#' | ||
#' @importFrom dbplyr in_schema | ||
#' @importFrom dplyr tbl | ||
db_table <- function(conn, schema, table) { | ||
tbl(conn, in_schema(schema, table)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.