testhelpers

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package testhelpers contains some helpers shared between different test packages

Index

Constants

View Source
const (
	AdminUser    = "sa"
	Server       = "localhost"
	TestDatabase = "testdb"
)

Variables

This section is empty.

Functions

func Connect

func Connect(username, password, database string, port int) *sql.DB

func ConnectDefaultDB

func ConnectDefaultDB(username, password string, port int) *sql.DB

func FreePort

func FreePort() int

func RandomDatabaseName

func RandomDatabaseName() string

func RandomPassword

func RandomPassword() string

func RandomSchemaName

func RandomSchemaName(prefixes ...string) string

func RandomTableName

func RandomTableName() string

func UserExists

func UserExists(db *sql.DB, username string) bool

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(
	server,
	username,
	password,
	database,
	encrypt string,
	port int,
) *Encoder

func (*Encoder) Encode

func (b *Encoder) Encode() string

func (*Encoder) EncodeWithoutDB

func (b *Encoder) EncodeWithoutDB() string

type ServerOption

type ServerOption func(db *sql.DB)

func WithDatabase

func WithDatabase() ServerOption

func WithNoop

func WithNoop() ServerOption

func WithSPConfigure

func WithSPConfigure() ServerOption

type ShutdownServerFn

type ShutdownServerFn func(time.Duration)

func StartServer

func StartServer(password string, port int, opts ...ServerOption) ShutdownServerFn

Jump to

Keyboard shortcuts

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