dbping

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 6 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.
      --version
$ dbping 'root@tcp(127.0.0.1:13306)/mysql'
OK 4.152041ms
OK 1.601542ms
OK 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
OK 6.901792ms
OK 2.089375ms
OK 2.137875ms
...

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.'"`
	Driver   DBDriver `kong:"-"`
}

func (*Config) Open added in v1.1.0

func (config *Config) Open() (*sql.DB, error)

type DBDriver

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

Directories

Path Synopsis
cmd
dbping command

Jump to

Keyboard shortcuts

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