base

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package base contains the base sql implementation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OriginTxHashFieldName gets the burn tx hash field name.
	OriginTxHashFieldName string
	// DestTxHashFieldName gets the burn tx hash field name.
	DestTxHashFieldName string
	// NonceFieldName gets the mint tx hash field name.
	NonceFieldName string
	// OriginChainIDFieldName gets the origin chain ID field name.
	OriginChainIDFieldName string
	// DestChainIDFieldName gets the destination chain ID field name.
	DestChainIDFieldName string
	// MessageFieldName gets the message field name.
	MessageFieldName string
	// MessageHashFieldName gets the message hash field name.
	MessageHashFieldName string
	// AttestationFieldName gets the signature field name.
	AttestationFieldName string
	// RequestVersionFieldName gets the request version field name.
	RequestVersionFieldName string
	// FormattedRequestFieldName gets the formatted request field name.
	FormattedRequestFieldName string
	// RequestIDFieldName gets the request id field name.
	RequestIDFieldName string
	// BlockNumberFieldName gets the block number field name.
	BlockNumberFieldName string
	// StateFieldName gets the state field name.
	StateFieldName string
)

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) GetLastBlockNumber

func (s Store) GetLastBlockNumber(ctx context.Context, chainID uint32) (uint64, error)

GetLastBlockNumber gets the last block number that had a message in the database.

func (Store) GetMessageByOriginHash

func (s Store) GetMessageByOriginHash(ctx context.Context, originHash common.Hash) (*types.Message, error)

GetMessageByOriginHash gets a message by its origin hash. TODO: this is actually non-unique, but we only return 1.

func (Store) GetMessageByRequestID added in v0.0.9

func (s Store) GetMessageByRequestID(ctx context.Context, requestID string) (*types.Message, error)

GetMessageByRequestID gets a message by its request id.

func (Store) GetMessagesByState

func (s Store) GetMessagesByState(ctx context.Context, states ...types.MessageState) ([]types.Message, error)

GetMessagesByState gets messages by state.

func (Store) StoreMessage

func (s Store) StoreMessage(ctx context.Context, msg types.Message) error

StoreMessage stores a message in the database.

func (Store) SubmitterDB

func (s Store) SubmitterDB() submitterDB.Service

SubmitterDB gets the submitter database object for mutation outside of the lib.

Jump to

Keyboard shortcuts

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