dbping

package module
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 7 Imported by: 0

README

dbping

CI

PING for DB.

Usage

Usage: dbping <dsn> [flags]

Arguments:
  <dsn>    DSN to connect to.
             - MySQL: https://pkg.go.dev/github.com/go-sql-driver/mysql#readme-dsn-data-source-name
             - PostgreSQL: https://pkg.go.dev/github.com/jackc/pgx/v5/stdlib#pkg-overview

Flags:
  -h, --help            Show help.
  -i, --interval=3      Interval seconds.
  -q, --query=STRING    Query to run.
      --version
$ dbping 'root@tcp(127.0.0.1:13306)/mysql'
PING 4.152041ms
PING 1.601542ms
PING 1.205208ms
[ERROR] driver: bad connection
[ERROR] dial tcp 127.0.0.1:13306: connect: connection refused
[ERROR] dial tcp 127.0.0.1:13306: connect: connection refused
PING 6.901792ms
PING 2.089375ms
PING 2.137875ms
...

% dbping 'root@tcp(127.0.0.1:13306)/mysql' -q 'select connection_id()'
11 3.994167ms
11 2.172917ms
11 2.531042ms
...

% dbping 'postgres://postgres@localhost:15432' -q 'select pg_backend_pid()'
68 13.914584ms
68 3.430833ms
68 2.396708ms
...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ping

func Ping(config *Config)

Types

type Config added in v1.1.0

type Config struct {
	DSN      string   `` /* 218-byte string literal not displayed */
	Interval uint     `kong:"short='i',default='3',help='Interval seconds.'"`
	Query    string   `kong:"short='q',help='Query to run.'"`
	Driver   DBDriver `kong:"-"`
}

type DBDriver

type DBDriver string
const (
	DBDriverMySQL      DBDriver = "mysql"
	DBDriverPostgreSQL DBDriver = "pgx"
)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL