postgres

package
v3.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package postgres is a baur-storage implementation storing data in postgresql.

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(ctx context.Context, url string, logger Logger) (*Client, error)

New returns a new postgres client. If logger is nil, logging is disabled.

func (*Client) Close

func (c *Client) Close() error

Close closes the connections of the client. It always returns a nil error.

func (*Client) Init

func (c *Client) Init(ctx context.Context) error

Init creates the baur tables in the postgresql database. If the database already exist, storage.ErrExist is returned.

func (*Client) Inputs

func (c *Client) Inputs(ctx context.Context, taskRunID int) (*storage.Inputs, error)

func (*Client) IsCompatible

func (c *Client) IsCompatible(ctx context.Context) error

IsCompatible checks if the database schema exist and has the required migration version.

func (*Client) LatestTaskRunByDigest

func (c *Client) LatestTaskRunByDigest(ctx context.Context, appName, taskName, totalInputDigest string) (*storage.TaskRunWithID, error)

func (*Client) Outputs

func (c *Client) Outputs(ctx context.Context, taskRunID int) ([]*storage.Output, error)

func (*Client) RequiredSchemaVersion

func (c *Client) RequiredSchemaVersion() int32

func (*Client) SaveTaskRun

func (c *Client) SaveTaskRun(ctx context.Context, taskRun *storage.TaskRunFull) (int, error)

func (*Client) SchemaVersion

func (c *Client) SchemaVersion(ctx context.Context) (int32, error)

func (*Client) TaskRun

func (c *Client) TaskRun(ctx context.Context, id int) (*storage.TaskRunWithID, error)

func (*Client) TaskRuns

func (c *Client) TaskRuns(
	ctx context.Context,
	filters []*storage.Filter,
	sorters []*storage.Sorter,
	limit uint,
	cb func(*storage.TaskRunWithID) error,
) error

func (*Client) Upgrade

func (c *Client) Upgrade(ctx context.Context) error

Upgrade transitions the database schema to the current version by running all migrations sql script that have a newer version then current schema version that the database uses. If the database does not exist, storage.ErrNotExist is returned.

type Logger

type Logger interface {
	Debugln(v ...any)
}

Logger is an interface for logging debug informations

Jump to

Keyboard shortcuts

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