db

package
v3.11.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2017 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 6

Documentation

Overview

The base environment for RDB testing

Flags

This package has pre-defined flags of command:

-dsn_mysql - MySQL DSN used to intialize configuration of mysql connection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDbConfig

func GetDbConfig(c *check.C) *commonDb.DbConfig

Gets the database configuration or skip the testing(depends on "gopkg.in/check.v1").

If the environment is not ready(flag is empty), this function returns "nil"

func HasDbEnvForMysqlOrSkip

func HasDbEnvForMysqlOrSkip(c *check.C) bool

Checks whether or not skipping testing by viable arguments.

If the environment is not ready(flag is empty), this function returns false value.

func InitDbFacade

func InitDbFacade(c *check.C) *f.DbFacade

Constructs "*db/facade/DbFacade" object by configuration of flag.

The checker object is used to trigger panic if the database cannot be opened.

If the environment is not ready(flag is empty), this function returns "nil"

func ReleaseDbFacade

func ReleaseDbFacade(c *check.C, dbFacade *f.DbFacade)

Releases "*db/facade/DbFacade" object by configuration of flag.

The checker object is used to trigger panic if the database cannot be released.

func SetupByViableDbConfig

func SetupByViableDbConfig(c *check.C, configFunc ViableDbConfigFunc) bool

This function is used to:

  1. Check whether or not the configuration o "dsn_mysql" has been supplied
  2. If it does, supply the data of configuration to callback function

Types

type GinkgoDb

type GinkgoDb struct{}

func (*GinkgoDb) GetDbConfig

func (g *GinkgoDb) GetDbConfig() *commonDb.DbConfig

func (*GinkgoDb) InitDbFacade

func (g *GinkgoDb) InitDbFacade() *f.DbFacade

Constructs "*db/facade/DbFacade" object by configuration of flag.

The checker object is used to trigger panic if the database cannot be opened.

If the environment is not ready(flag is empty), this function returns "nil"

func (*GinkgoDb) NeedDb

func (g *GinkgoDb) NeedDb(src func()) func()

func (*GinkgoDb) ReleaseDbFacade

func (g *GinkgoDb) ReleaseDbFacade(dbFacade *f.DbFacade)

Releases "*db/facade/DbFacade" object by configuration of flag.

The checker object is used to trigger panic if the database cannot be released.

type ViableDbConfigFunc

type ViableDbConfigFunc func(config *commonDb.DbConfig)

This callback is used to setup a viable database configuration for testing.

Jump to

Keyboard shortcuts

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