...

Text file src/github.com/jackc/pgproto3/v2/example/pgfortune/README.md

Documentation: github.com/jackc/pgproto3/v2/example/pgfortune

     1# pgfortune
     2
     3pgfortune is a mock PostgreSQL server that responds to every query with a fortune.
     4
     5## Installation
     6
     7Install `fortune` and `cowsay`. They should be available in any Unix package manager (apt, yum, brew, etc.)
     8
     9```
    10go get -u github.com/jackc/pgproto3/example/pgfortune
    11```
    12
    13## Usage
    14
    15```
    16$ pgfortune
    17```
    18
    19By default pgfortune listens on 127.0.0.1:15432 and responds to queries with `fortune | cowsay -f elephant`. These are
    20configurable with the `listen` and `response-command` arguments respectively.
    21
    22While `pgfortune` is running connect to it with `psql`.
    23
    24```
    25$ psql -h 127.0.0.1 -p 15432
    26Timing is on.
    27Null display is "∅".
    28Line style is unicode.
    29psql (11.5, server 0.0.0)
    30Type "help" for help.
    31
    32jack@127.0.0.1:15432 jack=# select foo;
    33                   fortune
    34─────────────────────────────────────────────
    35  _________________________________________ ↵
    36 / Ships are safe in harbor, but they were \↵
    37 \ never meant to stay there.              /↵
    38  ----------------------------------------- ↵
    39  \     /\  ___  /\                         ↵
    40   \   // \/   \/ \\                        ↵
    41      ((    O O    ))                       ↵
    42       \\ /     \ //                        ↵
    43        \/  | |  \/                         ↵
    44         |  | |  |                          ↵
    45         |  | |  |                          ↵
    46         |   o   |                          ↵
    47         | |   | |                          ↵
    48         |m|   |m|                          ↵
    49
    50(1 row)
    51
    52Time: 28.161 ms
    53```

View as plain text