db_query

package
v0.0.0-...-9f5e8be Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBQuerier

type DBQuerier struct {
	// contains filtered or unexported fields
}

func NewQuerier

func NewQuerier(conn genericConn) *DBQuerier

NewQuerier creates a DBQuerier that implements Querier.

func (*DBQuerier) DeletePoktApplication

func (q *DBQuerier) DeletePoktApplication(ctx context.Context, applicationID pgtype.UUID) (pgconn.CommandTag, error)

DeletePoktApplication implements Querier.DeletePoktApplication.

func (*DBQuerier) GetChainConfigurations

func (q *DBQuerier) GetChainConfigurations(ctx context.Context) ([]GetChainConfigurationsRow, error)

GetChainConfigurations implements Querier.GetChainConfigurations.

func (*DBQuerier) GetPoktApplications

func (q *DBQuerier) GetPoktApplications(ctx context.Context, encryptionKey string) ([]GetPoktApplicationsRow, error)

GetPoktApplications implements Querier.GetPoktApplications.

func (*DBQuerier) InsertPoktApplications

func (q *DBQuerier) InsertPoktApplications(ctx context.Context, privateKey string, encryptionKey string) (pgconn.CommandTag, error)

InsertPoktApplications implements Querier.InsertPoktApplications.

type GetChainConfigurationsRow

type GetChainConfigurationsRow struct {
	CreatedAt                        pgtype.Timestamp `json:"created_at"`
	UpdatedAt                        pgtype.Timestamp `json:"updated_at"`
	DeletedAt                        pgtype.Timestamp `json:"deleted_at"`
	ID                               pgtype.UUID      `json:"id"`
	ChainID                          pgtype.Varchar   `json:"chain_id"`
	PocketRequestTimeoutDuration     pgtype.Varchar   `json:"pocket_request_timeout_duration"`
	AltruistUrl                      pgtype.Varchar   `json:"altruist_url"`
	AltruistRequestTimeoutDuration   pgtype.Varchar   `json:"altruist_request_timeout_duration"`
	TopBucketP90latencyDuration      pgtype.Varchar   `json:"top_bucket_p90latency_duration"`
	HeightCheckBlockTolerance        *int32           `json:"height_check_block_tolerance"`
	DataIntegrityCheckLookbackHeight *int32           `json:"data_integrity_check_lookback_height"`
}

type GetPoktApplicationsRow

type GetPoktApplicationsRow struct {
	ID                  pgtype.UUID `json:"id"`
	DecryptedPrivateKey string      `json:"decrypted_private_key"`
}

type Querier

type Querier interface {
	GetPoktApplications(ctx context.Context, encryptionKey string) ([]GetPoktApplicationsRow, error)

	InsertPoktApplications(ctx context.Context, privateKey string, encryptionKey string) (pgconn.CommandTag, error)

	DeletePoktApplication(ctx context.Context, applicationID pgtype.UUID) (pgconn.CommandTag, error)

	GetChainConfigurations(ctx context.Context) ([]GetChainConfigurationsRow, error)
}

Querier is a typesafe Go interface backed by SQL queries.

func InitDB

func InitDB(logger *zap.Logger, config global_config.DBCredentialsProvider, maxConnections uint) (Querier, *pgxpool.Pool, error)

InitDB - runs DB migrations and provides a code-generated query interface

Jump to

Keyboard shortcuts

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