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) HostPort() (string, string) DatabaseName() 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 ¶
MockInfo is a mock struct which implements connection.Info
func (*MockInfo) DatabaseName ¶
DatabaseName returns a mocked database name "postgres"
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) HaveExtensionInSchema ¶
func (p PGSQLConnection) HaveExtensionInSchema(extensionName, schemaName string) bool
HaveExtensionInSchema checks to see if the given Extension is installed on the current database in the given schema
func (PGSQLConnection) Query ¶
func (p PGSQLConnection) Query(v interface{}, query string) error
Query runs a query and loads results into v