R/generics.R

Defines functions exists_dataset list_datasets remove_dataset write_dataset read_dataset con_print_footer con_print_body con_print_header is_connected disconnect connect

Documented in connect con_print_body con_print_footer con_print_header disconnect is_connected list_datasets read_dataset remove_dataset write_dataset

# Connection --------------------------------------------------------------

#' Connect to a datasource
#'
#' @param x what to connect to
#' @param ... other args passed to methods
#' @export
connect <- function(x, ...) {
  UseMethod("connect")
}

#' Disconnect from a datasource
#'
#' @param x what to disconnect from
#' @param ... other args passed to methods
#' @export
disconnect <- function(x, ...) {
  UseMethod("disconnect")
}

#' Check whether connection is connected
#'
#' @param x a connection
#' @param ... other args passed to methods
#' @export
is_connected <- function(x, ...) {
  UseMethod("is_connected")
}

#' Print connection
#'
#' @name print_connection
#' @param x connection
#' @param ... args passed onto methods
NULL

#' @rdname print_connection
#' @export
con_print_header <- function(x, ...) {
  UseMethod("con_print_header")
}

#' @rdname print_connection
#' @export
con_print_body <- function(x, ...) {
  UseMethod("con_print_body")
}

#' @rdname print_connection
#' @export
con_print_footer <- function(x, ...) {
  UseMethod("con_print_footer")
}


# Methods -----------------------------------------------------------------

#' Read a dataset
#'
#' @param src datasource
#' @param name name of dataset
#' @param ... other args passed to methods
#' @export
read_dataset <- function(src, name, ...) {
  UseMethod("read_dataset")
}

#' Write a dataset
#'
#' @param dest datasource
#' @param name name of dataset
#' @param x data to write
#' @param ... other args passed to methods
#' @export
write_dataset <- function(dest, name, x, ...) {
  UseMethod("write_dataset")
}

#' Remove a dataset
#'
#' @param loc datasource
#' @param name name of dataset
#' @param ... other args passed to methods
#' @export
remove_dataset <- function(loc, name, ...) {
  UseMethod("remove_dataset")
}

#' List datasets
#'
#' @param src datasource
#' @param ... other args passed to methods
#' @export
list_datasets <- function(src, ...) {
  UseMethod("list_datasets")
}

exists_dataset <- function(src, name, ...) {
  UseMethod("exists_dataset")
}
shunsambongi/datafire documentation built on Aug. 19, 2022, 9:57 a.m.