Documentation
¶
Index ¶
- func DBConnection(t *testing.T, dbType string, dbConfig DBConfig) *sql.DB
- func DBConnectionE(t *testing.T, dbType string, dbConfig DBConfig) (*sql.DB, error)
- func DBExecution(t *testing.T, db *sql.DB, command string)
- func DBExecutionE(t *testing.T, db *sql.DB, command string) (sql.Result, error)
- func DBQuery(t *testing.T, db *sql.DB, command string) *sql.Rows
- func DBQueryE(t *testing.T, db *sql.DB, command string) (*sql.Rows, error)
- func DBQueryWithCustomValidation(t *testing.T, db *sql.DB, command string, ...)
- func DBQueryWithCustomValidationE(t *testing.T, db *sql.DB, command string, ...) error
- func DBQueryWithValidation(t *testing.T, db *sql.DB, command string, expected string)
- func DBQueryWithValidationE(t *testing.T, db *sql.DB, command string, expected string) error
- type DBConfig
- type ValidationFunctionFailed
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DBConnection ¶
DBConnection connects to the database using database configuration and database type, i.e. mssql, and then return the database. If there's any error, fail the test.
func DBConnectionE ¶
DBConnectionE connects to the database using database configuration and database type, i.e. mssql. Return the database or an error.
func DBExecution ¶
DBExecution executes specific SQL commands, i.e. insertion. If there's any error, fail the test.
func DBExecutionE ¶
DBExecutionE executes specific SQL commands, i.e. insertion. Return the result or an error.
func DBQuery ¶
DBQuery queries from database, i.e. selection, and then return the result. If there's any error, fail the test.
func DBQueryWithCustomValidation ¶
func DBQueryWithCustomValidation(t *testing.T, db *sql.DB, command string, validateResponse func(*sql.Rows) bool)
DBQueryWithCustomValidation queries from database and validate whether the result meets the requirement. If there's any error, fail the test.
func DBQueryWithCustomValidationE ¶
func DBQueryWithCustomValidationE(t *testing.T, db *sql.DB, command string, validateResponse func(*sql.Rows) bool) error
DBQueryWithCustomValidationE queries from database and validate whether the result meets the requirement. If not, return an error.
func DBQueryWithValidation ¶
DBQueryWithValidation queries from database and validate whether the result is the same as expected text. If there's any error, fail the test.
Types ¶
type DBConfig ¶
type DBConfig struct {
// contains filtered or unexported fields
}
DBConfig using server name, user name, password and database name
type ValidationFunctionFailed ¶
type ValidationFunctionFailed struct {
// contains filtered or unexported fields
}
ValidationFunctionFailed is an error that occurs if the validation fails.
func (ValidationFunctionFailed) Error ¶
func (err ValidationFunctionFailed) Error() string