postgres

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cleaner

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

Cleaner cleans all records related with ID

func NewCleaner

func NewCleaner(pool *pgxpool.Pool) (*Cleaner, error)

func (*Cleaner) Clean

func (db *Cleaner) Clean(ctx context.Context, id string) error

Clean deletes all records with provided id from configured tables

type DB

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

DB provides operations with postgresql

func NewDB

func NewDB(pool *pgxpool.Pool) (*DB, error)

NewDB creates Request instance

func (*DB) DeleteWorkData

func (db *DB) DeleteWorkData(ctx context.Context, id string) error

func (*DB) InsertRequest

func (db *DB) InsertRequest(ctx context.Context, req *persistence.ReqData) error

InsertRequest inserts request into DB

func (*DB) InsertStatus

func (db *DB) InsertStatus(ctx context.Context, item *persistence.Status) error

InsertStatus inserts status into DB

func (*DB) InsertWorkData

func (db *DB) InsertWorkData(ctx context.Context, data *persistence.WorkData) error

InsertWorkData inserts data into DB

func (*DB) Live

func (db *DB) Live(ctx context.Context) error

Live returns no error if db is reachable and initialized

func (*DB) LoadRequest

func (db *DB) LoadRequest(ctx context.Context, id string) (*persistence.ReqData, error)

LoadRequest loads request from DB

func (*DB) LoadStatus

func (db *DB) LoadStatus(ctx context.Context, id string) (*persistence.Status, error)

LoadStatus loads work info from DB

func (*DB) LoadWorkData

func (db *DB) LoadWorkData(ctx context.Context, id string) (*persistence.WorkData, error)

LoadWorkData loads work info from DB

func (*DB) LockEmailTable

func (db *DB) LockEmailTable(ctx context.Context, ID string, key string) error

LockEmailTable inserts record to db and marks it as working

func (*DB) UnLockEmailTable

func (db *DB) UnLockEmailTable(ctx context.Context, ID string, key string, value int) error

UnLockEmailTable replaces table status with value

func (*DB) UpdateStatus

func (db *DB) UpdateStatus(ctx context.Context, item *persistence.Status) error

UpdateStatus updates status into DB

func (*DB) UpdateWorkData

func (db *DB) UpdateWorkData(ctx context.Context, data *persistence.WorkData) error

UpdateWorkData updates workdata

type DBIdsProvider

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

DBIdsProvider provides expired IDs from postgresql

func NewDBIdsProvider

func NewDBIdsProvider(pool *pgxpool.Pool, expiresAfter time.Duration) (*DBIdsProvider, error)

NewDB creates Request instance

func (*DBIdsProvider) GetExpired

func (db *DBIdsProvider) GetExpired(ctx context.Context) ([]string, error)

InsertRequest inserts request into DB

type Sender

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

Sender performs messages sending using postgress gue

func NewSender

func NewSender(pool *pgxpool.Pool) (*Sender, error)

NewSender initializes gue sender

func (*Sender) SendMessage

func (sender *Sender) SendMessage(ctx context.Context, msg amessages.Message, opts *messages.Options) error

SendMessage sends the message with

Jump to

Keyboard shortcuts

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