postgresServer: Server function for Postgres Shiny Module

View source: R/postgresModule.R

postgresServerR Documentation

Server function for Postgres Shiny Module

Description

This function sets up the server-side logic for the Postgres Shiny module, handling database connections, data submission, retrieval, and download.

Usage

postgresServer(id, dbname, datatable, host, port, user, password, data)

Arguments

id

A character string that matches the ID used in postgresUI()

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

Value

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

Examples

server <- function(input, output, session) {
  postgres_module <- postgresServer("postgres_module", "my_db", "my_table",
                                    "localhost", 5432, "user", "password",
                                    reactive({ input$data }))
 }

mmints documentation built on April 3, 2025, 9:33 p.m.