File: README.md

package info (click to toggle)
golang-github-jackc-pgproto3 2.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 364 kB
  • sloc: makefile: 3
file content (53 lines) | stat: -rw-r--r-- 1,619 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# pgfortune

pgfortune is a mock PostgreSQL server that responds to every query with a fortune.

## Installation

Install `fortune` and `cowsay`. They should be available in any Unix package manager (apt, yum, brew, etc.)

```
go get -u github.com/jackc/pgproto3/example/pgfortune
```

## Usage

```
$ pgfortune
```

By default pgfortune listens on 127.0.0.1:15432 and responds to queries with `fortune | cowsay -f elephant`. These are
configurable with the `listen` and `response-command` arguments respectively.

While `pgfortune` is running connect to it with `psql`.

```
$ psql -h 127.0.0.1 -p 15432
Timing is on.
Null display is "∅".
Line style is unicode.
psql (11.5, server 0.0.0)
Type "help" for help.

jack@127.0.0.1:15432 jack=# select foo;
                   fortune
─────────────────────────────────────────────
  _________________________________________ ↵
 / Ships are safe in harbor, but they were \↵
 \ never meant to stay there.              /↵
  ----------------------------------------- ↵
  \     /\  ___  /\                         ↵
   \   // \/   \/ \\                        ↵
      ((    O O    ))                       ↵
       \\ /     \ //                        ↵
        \/  | |  \/                         ↵
         |  | |  |                          ↵
         |  | |  |                          ↵
         |   o   |                          ↵
         | |   | |                          ↵
         |m|   |m|                          ↵

(1 row)

Time: 28.161 ms
```