connection

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package connection contains the PGSQLConnection type and methods for manipulating and querying a PostgreSQL connection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info interface {
	NewConnection(database string) (*PGSQLConnection, error)
	Hostname() string
}

Info holds all the information needed from the user to create a new connection

func DefaultConnectionInfo

func DefaultConnectionInfo(al *args.ArgumentList) Info

DefaultConnectionInfo takes an argument list and constructs a default connection out of it

type MockInfo

type MockInfo struct {
	mock.Mock
}

MockInfo is a mock struct which implements connection.Info

func (*MockInfo) Hostname added in v0.2.3

func (mi *MockInfo) Hostname() string

Hostname returns a mocked host name "testhost"

func (*MockInfo) NewConnection

func (mi *MockInfo) NewConnection(database string) (*PGSQLConnection, error)

NewConnection creates a new mock info connection from the mockinfo struct

type PGSQLConnection

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

PGSQLConnection represents a wrapper around a PostgreSQL connection

func CreateMockSQL

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

CreateMockSQL creates a Test SQLConnection. Must Close con when done

func (PGSQLConnection) Close

func (p PGSQLConnection) Close()

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

func (PGSQLConnection) Query

func (p PGSQLConnection) 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