R/x_conn.R

Defines functions dcAthena connectAthena_ff connectAthena

Documented in connectAthena connectAthena_ff dcAthena

#' @title
#' Connect Local Athena
#' @importFrom pg13 local_connect
#' @export
#' @rdname connectAthena

connectAthena <-
  function(port    = 5432,
           dbname  = "athena",
           pathToDriver = system.file(package = "pg13", "driver"),
           verbose = FALSE) {
    pg13::local_connect(
      dbname  = dbname,
      port    = port,
      verbose = verbose,
      pathToDriver = pathToDriver
    )
  }


#' @title
#' Connect Local Athena Function Factory
#' @export
#' @rdname connectAthena_ff

connectAthena_ff <-
  function(user = NULL,
           password = NULL,
           port = 5432,
           server = "localhost/athena") {
    function(verbose = TRUE) {
      connectAthena(
        user = user,
        password = password,
        port = port,
        server = server,
        verbose = verbose
      )
    }
  }


#' @title
#' Disconnect Local Athena
#' @importFrom pg13 dc
#' @export
#' @rdname dcAthena

dcAthena <-
  function(conn,
           remove =  FALSE,
           verbose = FALSE) {
    pg13::dc(
      conn    = conn,
      remove  = remove,
      verbose = verbose
    )
  }
patelm9/chariot documentation built on Feb. 19, 2022, 11:29 a.m.