db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMigrations

func RunMigrations(logger *zap.Logger, pgConnectionString string, downFirst bool) error

Types

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type DeleteRegisteredEndpointParams

type DeleteRegisteredEndpointParams struct {
	ID          int32  `json:"id"`
	Endpoint    string `json:"endpoint"`
	Owner       string `json:"owner"`
	ServiceType string `json:"service_type"`
}

type EthActiveProposal

type EthActiveProposal struct {
	ID                        int64  `json:"id"`
	Proposer                  string `json:"proposer"`
	SubmissionBlockNumber     int64  `json:"submission_block_number"`
	TargetContractRegistryKey string `json:"target_contract_registry_key"`
	TargetContractAddress     string `json:"target_contract_address"`
	CallValue                 int64  `json:"call_value"`
	FunctionSignature         string `json:"function_signature"`
	CallData                  string `json:"call_data"`
}

type EthFundingRound

type EthFundingRound struct {
	RoundNum     int32            `json:"round_num"`
	Blocknumber  int64            `json:"blocknumber"`
	CreationTime pgtype.Timestamp `json:"creation_time"`
}

type EthRegisteredEndpoint

type EthRegisteredEndpoint struct {
	ID             int32            `json:"id"`
	ServiceType    string           `json:"service_type"`
	Owner          string           `json:"owner"`
	DelegateWallet string           `json:"delegate_wallet"`
	Endpoint       string           `json:"endpoint"`
	Blocknumber    int64            `json:"blocknumber"`
	RegisteredAt   pgtype.Timestamp `json:"registered_at"`
}

type EthServiceProvider

type EthServiceProvider struct {
	Address           string `json:"address"`
	DeployerStake     int64  `json:"deployer_stake"`
	DeployerCut       int64  `json:"deployer_cut"`
	ValidBounds       bool   `json:"valid_bounds"`
	NumberOfEndpoints int32  `json:"number_of_endpoints"`
	MinAccountStake   int64  `json:"min_account_stake"`
	MaxAccountStake   int64  `json:"max_account_stake"`
}

type EthStaked

type EthStaked struct {
	Address     string `json:"address"`
	TotalStaked int64  `json:"total_staked"`
}

type InsertActiveProposalParams

type InsertActiveProposalParams struct {
	ID                        int64  `json:"id"`
	Proposer                  string `json:"proposer"`
	SubmissionBlockNumber     int64  `json:"submission_block_number"`
	TargetContractRegistryKey string `json:"target_contract_registry_key"`
	TargetContractAddress     string `json:"target_contract_address"`
	CallValue                 int64  `json:"call_value"`
	FunctionSignature         string `json:"function_signature"`
	CallData                  string `json:"call_data"`
}

type InsertRegisteredEndpointParams

type InsertRegisteredEndpointParams struct {
	ID             int32            `json:"id"`
	ServiceType    string           `json:"service_type"`
	Owner          string           `json:"owner"`
	DelegateWallet string           `json:"delegate_wallet"`
	Endpoint       string           `json:"endpoint"`
	Blocknumber    int64            `json:"blocknumber"`
	RegisteredAt   pgtype.Timestamp `json:"registered_at"`
}

type InsertServiceProviderParams

type InsertServiceProviderParams struct {
	Address           string `json:"address"`
	DeployerStake     int64  `json:"deployer_stake"`
	DeployerCut       int64  `json:"deployer_cut"`
	ValidBounds       bool   `json:"valid_bounds"`
	NumberOfEndpoints int32  `json:"number_of_endpoints"`
	MinAccountStake   int64  `json:"min_account_stake"`
	MaxAccountStake   int64  `json:"max_account_stake"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) ClearActiveProposals

func (q *Queries) ClearActiveProposals(ctx context.Context) error

func (*Queries) ClearRegisteredEndpoints

func (q *Queries) ClearRegisteredEndpoints(ctx context.Context) error

func (*Queries) ClearServiceProviders

func (q *Queries) ClearServiceProviders(ctx context.Context) error

func (*Queries) ClearStaked

func (q *Queries) ClearStaked(ctx context.Context) error

func (*Queries) DeleteActiveProposal

func (q *Queries) DeleteActiveProposal(ctx context.Context, id int64) error

func (*Queries) DeleteRegisteredEndpoint

func (q *Queries) DeleteRegisteredEndpoint(ctx context.Context, arg DeleteRegisteredEndpointParams) error

func (*Queries) GetActiveProposals

func (q *Queries) GetActiveProposals(ctx context.Context) ([]EthActiveProposal, error)

func (*Queries) GetCountOfEndpointsWithDelegateWallet

func (q *Queries) GetCountOfEndpointsWithDelegateWallet(ctx context.Context, delegateWallet string) (int64, error)

func (*Queries) GetLatestFundingRound

func (q *Queries) GetLatestFundingRound(ctx context.Context) (EthFundingRound, error)

func (*Queries) GetRegisteredEndpoint

func (q *Queries) GetRegisteredEndpoint(ctx context.Context, endpoint string) (EthRegisteredEndpoint, error)

func (*Queries) GetRegisteredEndpoints

func (q *Queries) GetRegisteredEndpoints(ctx context.Context) ([]EthRegisteredEndpoint, error)

func (*Queries) GetRegisteredEndpointsForServiceProvider

func (q *Queries) GetRegisteredEndpointsForServiceProvider(ctx context.Context, owner string) ([]EthRegisteredEndpoint, error)

func (*Queries) GetServiceProvider

func (q *Queries) GetServiceProvider(ctx context.Context, address string) (EthServiceProvider, error)

func (*Queries) GetServiceProviders

func (q *Queries) GetServiceProviders(ctx context.Context) ([]EthServiceProvider, error)

func (*Queries) GetStakedAmountForServiceProvider

func (q *Queries) GetStakedAmountForServiceProvider(ctx context.Context, address string) (int64, error)

func (*Queries) InsertActiveProposal

func (q *Queries) InsertActiveProposal(ctx context.Context, arg InsertActiveProposalParams) error

func (*Queries) InsertRegisteredEndpoint

func (q *Queries) InsertRegisteredEndpoint(ctx context.Context, arg InsertRegisteredEndpointParams) error

func (*Queries) InsertServiceProvider

func (q *Queries) InsertServiceProvider(ctx context.Context, arg InsertServiceProviderParams) error

func (*Queries) UpsertServiceProvider

func (q *Queries) UpsertServiceProvider(ctx context.Context, arg UpsertServiceProviderParams) error

func (*Queries) UpsertStaked

func (q *Queries) UpsertStaked(ctx context.Context, arg UpsertStakedParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type UpsertServiceProviderParams

type UpsertServiceProviderParams struct {
	Address           string `json:"address"`
	DeployerStake     int64  `json:"deployer_stake"`
	DeployerCut       int64  `json:"deployer_cut"`
	ValidBounds       bool   `json:"valid_bounds"`
	NumberOfEndpoints int32  `json:"number_of_endpoints"`
	MinAccountStake   int64  `json:"min_account_stake"`
	MaxAccountStake   int64  `json:"max_account_stake"`
}

type UpsertStakedParams

type UpsertStakedParams struct {
	Address     string `json:"address"`
	TotalStaked int64  `json:"total_staked"`
}

Jump to

Keyboard shortcuts

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