postgres

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbConnectionFailedMsg = "db connection failed"
	InsertQueryFailedMsg  = "insert query failed"
	SettingNodeFailedMsg  = "unable to set db node"
)

Variables

This section is empty.

Functions

func ErrDBConnectionFailed

func ErrDBConnectionFailed(connectErr error) error

func ErrDBInsertFailed

func ErrDBInsertFailed(insertErr error) error

func ErrUnableToSetNode

func ErrUnableToSetNode(setErr error) error

Types

type DB

type DB struct {
	*sqlx.DB
	Node   core.Node
	NodeID int64
}

DB is a wrapper around the sqlx.DB which associates node information with the connection pool

func NewDB

func NewDB(databaseConfig config.Database, node core.Node) (*DB, error)

NewDB returns a new DB for the provided database config and node info

func (*DB) CreateNode

func (db *DB) CreateNode(node *core.Node) error

CreateNode inserts the node info into the database

Jump to

Keyboard shortcuts

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