mysqlflags

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 7 Imported by: 6

README

go-mysqlflags

Utility for mysql related flags and connect to mysql.

Usage

import "github.com/kazeburo/go-mysqlflags"

TODO

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDSN

func CreateDSN(opts MyOpts, timeout time.Duration, debug bool) (string, error)

CreateDSN creates DSN from Opts

func OpenDB

func OpenDB(opts MyOpts, timeout time.Duration, debug bool) (*sql.DB, error)

OpenDB opens MySQL connections from Opts

Types

type MyOpts

type MyOpts struct {
	MySQLDefaultsExtraFile string  `long:"defaults-extra-file" description:"path to defaults-extra-file"`
	MySQLSocket            string  `long:"mysql-socket" description:"path to mysql listen sock"`
	MySQLHost              string  `short:"H" long:"host" default:"localhost" description:"Hostname"`
	MySQLPort              string  `short:"p" long:"port" default:"3306" description:"Port"`
	MySQLUser              string  `short:"u" long:"user" default:"root" description:"Username"`
	MySQLPass              *string `short:"P" long:"password" description:"Password"`
	MySQLDBName            string  `long:"database" default:"" description:"database name connect to"`
}

MyOpts mysql connection related flags used with go-flags

Jump to

Keyboard shortcuts

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