println connected
parent
8740f890da
commit
18d8d9af77
|
|
@ -0,0 +1 @@
|
||||||
|
https://topicpartition.io/blog/postgres-pubsub-queue-benchmarks
|
||||||
|
|
@ -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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -49,6 +49,7 @@ func PSQL(ctx context.Context, conn string, foo func(db *sql.DB) error) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
log.Println("connected")
|
||||||
|
|
||||||
return foo(pg)
|
return foo(pg)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue