stores

package
v0.0.0-...-c40edbd Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_PENDING    = "pending"
	STATUS_FAILED     = "failed"
	STATUS_PROCESSING = "processing"
	STATUS_DONE       = "done"
	STATUS_PROCESSED  = "processed"
)

Variables

This section is empty.

Functions

func MustConnectDatabase

func MustConnectDatabase(dbConfig *Database, testing bool) (*gorm.DB, error)

func MustConnectDatabaseWithName

func MustConnectDatabaseWithName(dbConfig *Database, dbName string, testing bool) (*gorm.DB, error)

func NewEventStore

func NewEventStore(db *gorm.DB) *eventStore

func NewJobStore

func NewJobStore(db *gorm.DB) *jobStore

func NewProcessedBlockStore

func NewProcessedBlockStore(db *gorm.DB) *processedBlockStore

Types

type Database

type Database struct {
	Host     string `json:"host"`
	User     string `json:"user"`
	Password string `json:"password"`
	DBName   string `json:"dbName"`
	Port     int    `json:"port"`

	ConnMaxLifetime int `json:"connMaxLifeTime"`
	MaxIdleConns    int `json:"maxIdleConns"`
	MaxOpenConns    int `json:"maxOpenConns"`
}

type EventStore

type EventStore interface {
	Save(event *models.Event) error
	DeleteEvents(uint64) error
	Count() int64
}

type JobStore

type JobStore interface {
	Save(job *models.Job) error
	Update(job *models.Job) error
	GetPendingJobs() ([]*models.Job, error)
	SearchJobs(req *SearchJobs) ([]*models.Job, error)
	DeleteJobs([]string, uint64) error
	Count() int64
}

type MainStore

type MainStore interface {
	GetDB() *gorm.DB
	GetJobStore() JobStore
	GetProcessedBlockStore() ProcessedBlockStore
	GetEventStore() EventStore
}

func NewMainStore

func NewMainStore(db *gorm.DB) MainStore

type ProcessedBlockStore

type ProcessedBlockStore interface {
	Save(chainId string, height int64) error
	GetLatestBlock(chainId string) (int64, error)
}

type SearchJobs

type SearchJobs struct {
	Status       string
	Limit        int
	MaxCreatedAt int64
	Listeners    []string
}

Jump to

Keyboard shortcuts

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