R/rscontract_spec.R
rscontract_spec.Rd
A flexible API that can be converted to an RStudio Connection Contract
rscontract_spec( connection_object = NULL, type = "spec_type", host = "spec_host", icon = NULL, name = "", connect_script = "library(connections)\n[Place your code here]", disconnect_code = "function() rscontract_close('spec_host', 'spec_type')", preview_code = "function(){}", catalog_list = "sample_catalog()", object_types = "default_types()", object_list = NULL, object_columns = NULL, actions = NULL )
connection_object | The connection object. Default to NULL. |
---|---|
type | Type of the connection. |
host | Name of the host |
icon | Path to the connection's icon. Defaults to NULL. |
name | The connection's name. |
connect_script | The text of the connection code. |
disconnect_code | Function to use to disconnect. Default to function(). |
preview_code | Function to run when the preview table icon is clicked on. Default to function(). |
catalog_list | Hierarchical list of the catalogs, schema, table/view and fields. |
object_types | Function that provides the structure of the connection. The default function will work properly, it is going to be rare when it needs to be changed. |
object_list | Function to run to get the catalogs, schema, tables or views based what has been expanded on. Defaults to NULL. |
object_columns | Function to run that pull the field information. Default to NULL |
actions | Additional buttons to add to the connection pane. Defaults to NULL. |
Returns an `rscontract_spec` class object
str(rscontract_spec())#> List of 13 #> $ connection_object: NULL #> $ type : chr "spec_type" #> $ host : chr "spec_host" #> $ icon : NULL #> $ name : chr "" #> $ connect_script : chr "library(connections)\n[Place your code here]" #> $ disconnect_code : chr "function() rscontract_close('spec_host', 'spec_type')" #> $ preview_code : chr "function(){}" #> $ catalog_list : chr "sample_catalog()" #> $ object_types : chr "default_types()" #> $ object_list : NULL #> $ object_columns : NULL #> $ actions : NULL #> - attr(*, "class")= chr "rscontract_spec"