connection

package
v2.5.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: 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

func (SQLConnection) Queryx

func (sc SQLConnection) Queryx(query string) (*sqlx.Rows, error)

Queryx runs a query and returns a set of rows

Jump to

Keyboard shortcuts

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