base

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 6 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) 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) 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