Coerces object into an RStudio connection contract
as_rscontract(x)An `rs_contract_ide` class object
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: 0x5563d4499678>
#>
#> $previewObject
#> function ()
#> {
#> }
#> <environment: 0x5563d449d9f8>
#>
#> $listObjectTypes
#> function ()
#> {
#> list(catalog = list(contains = list(schema = list(contains = list(table = list(contains = "data"),
#> view = list(contains = "data"))))))
#> }
#> <bytecode: 0x5563d449e728>
#> <environment: 0x5563d44a20c0>
#>
#> $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: 0x5563d44a5db0>
#> <environment: 0x5563d44a4a70>
#>
#> $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: 0x5563d44a6d10>
#> <environment: 0x5563d44a9d08>
#>
#> $actions
#> NULL
#>
#> attr(,"class")
#> [1] "rscontract_ide"