pgx/examples/chat
Jack Christensen cea412f2ba Fix chat example 2017-03-03 15:57:24 -06:00
..
README.md Add example of listen/notify support 2014-11-01 10:45:18 -05:00
main.go Fix chat example 2017-03-03 15:57:24 -06:00

README.md

Description

This is a sample chat program implemented using PostgreSQL's listen/notify functionality with pgx.

Start multiple instances of this program connected to the same database to chat between them.

Connection configuration

The database connection is configured via enviroment variables.

  • CHAT_DB_HOST - defaults to localhost
  • CHAT_DB_USER - defaults to current OS user
  • CHAT_DB_PASSWORD - defaults to empty string
  • CHAT_DB_DATABASE - defaults to postgres

You can either export them then run chat:

export CHAT_DB_HOST=/private/tmp
./chat

Or you can prefix the chat execution with the environment variables:

CHAT_DB_HOST=/private/tmp ./chat