postgres

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *sql.DB) error

Migrate ensures that the database has the current schema required for using any of the postgres storage

Types

type JobStore

type JobStore struct {
	DB *sql.DB
}

JobStore stores jobs in a Postgres database

func NewJobStore

func NewJobStore(db *sql.DB) (*JobStore, error)

NewJobStore creates a new SQL job store

func (*JobStore) Find

func (s *JobStore) Find(ctx context.Context, filter []*v1.FilterExpression, order []*v1.OrderExpression, start, limit int) (slice []v1.JobStatus, total int, err error)

Find searches for jobs based on their annotations. If filter is empty no filter is applied.

func (*JobStore) Get

func (s *JobStore) Get(ctx context.Context, name string) (*v1.JobStatus, error)

Get retrieves a particular job bassd on its name.

func (*JobStore) GetJobSpec added in v0.0.2

func (s *JobStore) GetJobSpec(name string) ([]byte, error)

GetJobSpec retrieves a particular job bassd on its name.

func (*JobStore) Store

func (s *JobStore) Store(ctx context.Context, job v1.JobStatus) error

Store stores job information in the store.

func (*JobStore) StoreJobSpec added in v0.0.2

func (s *JobStore) StoreJobSpec(name string, data []byte) error

StoreJobSpec stores job information in the store.

type NumberGroup

type NumberGroup struct {
	DB *sql.DB
}

NumberGroup provides postgres backed number groups

func NewNumberGroup

func NewNumberGroup(db *sql.DB) (*NumberGroup, error)

NewNumberGroup creates a new SQL number group store

func (*NumberGroup) Latest

func (ngrp *NumberGroup) Latest(group string) (nr int, err error)

Latest returns the latest number of a particular number group.

func (*NumberGroup) Next

func (ngrp *NumberGroup) Next(group string) (nr int, err error)

Next returns the next number in the group.

Jump to

Keyboard shortcuts

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