database

package
Version: v0.0.0-...-4d4bbb7 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	WithDSN(string) Database
	WithDriver(string) Database
	Connect() *sql.DB
}

Database interface builder that overide an initial values and then call `Connect` method to get a `*sql.DB`

type Options

type Options struct {
	Host     string
	User     string
	Password string
	Name     string
	SSLMode  string

	DSN    string
	Driver string
}

Options hold database options

func (*Options) AddFlags

func (o *Options) AddFlags(fs *flag.FlagSet)

AddFlags add database-* flags.

func (*Options) Connect

func (o *Options) Connect() *sql.DB

Connect open sql connection pool.

func (*Options) Init

func (o *Options) Init() error

Init initialize database with proivided options

func (*Options) WithDSN

func (o *Options) WithDSN(dsn string) Database

WithDSN overide provided dsn option

func (*Options) WithDriver

func (o *Options) WithDriver(driver string) Database

WithDriver overide provided driver option

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL