postgres

package
v0.0.0-...-4f83aec Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2016 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

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

Factory is initialized with the config file and then used to make client data objects of the appropriate type when clients are created.

func NewFactory

func NewFactory(databaseLogin, databasePassword, databaseName, databaseIP, databasePort string) (*Factory, error)

NewFactory creates a new clientdata factory using a postgres datastore.

func (*Factory) Create

func (cdf *Factory) Create(name string) clientdata.ClientData

Create returns a ClientData object of the type for the factory.

type Postgres

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

Postgres is a type of datastore using a postgresql database.

func NewPostgres

func NewPostgres(databaseLogin, databasePassword, databaseName, databaseIP, databasePort string) (*Postgres, error)

NewPostgres sets up the connection to the database and returns a Postgres datastore.

func (*Postgres) Add

func (p *Postgres) Add(table string, values map[string]string) error

Add adds row values to table.

func (*Postgres) Delete

func (p *Postgres) Delete(table string, values map[string]string) error

Delete removes rows matching values from table.

func (*Postgres) Exists

func (p *Postgres) Exists(table string, values map[string]string) (bool, error)

Exists takes a table to check and a map representing a row to compare to and returns true if there is a match in the database.

func (*Postgres) Get

func (p *Postgres) Get(table string, values map[string]string, columns ...string) ([]map[string]string, error)

Get gets teh columns from the table for the rows matching values.

func (*Postgres) Set

func (p *Postgres) Set(table string, values, cond map[string]string) error

Set finds a row matching cond in table and sets the column/value pairs in values.

Jump to

Keyboard shortcuts

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