Documentation ¶
Index ¶
- Constants
- func CheckMigrations(cfg Config, name string) error
- func NewSQLDB(cfg Config) (*pgxpool.Pool, error)
- func RunMigrationsDown(cfg Config, name string) error
- func RunMigrationsUp(cfg Config, name string) error
- type Config
- type PoolDB
- func (p *PoolDB) AddL2Transaction(ctx context.Context, tx *types.L2Transaction) (uint64, error)
- func (p *PoolDB) GetL2TransactionsByStatus(ctx context.Context, status string) ([]*types.L2Transaction, error)
- func (p *PoolDB) GetL2TransactionsToMonitor(ctx context.Context) ([]*types.L2Transaction, error)
- func (p *PoolDB) GetL2TransactionsToResend(ctx context.Context) ([]*types.L2Transaction, error)
- func (p *PoolDB) GetL2TransactionsToSend(ctx context.Context) ([]*types.L2Transaction, error)
- func (p *PoolDB) UpdateL2TransactionStatus(ctx context.Context, id uint64, newStatus string, errorMsg string) error
Constants ¶
View Source
const (
// PoolMigrationName is the name of the migration used by packr to pack the migration file
PoolMigrationName = "zkevm-pool-db"
)
Variables ¶
This section is empty.
Functions ¶
func CheckMigrations ¶
CheckMigrations runs migrate-up for the given config.
func RunMigrationsDown ¶
RunMigrationsDown runs migrate-down for the given config.
func RunMigrationsUp ¶
RunMigrationsUp runs migrate-up for the given config.
Types ¶
type Config ¶
type Config struct { // Database name Name string `mapstructure:"Name"` // Database User name User string `mapstructure:"User"` // Database Password of the user Password string `mapstructure:"Password"` // Host address of database Host string `mapstructure:"Host"` // Port Number of database Port string `mapstructure:"Port"` // EnableLog EnableLog bool `mapstructure:"EnableLog"` // MaxConns is the maximum number of connections in the pool. MaxConns int `mapstructure:"MaxConns"` }
Config provide fields to configure the pool
type PoolDB ¶
type PoolDB struct {
// contains filtered or unexported fields
}
PoolDB represent a postgres pool database to store transactions
func (*PoolDB) AddL2Transaction ¶
AddTx adds a L2 transaction to the pool
func (*PoolDB) GetL2TransactionsByStatus ¶
func (*PoolDB) GetL2TransactionsToMonitor ¶
func (*PoolDB) GetL2TransactionsToResend ¶
func (*PoolDB) GetL2TransactionsToSend ¶
Click to show internal directories.
Click to hide internal directories.