postgres

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a postgres storage client

func New

func New(url string) (*Client, error)

New establishes a connection a postgres db

func (*Client) Close

func (c *Client) Close()

Close closes the connection

func (*Client) GetAppBuildsByInputDigest

func (c *Client) GetAppBuildsByInputDigest(appName, totalInputDigest string) ([]*storage.Build, error)

GetAppBuildsByInputDigest returns all builds of an application with the given totalInputDigest. If no matching entries are found it returns storage.ErrNotExist

func (*Client) GetApps

func (c *Client) GetApps() ([]*storage.Application, error)

GetApps returns all application records ordered by Name

func (*Client) GetBuildWithoutInputs

func (c *Client) GetBuildWithoutInputs(id int) (*storage.Build, error)

GetBuildWithoutInputs retrieves a build from the database

func (*Client) GetLatestBuildByDigest

func (c *Client) GetLatestBuildByDigest(appName, totalInputDigest string) (*storage.Build, error)

GetLatestBuildByDigest returns the build id of a build for the application with the passed digest. If multiple builds exist, the one with the lastest stop_timestamp is returned. Inputs are not fetched from the database. If no builds exist sql.ErrNoRows is returned

func (*Client) GetSameTotalInputDigestsForAppBuilds

func (c *Client) GetSameTotalInputDigestsForAppBuilds(appName string, startTs time.Time) ([]string, error)

GetSameTotalInputDigestsForAppBuilds finds TotalInputDigests that are the same for builds of an app with a build start time not before startTs If not builds with the same totalInputDigest is found, an empty slice is returned.

func (*Client) Save

func (c *Client) Save(b *storage.Build) error

Save stores a build in the database, the ID field of the passed Build is ignored. The database generates a record ID and it will be stored in the passed Build.

Jump to

Keyboard shortcuts

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