postgres

package
v0.0.0-...-4a2620c Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DDL = `` /* 659-byte string literal not displayed */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Pool *pgxpool.Pool
}

Store ...

func New

func New(dsn string) (s *Store, err error)

New ...

func (*Store) Drop

func (s *Store) Drop(ctx context.Context) error

Drop clears database (for testing purpose onle)

func (*Store) GetAggregates

func (s *Store) GetAggregates(ctx context.Context) (*models.Totals, []models.Delay, error)

GetAggregates extracts statistics about finished and declined tasks and its delay

func (*Store) Init

func (s *Store) Init(ctx context.Context) error

Init creates schema, type and tables

func (*Store) Insert

func (s *Store) Insert(ctx context.Context, msg *models.Message) error

Insert adds event about task that has not been stored yet

func (*Store) Select

func (s *Store) Select(ctx context.Context, taskID uint64) (*models.Message, error)

Select extracts an event with specified ID

func (*Store) Update

func (s *Store) Update(ctx context.Context, msg *models.Message) error

Update changes event about particular task in database with msg values

func (*Store) UpdateDelay

func (s *Store) UpdateDelay(ctx context.Context, msg *models.Message) error

UpdateDelay sets data about particular task in database with msg values and calculated delay

Jump to

Keyboard shortcuts

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