connection

package
v0.0.0-...-6c124c7 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package connection contains the SQLConnection type and methods for manipulating and querying the connection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConnectionURL

func CreateConnectionURL(args *args.ArgumentList) string

CreateConnectionURL tags in args and creates the connection string. All args should be validated before calling this.

Types

type SQLConnection

type SQLConnection struct {
	Connection *sqlx.DB
	Host       string
}

SQLConnection represents a wrapper around a SQL Server connection

func CreateMockSQL

func CreateMockSQL(t *testing.T) (con *SQLConnection, mock sqlmock.Sqlmock)

CreateMockSQL creates a Test SQLConnection. Must Close con when done

func NewConnection

func NewConnection(args *args.ArgumentList) (*SQLConnection, error)

NewConnection creates a new SQLConnection from args

func (SQLConnection) Close

func (sc SQLConnection) Close()

Close closes the SQL connection. If an error occurs it is logged as a warning.

func (SQLConnection) Query

func (sc SQLConnection) Query(v interface{}, query string) error

Query runs a query and loads results into v

Jump to

Keyboard shortcuts

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