db

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package db implements the data store

db ├── db.go: Houses the interface in which the database can be interacted with. All functions for both read/write/util are here. ├── read_test.go: All the tests for the read operations for the database (its testing all the functions in the `Reader` interface in db.go). ├── write_test.go: All the tests for the write operations for the database (its testing all the functions in the `Writer` interface in db.go). ├── suite_test.go: Sets up the test environment (inits databases). ├── sql: Contains all implementations from `db.go` and the init functions for both mysql and sqlite. │ ├── base: Holds all the implementations of `Reader` and `Writer`. Also has the database init functionality. │ ├── mysql: Mysql init functionality. │ └── sqlite: Sqlite init functionality. └── model: Has all the models for each table, as well as all the namer initializing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	Writer
	Reader
	SubmitterDB() submitterDB.Service
}

DB stores events.

type Reader

type Reader interface {
	GetOriginBridgeEvent(ctx context.Context, transactionID string) (*model.OriginBridgeEvent, error)
	GetDestinationBridgeEvent(ctx context.Context, transactionID string) (*model.DestinationBridgeEvent, error)
	GetLastIndexed(ctx context.Context, chainID uint32, address common.Address) (uint64, error)
	GetToken(ctx context.Context, tokenID string) (*model.Token, error)
	GetDeadlineQueueEvents(ctx context.Context) ([]*model.DeadlineQueue, error)
}

Reader is an interface for reading events from a database.

type TestDB

type TestDB interface {
	DB
	// UNSAFE_DB gets the underlying gorm db. This is not intended for use in production.
	//
	//nolint:golint
	UNSAFE_DB() *gorm.DB
}

TestDB is a test database interface that exports the underlying gorm db. This should only be used for testing.

type Writer

type Writer interface {
	StoreOriginBridgeEvent(ctx context.Context, chainID uint32, log *types.Log, event *bindings.FastBridgeBridgeRequested) error
	StoreDestinationBridgeEvent(ctx context.Context, log *types.Log, originEvent *model.OriginBridgeEvent) error
	StoreLastIndexed(ctx context.Context, contractAddress common.Address, chainID uint32, blockNumber uint64) error
	StoreToken(ctx context.Context, token *model.Token) error
	StoreDeadlineQueueEvent(ctx context.Context, entry *model.DeadlineQueue) error
	RemoveDeadlineQueueEvent(ctx context.Context, eventID string) error
}

Writer is an interface for writing events to a database.

Directories

Path Synopsis
Package model holds all the models for the database.
Package model holds all the models for the database.
sql
base
Package base contains the base sql implementation
Package base contains the base sql implementation
mysql
Package mysql implements the mysql implementation of the sql store.
Package mysql implements the mysql implementation of the sql store.
sqlite
Package sqlite implements the sqlite implementation of the sql store.
Package sqlite implements the sqlite implementation of the sql store.

Jump to

Keyboard shortcuts

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