Fix examples and remove 'sslmode' from default connect string

This commit is contained in:
Adriano Caloiaro 2023-02-17 16:06:04 -08:00
parent 9dff9f241c
commit fcc9f0ea24
No known key found for this signature in database
GPG key ID: 890FFDB11860FE1C
4 changed files with 5 additions and 5 deletions

View file

@ -42,7 +42,7 @@ Queue Handlers are simple Go functions that accept a `Context` parameter.
**Example**: Add a listener on the `hello_world` queue
```go
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@localhost:5432/neoq?sslmode=disable"))
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@localhost:5432/neoq"))
nq.Listen("hello_world", neoq.NewHandler(func(ctx context.Context) (err error) {
j, err := neoq.JobFromContext(ctx)
log.Println("got job id:", j.ID, "messsage:", j.Payload["message"])
@ -55,7 +55,7 @@ nq.Listen("hello_world", neoq.NewHandler(func(ctx context.Context) (err error) {
**Example**: Add a "Hello World" job to the `hello_world` queue
```go
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@localhost:5432/neoq?sslmode=disable"))
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@localhost:5432/neoq"))
jid, _ := nq.Enqueue(neoq.Job{
Queue: "hello_world",
Payload: map[string]interface{}{

View file

@ -11,7 +11,7 @@ func main() {
var err error
const queue = "foobar"
//
nq, _ := neoq.New("postgres://postgres:postgres@127.0.0.1:5432/neoq?sslmode=disable")
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@127.0.0.1:5432/neoq"))
handler := neoq.NewHandler(func(ctx context.Context) (err error) {
var j *neoq.Job

View file

@ -32,7 +32,7 @@ const (
JobStatusNew = "new"
JobStatusProcessed = "processed"
JobStatusFailed = "failed"
DefaultPgConnectionString = "postgres://postgres:postgres@127.0.0.1:5432/neoq?sslmode=disable"
DefaultPgConnectionString = "postgres://postgres:postgres@127.0.0.1:5432/neoq"
DefaultTransactionTimeout = 60000 //ms
DefaultHandlerDeadline = 30000 //ms
DuplicateJobID = -1

View file

@ -11,7 +11,7 @@ import (
func TestWorkerListenConn(t *testing.T) {
const queue = "foobar"
pgBackend, err := NewPgBackend("postgres://postgres:postgres@127.0.0.1:5432/neoq?sslmode=disable")
pgBackend, err := NewPgBackend("postgres://postgres:postgres@127.0.0.1:5432/neoq")
if err != nil {
t.Fatal(err)
}