mirror of
https://codeberg.org/scip/pgidler.git
synced 2025-12-16 03:51:02 +01:00
giv it a version
This commit is contained in:
13
main.go
13
main.go
@@ -32,6 +32,7 @@ import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -39,6 +40,8 @@ import (
|
||||
flag "github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
const version = "v0.0.2"
|
||||
|
||||
type Tableschema struct {
|
||||
Name string
|
||||
}
|
||||
@@ -60,7 +63,7 @@ func main() {
|
||||
var optPort int
|
||||
var optMaxconnections int
|
||||
var optTimeout int
|
||||
var optIdleTransaction bool
|
||||
var optIdleTransaction, shversion bool
|
||||
var ctx context.Context
|
||||
var cancel context.CancelFunc
|
||||
var conn string
|
||||
@@ -71,11 +74,17 @@ func main() {
|
||||
flag.StringVarP(&optServer, "server", "s", "localhost", "Server")
|
||||
flag.IntVarP(&optMaxconnections, "client", "c", 500, "Number of concurrent users")
|
||||
flag.IntVarP(&optPort, "port", "P", 5432, "TCP Port")
|
||||
flag.IntVarP(&optTimeout, "timeout", "t", 0, "Wether to stop the clients after N seconds")
|
||||
flag.IntVarP(&optTimeout, "timeout", "t", 0, "Whether to stop the clients after N seconds")
|
||||
flag.BoolVarP(&optIdleTransaction, "idletransaction", "i", false, "Wether to stay in idle in transaction state")
|
||||
flag.BoolVarP(&shversion, "version", "v", false, "show version")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if shversion {
|
||||
fmt.Printf("pgidler version %s\n", version)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if optServer != "" {
|
||||
conn = fmt.Sprintf(NetConnection, optUser, optDatabase, optPasswd, optServer, optPort)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user