base

package
v1.39.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package base contains the base sql implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllModels

func GetAllModels() (allModels []interface{})

GetAllModels gets all models to migrate. see: https://medium.com/@SaifAbid/slice-interfaces-8c78f8b6345d for an explanation of why we can't do this at initialization time

Types

type Store

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

Store is a store that implements an underlying gorm db.

func NewStore

func NewStore(db *gorm.DB, metrics metrics.Handler) *Store

NewStore creates a new store.

func (Store) DB

func (s Store) DB() *gorm.DB

DB gets the database object for mutation outside of the lib.

func (*Store) GetActiveQuoteRequests added in v1.29.0

func (s *Store) GetActiveQuoteRequests(ctx context.Context, matchStatuses ...db.ActiveQuoteRequestStatus) ([]*db.ActiveQuoteRequest, error)

GetActiveQuoteRequests gets active quote requests from the database.

func (*Store) GetAllQuotes

func (s *Store) GetAllQuotes(ctx context.Context) ([]*db.Quote, error)

GetAllQuotes retrieves all quotes from the database.

func (*Store) GetQuotesByDestChainAndToken

func (s *Store) GetQuotesByDestChainAndToken(ctx context.Context, destChainID uint64, destTokenAddr string) ([]*db.Quote, error)

GetQuotesByDestChainAndToken gets quotes from the database by destination chain and token.

func (*Store) GetQuotesByOriginAndDestination

func (s *Store) GetQuotesByOriginAndDestination(ctx context.Context, originChainID uint64, originTokenAddr string, destChainID uint64, destTokenAddr string) ([]*db.Quote, error)

GetQuotesByOriginAndDestination gets quotes from the database by origin and destination.

func (*Store) GetQuotesByRelayerAddress

func (s *Store) GetQuotesByRelayerAddress(ctx context.Context, relayerAddr string) ([]*db.Quote, error)

GetQuotesByRelayerAddress gets quotes from the database by relayer address.

func (*Store) InsertActiveQuoteRequest added in v1.29.0

func (s *Store) InsertActiveQuoteRequest(ctx context.Context, req *model.PutRFQRequest, requestID string) error

InsertActiveQuoteRequest inserts an active quote request into the database.

func (*Store) InsertActiveQuoteResponse added in v1.29.0

func (s *Store) InsertActiveQuoteResponse(ctx context.Context, resp *model.WsRFQResponse, relayerAddr string, status db.ActiveQuoteResponseStatus) error

InsertActiveQuoteResponse inserts an active quote response into the database.

func (*Store) UpdateActiveQuoteRequestStatus added in v1.29.0

func (s *Store) UpdateActiveQuoteRequestStatus(ctx context.Context, requestID string, quoteID *string, status db.ActiveQuoteRequestStatus) error

UpdateActiveQuoteRequestStatus updates the status of an active quote request in the database.

func (*Store) UpdateActiveQuoteResponseStatus added in v1.29.0

func (s *Store) UpdateActiveQuoteResponseStatus(ctx context.Context, quoteID string, status db.ActiveQuoteResponseStatus) error

UpdateActiveQuoteResponseStatus updates the status of an active quote response in the database.

func (*Store) UpsertQuote

func (s *Store) UpsertQuote(ctx context.Context, quote *db.Quote) error

UpsertQuote inserts a new quote into the database or updates an existing one.

func (*Store) UpsertQuotes added in v0.29.13

func (s *Store) UpsertQuotes(ctx context.Context, quotes []*db.Quote) error

UpsertQuotes inserts multiple quotes into the database or updates existing ones.

Jump to

Keyboard shortcuts

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