db

package
v0.0.0-...-5fbed63 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amm

type Amm struct {
	AmmID         int64  `json:"amm_id"`
	DexName       string `json:"dex_name"`
	RouterAddress string `json:"router_address"`
	Key           string `json:"key"`
	AlgorithmType string `json:"algorithm_type"`
	// initialized
	CreatedAt time.Time `json:"created_at"`
}

type CreateAmmParams

type CreateAmmParams struct {
	DexName       string `json:"dex_name"`
	RouterAddress string `json:"router_address"`
	Key           string `json:"key"`
	AlgorithmType string `json:"algorithm_type"`
}

type CreatePoolParams

type CreatePoolParams struct {
	Address string `json:"address"`
	AmmID   int64  `json:"amm_id"`
	TokenA  string `json:"token_a"`
	TokenB  string `json:"token_b"`
}

type CreateTokenParams

type CreateTokenParams struct {
	Address  string `json:"address"`
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int32  `json:"decimals"`
	Ticker   string `json:"ticker"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetPoolByAddressExtraParams

type GetPoolByAddressExtraParams struct {
	Address   string         `json:"address"`
	ExtraData sql.NullString `json:"extra_data"`
}

type GetPoolsByPairParams

type GetPoolsByPairParams struct {
	TokenA string `json:"token_a"`
	TokenB string `json:"token_b"`
}

type Indexer

type Indexer struct {
	ID               int32          `json:"id"`
	HashedPassword   string         `json:"hashed_password"`
	LastQueriedBlock sql.NullInt64  `json:"last_queried_block"`
	LastQueriedHash  sql.NullString `json:"last_queried_hash"`
	LastUpdated      sql.NullTime   `json:"last_updated"`
}

type InitIndexerParams

type InitIndexerParams struct {
	HashedPassword   string         `json:"hashed_password"`
	LastQueriedBlock sql.NullInt64  `json:"last_queried_block"`
	LastQueriedHash  sql.NullString `json:"last_queried_hash"`
}

type Pool

type Pool struct {
	PoolID           int64          `json:"pool_id"`
	Address          string         `json:"address"`
	AmmID            int64          `json:"amm_id"`
	TokenA           string         `json:"token_a"`
	TokenB           string         `json:"token_b"`
	ReserveA         string         `json:"reserve_a"`
	ReserveB         string         `json:"reserve_b"`
	Fee              string         `json:"fee"`
	TotalValue       string         `json:"total_value"`
	ExtraData        sql.NullString `json:"extra_data"`
	GeneralExtraData sql.NullString `json:"general_extra_data"`
	LastUpdated      time.Time      `json:"last_updated"`
	LastBlock        int64          `json:"last_block"`
}

type Querier

type Querier interface {
	CreateAmm(ctx context.Context, arg CreateAmmParams) (Amm, error)
	CreatePool(ctx context.Context, arg CreatePoolParams) (Pool, error)
	CreateToken(ctx context.Context, arg CreateTokenParams) (Token, error)
	DeleteAmm(ctx context.Context, ammID int64) error
	DeletePool(ctx context.Context, poolID int64) error
	DeleteToken(ctx context.Context, address string) error
	GetAllAmms(ctx context.Context) ([]Amm, error)
	GetAllPools(ctx context.Context) ([]Pool, error)
	GetAllPoolsWithoutKeys(ctx context.Context) ([]Pool, error)
	GetAllTokens(ctx context.Context) ([]Token, error)
	GetAllTokensWithTickers(ctx context.Context) ([]Token, error)
	GetAmmByDEX(ctx context.Context, dexName string) ([]Amm, error)
	GetAmmById(ctx context.Context, ammID int64) (Amm, error)
	GetAmmKeys(ctx context.Context) ([]string, error)
	GetBaseTokens(ctx context.Context) ([]Token, error)
	GetHashedIndexerPwd(ctx context.Context) (string, error)
	GetIndexerStatus(ctx context.Context) (Indexer, error)
	GetKeys(ctx context.Context) ([]string, error)
	GetNativeTokens(ctx context.Context) ([]Token, error)
	GetPoolByAddress(ctx context.Context, address string) (Pool, error)
	GetPoolByAddressExtra(ctx context.Context, arg GetPoolByAddressExtraParams) (Pool, error)
	GetPoolsByAmm(ctx context.Context, ammID int64) ([]Pool, error)
	GetPoolsByPair(ctx context.Context, arg GetPoolsByPairParams) ([]Pool, error)
	GetPoolsByToken(ctx context.Context, tokenA string) ([]Pool, error)
	GetTokenAPriceByPool(ctx context.Context, poolID int64) (string, error)
	GetTokenBPriceByPool(ctx context.Context, poolID int64) (string, error)
	GetTokenByAddress(ctx context.Context, address string) (Token, error)
	GetTokenBySymbol(ctx context.Context, symbol string) (Token, error)
	InitIndexer(ctx context.Context, arg InitIndexerParams) (Indexer, error)
	UpdateBaseNativeStatus(ctx context.Context, arg UpdateBaseNativeStatusParams) (Token, error)
	UpdateIndexerStatus(ctx context.Context, arg UpdateIndexerStatusParams) (Indexer, error)
	UpdatePoolExtraData(ctx context.Context, arg UpdatePoolExtraDataParams) (Pool, error)
	UpdatePoolFee(ctx context.Context, arg UpdatePoolFeeParams) (Pool, error)
	UpdatePoolGeneralExtraData(ctx context.Context, arg UpdatePoolGeneralExtraDataParams) (Pool, error)
	UpdatePoolReserves(ctx context.Context, arg UpdatePoolReservesParams) (Pool, error)
	UpdatePoolReservesWithExtraData(ctx context.Context, arg UpdatePoolReservesWithExtraDataParams) (Pool, error)
	UpdatePoolTV(ctx context.Context, arg UpdatePoolTVParams) (Pool, error)
	UpdatePrice(ctx context.Context, arg UpdatePriceParams) (Token, error)
	UpdateTicker(ctx context.Context, arg UpdateTickerParams) (Token, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateAmm

func (q *Queries) CreateAmm(ctx context.Context, arg CreateAmmParams) (Amm, error)

func (*Queries) CreatePool

func (q *Queries) CreatePool(ctx context.Context, arg CreatePoolParams) (Pool, error)

func (*Queries) CreateToken

func (q *Queries) CreateToken(ctx context.Context, arg CreateTokenParams) (Token, error)

func (*Queries) DeleteAmm

func (q *Queries) DeleteAmm(ctx context.Context, ammID int64) error

func (*Queries) DeletePool

func (q *Queries) DeletePool(ctx context.Context, poolID int64) error

func (*Queries) DeleteToken

func (q *Queries) DeleteToken(ctx context.Context, address string) error

func (*Queries) GetAllAmms

func (q *Queries) GetAllAmms(ctx context.Context) ([]Amm, error)

func (*Queries) GetAllPools

func (q *Queries) GetAllPools(ctx context.Context) ([]Pool, error)

func (*Queries) GetAllPoolsWithoutKeys

func (q *Queries) GetAllPoolsWithoutKeys(ctx context.Context) ([]Pool, error)

func (*Queries) GetAllTokens

func (q *Queries) GetAllTokens(ctx context.Context) ([]Token, error)

func (*Queries) GetAllTokensWithTickers

func (q *Queries) GetAllTokensWithTickers(ctx context.Context) ([]Token, error)

func (*Queries) GetAmmByDEX

func (q *Queries) GetAmmByDEX(ctx context.Context, dexName string) ([]Amm, error)

func (*Queries) GetAmmById

func (q *Queries) GetAmmById(ctx context.Context, ammID int64) (Amm, error)

func (*Queries) GetAmmKeys

func (q *Queries) GetAmmKeys(ctx context.Context) ([]string, error)

func (*Queries) GetBaseTokens

func (q *Queries) GetBaseTokens(ctx context.Context) ([]Token, error)

func (*Queries) GetHashedIndexerPwd

func (q *Queries) GetHashedIndexerPwd(ctx context.Context) (string, error)

func (*Queries) GetIndexerStatus

func (q *Queries) GetIndexerStatus(ctx context.Context) (Indexer, error)

func (*Queries) GetKeys

func (q *Queries) GetKeys(ctx context.Context) ([]string, error)

func (*Queries) GetNativeTokens

func (q *Queries) GetNativeTokens(ctx context.Context) ([]Token, error)

func (*Queries) GetPoolByAddress

func (q *Queries) GetPoolByAddress(ctx context.Context, address string) (Pool, error)

func (*Queries) GetPoolByAddressExtra

func (q *Queries) GetPoolByAddressExtra(ctx context.Context, arg GetPoolByAddressExtraParams) (Pool, error)

func (*Queries) GetPoolsByAmm

func (q *Queries) GetPoolsByAmm(ctx context.Context, ammID int64) ([]Pool, error)

func (*Queries) GetPoolsByPair

func (q *Queries) GetPoolsByPair(ctx context.Context, arg GetPoolsByPairParams) ([]Pool, error)

func (*Queries) GetPoolsByToken

func (q *Queries) GetPoolsByToken(ctx context.Context, tokenA string) ([]Pool, error)

func (*Queries) GetTokenAPriceByPool

func (q *Queries) GetTokenAPriceByPool(ctx context.Context, poolID int64) (string, error)

func (*Queries) GetTokenBPriceByPool

func (q *Queries) GetTokenBPriceByPool(ctx context.Context, poolID int64) (string, error)

func (*Queries) GetTokenByAddress

func (q *Queries) GetTokenByAddress(ctx context.Context, address string) (Token, error)

func (*Queries) GetTokenBySymbol

func (q *Queries) GetTokenBySymbol(ctx context.Context, symbol string) (Token, error)

func (*Queries) InitIndexer

func (q *Queries) InitIndexer(ctx context.Context, arg InitIndexerParams) (Indexer, error)

func (*Queries) UpdateBaseNativeStatus

func (q *Queries) UpdateBaseNativeStatus(ctx context.Context, arg UpdateBaseNativeStatusParams) (Token, error)

func (*Queries) UpdateIndexerStatus

func (q *Queries) UpdateIndexerStatus(ctx context.Context, arg UpdateIndexerStatusParams) (Indexer, error)

func (*Queries) UpdatePoolExtraData

func (q *Queries) UpdatePoolExtraData(ctx context.Context, arg UpdatePoolExtraDataParams) (Pool, error)

func (*Queries) UpdatePoolFee

func (q *Queries) UpdatePoolFee(ctx context.Context, arg UpdatePoolFeeParams) (Pool, error)

func (*Queries) UpdatePoolGeneralExtraData

func (q *Queries) UpdatePoolGeneralExtraData(ctx context.Context, arg UpdatePoolGeneralExtraDataParams) (Pool, error)

func (*Queries) UpdatePoolReserves

func (q *Queries) UpdatePoolReserves(ctx context.Context, arg UpdatePoolReservesParams) (Pool, error)

func (*Queries) UpdatePoolReservesWithExtraData

func (q *Queries) UpdatePoolReservesWithExtraData(ctx context.Context, arg UpdatePoolReservesWithExtraDataParams) (Pool, error)

func (*Queries) UpdatePoolTV

func (q *Queries) UpdatePoolTV(ctx context.Context, arg UpdatePoolTVParams) (Pool, error)

func (*Queries) UpdatePrice

func (q *Queries) UpdatePrice(ctx context.Context, arg UpdatePriceParams) (Token, error)

func (*Queries) UpdateTicker

func (q *Queries) UpdateTicker(ctx context.Context, arg UpdateTickerParams) (Token, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type SQLStore

type SQLStore struct {
	*Queries
	// contains filtered or unexported fields
}

type Store

type Store interface {
	Querier
}

func NewStore

func NewStore(db *sql.DB) Store

type Token

type Token struct {
	Address   string    `json:"address"`
	Name      string    `json:"name"`
	Symbol    string    `json:"symbol"`
	Decimals  int32     `json:"decimals"`
	Base      bool      `json:"base"`
	Native    bool      `json:"native"`
	Ticker    string    `json:"ticker"`
	Price     string    `json:"price"`
	CreatedAt time.Time `json:"created_at"`
}

type UpdateBaseNativeStatusParams

type UpdateBaseNativeStatusParams struct {
	Address string `json:"address"`
	Base    bool   `json:"base"`
	Native  bool   `json:"native"`
}

type UpdateIndexerStatusParams

type UpdateIndexerStatusParams struct {
	LastQueriedBlock sql.NullInt64  `json:"last_queried_block"`
	LastQueriedHash  sql.NullString `json:"last_queried_hash"`
}

type UpdatePoolExtraDataParams

type UpdatePoolExtraDataParams struct {
	PoolID    int64          `json:"pool_id"`
	ExtraData sql.NullString `json:"extra_data"`
}

type UpdatePoolFeeParams

type UpdatePoolFeeParams struct {
	PoolID int64  `json:"pool_id"`
	Fee    string `json:"fee"`
}

type UpdatePoolGeneralExtraDataParams

type UpdatePoolGeneralExtraDataParams struct {
	PoolID           int64          `json:"pool_id"`
	GeneralExtraData sql.NullString `json:"general_extra_data"`
	LastBlock        int64          `json:"last_block"`
}

type UpdatePoolReservesParams

type UpdatePoolReservesParams struct {
	PoolID    int64  `json:"pool_id"`
	ReserveA  string `json:"reserve_a"`
	ReserveB  string `json:"reserve_b"`
	LastBlock int64  `json:"last_block"`
}

type UpdatePoolReservesWithExtraDataParams

type UpdatePoolReservesWithExtraDataParams struct {
	PoolID    int64          `json:"pool_id"`
	ExtraData sql.NullString `json:"extra_data"`
	LastBlock int64          `json:"last_block"`
}

type UpdatePoolTVParams

type UpdatePoolTVParams struct {
	PoolID     int64  `json:"pool_id"`
	TotalValue string `json:"total_value"`
}

type UpdatePriceParams

type UpdatePriceParams struct {
	Address string `json:"address"`
	Price   string `json:"price"`
}

type UpdateTickerParams

type UpdateTickerParams struct {
	Address string `json:"address"`
	Ticker  string `json:"ticker"`
}

Jump to

Keyboard shortcuts

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