psql

package
v0.0.0-...-4870372 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package psql contains generic psql methods to be eventually reused

Index

Constants

View Source
const (

	// Environment represents Environment parameter
	Environment = "Environment"

	// Host represents Host parameter
	Host = "Host"

	// User represents User parameter
	User = "User"

	// DBName represents DbName parameter
	DBName = "DbName"

	// SSLMode represents SSLMode parameter
	SSLMode = "SSLMode"

	// DriverName represents DriverName parameter
	DriverName = "DriverName"

	// Query represents Query parameter
	Query = "query"

	// TableContent represents TableContent parameter
	TableContent = "tableContent"
)
View Source
const CONNECTIONSTRING = "host=%s user=%s dbname=%s sslmode=%s"

CONNECTIONSTRING represents the default psql string to be filled

View Source
const (

	// ErrEmptyParameter is used when a required parameter is empty
	ErrEmptyParameter = "EmptyParameter"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PSQL

type PSQL struct {
	*sql.DB
}

PSQL embeds connection to psql database

func New

func New(cfg *configuration.Configuration) (*PSQL, error)

New returns a new *PSQL initialized with the configuration

func (*PSQL) CreateTable

func (svc *PSQL) CreateTable(query string) error

CreateTable creates a table given a query containing the SQL syntax to create a table. E.g. : `CREATE TABLE example (someKey text PRIMARY KEY, someField text)`

func (*PSQL) InsertInto

func (svc *PSQL) InsertInto(query string) error

InsertInto inserts a row into a table

func (*PSQL) SetDB

func (svc *PSQL) SetDB(dbSession *sql.DB) *PSQL

SetDB sets the DB to PSQL

Jump to

Keyboard shortcuts

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