db

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	GetTrades(fromBlock int64, limit uint64) ([]SolanaTradelogDB, error)
	GetTransfer(fromBlock int64, limit uint64) ([]SolanaTransferLogDb, error)
	GetMaxTradeBlockNumber() (int64, error)
	GetMaxTransferBlockNumber() (int64, error)
}

type Postgres

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

func NewPostgres

func NewPostgres(db *sqlx.DB) *Postgres

func (*Postgres) GetMaxTradeBlockNumber

func (pg *Postgres) GetMaxTradeBlockNumber() (int64, error)

func (*Postgres) GetMaxTransferBlockNumber

func (pg *Postgres) GetMaxTransferBlockNumber() (int64, error)

func (*Postgres) GetTrades

func (pg *Postgres) GetTrades(fromBlock int64, limit uint64) ([]SolanaTradelogDB, error)

func (*Postgres) GetTransfer

func (pg *Postgres) GetTransfer(fromBlock int64, limit uint64) ([]SolanaTransferLogDb, error)

type SolanaTradelogDB

type SolanaTradelogDB struct {
	BlockTimestamp time.Time `db:"block_timestamp"`
	BlockNumber    uint64    `db:"block_number"`
	TxHash         string    `db:"tx_hash"`
	Sender         string    `db:"sender"`

	TokenInAddress  string  `db:"token_in_address"`
	TokenInAmount   float64 `db:"token_in_amount"`
	TokenInUsdtRate float64 `db:"token_in_usdt_rate"`

	TokenOutAddress  string  `db:"token_out_address"`
	TokenOutAmount   float64 `db:"token_out_amount"`
	TokenOutUsdtRate float64 `db:"token_out_usdt_rate"`

	SolUsdtRate float64 `db:"sol_usdt_rate"`

	Created time.Time `db:"created"`
}

func (SolanaTradelogDB) Convert

type SolanaTransferLogDb

type SolanaTransferLogDb struct {
	BlockTimestamp time.Time `db:"block_timestamp"`
	BlockNumber    uint64    `db:"block_number"`
	TxHash         string    `db:"tx_hash"`
	FromAddress    string    `db:"from_address"`
	ToAddress      string    `db:"to_address"`

	TokenAddress string  `db:"token_address"`
	TokenAmount  float64 `db:"token_amount"`

	IsCexIn bool      `db:"is_cex_in"`
	Created time.Time `db:"created"`
}

func (SolanaTransferLogDb) Convert

Jump to

Keyboard shortcuts

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