-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil_test.go
More file actions
39 lines (33 loc) · 815 Bytes
/
util_test.go
File metadata and controls
39 lines (33 loc) · 815 Bytes
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
package postgres
import (
"context"
"fmt"
"testing"
"github.com/jackc/pgx/v5/pgconn"
)
func TestSelectReplicationSlot(t *testing.T) {
var (
Host = "192.168.56.58"
Port uint16 = 5432
User = "postgres"
Password = "postgres1234"
Database = "postgres"
)
config, err := pgconn.ParseConfig(fmt.Sprintf("postgres://%s?replication=database", Host))
if err != nil {
panic(err)
}
config.Port = Port
config.User = User
config.Password = Password
config.Database = Database
conn, err := pgconn.ConnectConfig(context.Background(), config)
if err != nil {
t.Fatal(err)
}
records, err := SelectReplicationSlot(context.Background(), conn, []string{"a", "b", "golang_replication_slot_temp"})
if err != nil {
t.Fatal(err)
}
t.Logf("%+v\n", records)
}