postgresql

package
v0.0.0-...-929fa67 Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Postgres = "postgres"

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db struct {
	*sql.DB
	// contains filtered or unexported fields
}

Db needed to add new methods for an instance *sql.Db

func Connect

func Connect(dataSource string) (*Db, error)

Connect after prepare to the Db

func (*Db) AddSymbol

func (d *Db) AddSymbol(s, u string) (sql.Result, error)

func (*Db) AddTask

func (d *Db) AddTask(ctx context.Context, n string, i int64) (sql.Result, error)

func (*Db) Close

func (d *Db) Close() error

Close Db connection

func (*Db) DataPipe

func (d *Db) DataPipe() chan *domain.Data

func (*Db) GetLast

func (d *Db) GetLast(from string, to string) (*domain.Data, error)

GetLast row with the most recent data for the selected currencies pair

func (*Db) GetSession

func (d *Db) GetSession(ctx context.Context) (map[string]int64, error)

func (*Db) Insert

func (d *Db) Insert(data *domain.Data) (sql.Result, error)

Insert clients.Data from the clients.DataPipe to the Db

func (*Db) RemoveSymbol

func (d *Db) RemoveSymbol(s string) (sql.Result, error)

func (*Db) RemoveTask

func (d *Db) RemoveTask(ctx context.Context, n string) (sql.Result, error)

func (*Db) Symbols

func (d *Db) Symbols() ([]*domain.Symbol, error)

func (*Db) UpdateSymbol

func (d *Db) UpdateSymbol(s, u string) (sql.Result, error)

func (*Db) UpdateTask

func (d *Db) UpdateTask(ctx context.Context, n string, i int64) (sql.Result, error)

Jump to

Keyboard shortcuts

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