postgresql

command
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Example: PostgreSQL provider

Prerequisites:

  1. Start PostgreSQL: docker run -d --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=root -e POSTGRES_DB=configdb postgres:16
  2. Create the config table and seed data: docker exec -i postgres psql -U postgres -d configdb <<'SQL' CREATE TABLE config ( config_key VARCHAR(255) PRIMARY KEY, config_value TEXT ); INSERT INTO config VALUES ('myapp/db/host', 'localhost'); INSERT INTO config VALUES ('myapp/db/port', '5432'); INSERT INTO config VALUES ('myapp/verbose', 'true'); INSERT INTO config VALUES ('myapp/timeout', '30s'); SQL
  3. Run: go run examples/postgresql/main.go
  4. In another terminal, update a value: docker exec -i postgres psql -U postgres -d configdb -c "UPDATE config SET config_value='3306' WHERE config_key='myapp/db/port'" Watch the output — the update is reflected within the poll interval.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL