postgres

package
v0.0.0-...-b14eccf Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	squirrel.StatementBuilderType
	// contains filtered or unexported fields
}

DB is a postgres db, for dev and production

func New

func New(uri, migrationsDir string) (DB, error)

New creates a new postgres DB

func (DB) Close

func (d DB) Close() error

Close finishes using the db

func (DB) GetAllConfigs

func (d DB) GetAllConfigs() (map[string]configs.View, error)

GetAllConfigs gets all of the configs.

func (DB) GetConfig

func (d DB) GetConfig(userID string) (configs.View, error)

GetConfig gets a configuration.

func (DB) GetConfigs

func (d DB) GetConfigs(since configs.ID) (map[string]configs.View, error)

GetConfigs gets all of the configs that have changed recently.

func (DB) SetConfig

func (d DB) SetConfig(userID string, cfg configs.Config) error

SetConfig sets a configuration.

func (DB) Transaction

func (d DB) Transaction(f func(DB) error) error

Transaction runs the given function in a postgres transaction. If fn returns an error the txn will be rolled back.

Jump to

Keyboard shortcuts

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