postgres

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

type Postgres struct {
	*gorp.DbMap
	*config.Postgres
}

Postgres is a wrapping struct that will hold the database mapping object from the underlying db/sql implementation (gorp) plus our service config specifically for storage.

Additionally this struct implements our storage.Client interface

func New

func New(dbConf *config.Postgres) (*Postgres, error)

New creates a new Postgres client

func (*Postgres) EmptyStorage

func (db *Postgres) EmptyStorage() error

EmptyStorage deletes all the data from the database @afiune This function is only used by our Integration Test framework

func (*Postgres) GetServiceGroups

func (db *Postgres) GetServiceGroups(
	sortField string, sortAsc bool,
	page int32, pageSize int32,
	filters map[string][]string) ([]*storage.ServiceGroupDisplay, error)

getServiceFromUniqueFields retrieve a service from the db without the need of an id

func (*Postgres) GetServiceGroupsHealthCounts

func (db *Postgres) GetServiceGroupsHealthCounts() (*storage.HealthCounts, error)

GetServiceGroupsHealthCounts retrieves the health counts from all service groups in the database

func (*Postgres) GetServices

func (db *Postgres) GetServices(
	sortField string, sortAsc bool,
	page int32, pageSize int32,
	filters map[string][]string,
) ([]*storage.Service, error)

GetServices returns a list of services

func (*Postgres) GetServicesHealthCounts

func (db *Postgres) GetServicesHealthCounts(filters map[string][]string) (*storage.HealthCounts, error)

GetServicesHealthCounts retrieves the health counts from all services in the database. This function accepts a set of filters that can be applied to the SQL query to get the health counts of a subset of the services in the database

func (*Postgres) IngestHabEvent

func (db *Postgres) IngestHabEvent(event *applications.HabService) error

IngestHabEvents process habitat events and store them into the database

func (*Postgres) IngestHabEventWithoutMetrics

func (db *Postgres) IngestHabEventWithoutMetrics(event *applications.HabService) error

IngestHabEvents process habitat events and store them into the database

func (*Postgres) ServiceGroupExists

func (db *Postgres) ServiceGroupExists(id string) (string, bool)

ServiceGroupExists returns the name of the service group if it exists

Jump to

Keyboard shortcuts

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