stores

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 8 Imported by: 11

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" mapstructure:"host"`
	User     string `json:"user" mapstructure:"user"`
	Password string `json:"password" mapstructure:"password"`
	DBName   string `json:"dbName" mapstructure:"dbName"`
	Port     int    `json:"port" mapstructure:"port"`

	ConnMaxLifetime int `json:"connMaxLifeTime" mapstructure:"connMaxLifeTime"`
	MaxIdleConns    int `json:"maxIdleConns" mapstructure:"maxIdleConns"`
	MaxOpenConns    int `json:"maxOpenConns" mapstructure:"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