View source: R/postgresModule.R
postgresServer | R Documentation |
This function sets up the server-side logic for the Postgres Shiny module, handling database connections, data submission, retrieval, and download.
postgresServer(id, dbname, datatable, host, port, user, password, data)
id |
A character string that matches the ID used in |
dbname |
A character string specifying the name of the database |
datatable |
A character string specifying the name of the table in the database |
host |
A character string specifying the host of the database |
port |
A numeric value specifying the port number for the database connection |
user |
A character string specifying the username for database access |
password |
A character string specifying the password for database access |
data |
A reactive expression that provides the data to be submitted |
A list of functions and reactive values:
executeQuery |
A function to run arbitrary SQL |
saveData |
A function to save data to the database |
loadData |
A function to load data from the database |
current_data |
A reactive value containing the current data in the table |
data_to_submit |
A reactive value containing the data to be submitted |
server <- function(input, output, session) {
postgres_module <- postgresServer("postgres_module", "my_db", "my_table",
"localhost", 5432, "user", "password",
reactive({ input$data }))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.