postgres

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: GPL-2.0 Imports: 7 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 {
	Db *sql.DB
}

Client is a postgres storage client

func New

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

New establishes a connection a postgres db

func (*Client) BuildExist added in v0.11.1

func (c *Client) BuildExist(id int) (bool, error)

BuildExist returns true if the build with the given ID exist.

func (*Client) Close

func (c *Client) Close()

Close closes the connection

func (*Client) GetApps

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

GetApps returns all application records ordered by Name

func (*Client) GetBuildOutputs added in v0.9.0

func (c *Client) GetBuildOutputs(buildID int) ([]*storage.Output, error)

GetBuildOutputs returns build outputs

func (*Client) GetBuildWithoutInputsOutputs added in v0.11.1

func (c *Client) GetBuildWithoutInputsOutputs(id int) (*storage.BuildWithDuration, error)

GetBuildWithoutInputsOutputs retrieves a single build from the database

func (*Client) GetBuildsWithoutInputsOutputs added in v0.11.1

func (c *Client) GetBuildsWithoutInputsOutputs(filters []*storage.Filter, sorters []*storage.Sorter) (
	[]*storage.BuildWithDuration, error)

GetBuildsWithoutInputsOutputs returns builds from the database

func (*Client) GetLatestBuildByDigest

func (c *Client) GetLatestBuildByDigest(appName, totalInputDigest string) (*storage.BuildWithDuration, 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 storage.ErrNotExist is returned

func (*Client) GetSameTotalInputDigestsForAppBuilds

func (c *Client) GetSameTotalInputDigestsForAppBuilds(appName string, startTs time.Time) (map[string][]int, 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) Init added in v0.11.1

func (c *Client) Init() error

Init creates the baur tables in the postgresql database

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.

type Query added in v0.9.0

type Query struct {
	BaseQuery string
	Filters   []*storage.Filter
	Sorters   []*storage.Sorter
}

Query is the sql query struct

func (*Query) Compile added in v0.9.0

func (q *Query) Compile() (query string, args []interface{}, err error)

Compile compiles the actual sql query and returns it along with the query params

type RowScanFunc added in v0.9.0

type RowScanFunc func(rows *sql.Rows) (interface{}, error)

RowScanFunc should run rows.Scan and return a value for that row

Jump to

Keyboard shortcuts

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