postgres

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package postgres contains repository implementations using PostgreSQL as the underlying database.

Index

Constants

This section is empty.

Variables

View Source
var ErrMigrate = errors.New("error executing database migrations")

ErrMigrate indicates error during database migrations.

Functions

func Connect

func Connect(cfg Config) (*sqlx.DB, error)

Connect creates a connection to the PostgreSQL instance and applies any unapplied database migrations. A non-nil error is returned to indicate failure.

func NewRepository

func NewRepository(db *sqlx.DB, log logger.Logger) certs.Repository

NewRepository instantiates a PostgreSQL implementation of certs repository.

Types

type Cert

type Cert struct {
	ThingID string
	Serial  string
	Expire  time.Time
}

type Config

type Config struct {
	Host        string
	Port        string
	User        string
	Pass        string
	Name        string
	SSLMode     string
	SSLCert     string
	SSLKey      string
	SSLRootCert string
}

Config defines the options that are used when connecting to a PostgreSQL instance

Jump to

Keyboard shortcuts

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