println connected

main
Bel LaPointe 2025-12-09 15:52:38 -07:00
parent 8740f890da
commit 18d8d9af77
3 changed files with 33 additions and 0 deletions

1
cmd/pg-queue/README.md Normal file
View File

@ -0,0 +1 @@
https://topicpartition.io/blog/postgres-pubsub-queue-benchmarks

31
cmd/pg-queue/main.go Normal file
View File

@ -0,0 +1,31 @@
package main
import (
"context"
"database/sql"
"flag"
"os"
"pg/src/with"
_ "github.com/lib/pq"
)
func main() {
if err := with.Context(run); err != nil {
panic(err)
}
}
func run(ctx context.Context) error {
fs := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
c := fs.String("c", "postgresql://pulsegres:pulsegres@localhost:15432", "conn string")
if err := fs.Parse(os.Args[1:]); err != nil {
panic(err)
}
return with.PSQL(ctx, *c, func(pg *sql.DB) error {
<-ctx.Done()
return nil
})
}

View File

@ -49,6 +49,7 @@ func PSQL(ctx context.Context, conn string, foo func(db *sql.DB) error) error {
}
}
}()
log.Println("connected")
return foo(pg)
}