Coerces object into an RStudio connection contract

as_rscontract(x)

Arguments

x

Object that will be coerced

Value

An `rs_contract_ide` class object

Examples

as_rscontract(sample_catalog())
#> $connectionObject #> NULL #> #> $type #> [1] "spec_type" #> #> $host #> [1] "spec_host" #> #> $icon #> NULL #> #> $displayName #> [1] "" #> #> $connectCode #> [1] "library(connections)\n[Place your code here]" #> #> $disconnect #> function () #> rscontract_close("spec_host", "spec_type") #> <environment: 0x562945d54360> #> #> $previewObject #> function () #> { #> } #> <environment: 0x562945d440e0> #> #> $listObjectTypes #> function () #> { #> list(catalog = list(contains = list(schema = list(contains = list(table = list(contains = "data"), #> view = list(contains = "data")))))) #> } #> <bytecode: 0x562945d3d300> #> <environment: 0x562945d3d808> #> #> $listObjects #> function (catalog = NULL, schema = NULL, spec = x, ...) #> { #> if (is.null(catalog)) { #> return(get_object(spec, "catalogs")$data) #> } #> if (is.null(schema)) { #> ctls <- get_object(spec, "catalogs", catalog) #> return(get_object(ctls, "schemas")$data) #> } #> ctls <- get_object(spec, "catalogs", catalog) #> schs <- get_object(ctls, "schemas", schema) #> return(get_object(schs, "tables")$data) #> } #> <bytecode: 0x562945d39798> #> <environment: 0x562945d36c38> #> #> $listColumns #> function (catalog = NULL, schema = NULL, table = NULL, view = NULL, #> spec = x, ...) #> { #> table_object <- paste0(table, view) #> ctls <- get_object(spec, "catalogs", catalog) #> schs <- get_object(ctls, "schemas", schema) #> tbls <- get_object(schs, "tables", table_object) #> get_object(tbls, "fields")$data #> } #> <bytecode: 0x562945d38608> #> <environment: 0x562945d35610> #> #> $actions #> NULL #> #> attr(,"class") #> [1] "rscontract_ide"