mysql

command
v0.1.1 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: MySQL provider

Prerequisites:

  1. Start MySQL: docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=configdb mysql:8
  2. Create the config table and seed data: docker exec -i mysql mysql -uroot -proot 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/mysql/main.go
  4. In another terminal, update a value: docker exec -i mysql mysql -uroot -proot configdb -e "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