postgres

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const PLUGINS_TABLE = "plugins"
View Source
const PLUGIN_INSTALLATIONS_TABLE = "plugin_installations"
View Source
const PLUGIN_RATING_TABLE = "plugin_ratings"
View Source
const PLUGIN_TAGS_TABLE = "plugin_tags"
View Source
const REVIEWS_TABLE = "reviews"
View Source
const TAGS_TABLE = "tags"

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrationOptions

type MigrationOptions struct {
	RunSystemMigrations   bool
	RunVerifierMigrations bool
}

type PostgresBackend

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

func NewPostgresBackend

func NewPostgresBackend(dsn string, opts *MigrationOptions) (*PostgresBackend, error)

func (*PostgresBackend) AddPluginPolicySync

func (p *PostgresBackend) AddPluginPolicySync(ctx context.Context, dbTx pgx.Tx, policy itypes.PluginPolicySync) error

func (*PostgresBackend) ChangeRatingForPlugin

func (p *PostgresBackend) ChangeRatingForPlugin(ctx context.Context, dbTx pgx.Tx, pluginId string, oldRating int, newRating int) error

func (*PostgresBackend) Close

func (p *PostgresBackend) Close() error

func (*PostgresBackend) CreatePricing

func (p *PostgresBackend) CreatePricing(ctx context.Context, pricingDto types.PricingCreateDto) (*types.Pricing, error)

func (*PostgresBackend) CreateRatingForPlugin

func (p *PostgresBackend) CreateRatingForPlugin(ctx context.Context, dbTx pgx.Tx, pluginId string) error

func (*PostgresBackend) CreateReview

func (p *PostgresBackend) CreateReview(ctx context.Context, dbTx pgx.Tx, reviewDto itypes.ReviewCreateDto, pluginId string) (string, error)

func (*PostgresBackend) CreateVaultToken

func (p *PostgresBackend) CreateVaultToken(ctx context.Context, token types.VaultTokenCreate) (*types.VaultToken, error)

func (*PostgresBackend) DeleteAllPolicies

func (p *PostgresBackend) DeleteAllPolicies(ctx context.Context, dbTx pgx.Tx, pluginID types.PluginID, publicKey string) error

func (*PostgresBackend) DeletePluginPolicySync

func (p *PostgresBackend) DeletePluginPolicySync(ctx context.Context, id uuid.UUID) error

func (*PostgresBackend) DeletePluginPolicyTx

func (p *PostgresBackend) DeletePluginPolicyTx(ctx context.Context, dbTx pgx.Tx, id uuid.UUID) error

func (*PostgresBackend) DeletePricingById

func (p *PostgresBackend) DeletePricingById(ctx context.Context, id uuid.UUID) error

func (*PostgresBackend) FindAvgRatingByPluginID

func (p *PostgresBackend) FindAvgRatingByPluginID(ctx context.Context, pluginID string) (types.PluginAvgRatingDto, error)

func (*PostgresBackend) FindPluginById

func (p *PostgresBackend) FindPluginById(ctx context.Context, dbTx pgx.Tx, id types.PluginID) (*itypes.Plugin, error)

func (*PostgresBackend) FindPlugins

func (p *PostgresBackend) FindPlugins(
	ctx context.Context,
	filters itypes.PluginFilters,
	take int,
	skip int,
	sort string,
) (*itypes.PluginsPaginatedList, error)

func (*PostgresBackend) FindPricingById

func (p *PostgresBackend) FindPricingById(ctx context.Context, id uuid.UUID) (*types.Pricing, error)

func (*PostgresBackend) FindRatingByPluginId

func (p *PostgresBackend) FindRatingByPluginId(ctx context.Context, dbTx pgx.Tx, pluginId string) ([]types.PluginRatingDto, error)

func (*PostgresBackend) FindReviewById

func (p *PostgresBackend) FindReviewById(ctx context.Context, db pgx.Tx, id string) (*itypes.ReviewDto, error)

func (*PostgresBackend) FindReviewByUserAndPlugin

func (p *PostgresBackend) FindReviewByUserAndPlugin(ctx context.Context, dbTx pgx.Tx, pluginId string, userAddress string) (*itypes.ReviewDto, error)

func (*PostgresBackend) FindReviews

func (p *PostgresBackend) FindReviews(ctx context.Context, pluginId string, skip int, take int, sort string) (itypes.ReviewsDto, error)

func (*PostgresBackend) FindTagById

func (p *PostgresBackend) FindTagById(ctx context.Context, id string) (*types.Tag, error)

func (*PostgresBackend) FindTagByName

func (p *PostgresBackend) FindTagByName(ctx context.Context, name string) (*types.Tag, error)

func (*PostgresBackend) FindTags

func (p *PostgresBackend) FindTags(ctx context.Context) ([]types.Tag, error)

func (*PostgresBackend) GetAPIKey

func (p *PostgresBackend) GetAPIKey(ctx context.Context, apiKey string) (*types.APIKey, error)

func (*PostgresBackend) GetAPIKeyByPluginId

func (p *PostgresBackend) GetAPIKeyByPluginId(ctx context.Context, pluginId string) (*types.APIKey, error)

func (*PostgresBackend) GetActiveVaultTokens

func (p *PostgresBackend) GetActiveVaultTokens(ctx context.Context, publicKey string) ([]types.VaultToken, error)

func (*PostgresBackend) GetAllPluginPolicies

func (p *PostgresBackend) GetAllPluginPolicies(ctx context.Context, publicKey string, pluginID types.PluginID, take int, skip int, includeInactive bool) (*itypes.PluginPolicyPaginatedList, error)

func (*PostgresBackend) GetFeeById

func (p *PostgresBackend) GetFeeById(ctx context.Context, id uint64) (*types.Fee, error)

func (*PostgresBackend) GetFeesByPublicKey

func (p *PostgresBackend) GetFeesByPublicKey(ctx context.Context, publicKey string) ([]*types.Fee, error)

func (*PostgresBackend) GetPluginInstallationsCount

func (p *PostgresBackend) GetPluginInstallationsCount(ctx context.Context, pluginID types.PluginID) (itypes.PluginTotalCount, error)

func (*PostgresBackend) GetPluginPolicies

func (p *PostgresBackend) GetPluginPolicies(ctx context.Context, publicKey string, pluginIds []types.PluginID, includeInactive bool) ([]types.PluginPolicy, error)

func (*PostgresBackend) GetPluginPolicy

func (p *PostgresBackend) GetPluginPolicy(ctx context.Context, id uuid.UUID) (*types.PluginPolicy, error)

func (*PostgresBackend) GetPluginPolicySync

func (p *PostgresBackend) GetPluginPolicySync(ctx context.Context, id uuid.UUID) (*itypes.PluginPolicySync, error)

func (*PostgresBackend) GetPricingByPluginId

func (p *PostgresBackend) GetPricingByPluginId(ctx context.Context, pluginId ptypes.PluginID) ([]types.Pricing, error)

func (*PostgresBackend) GetUnFinishedPluginPolicySyncs

func (p *PostgresBackend) GetUnFinishedPluginPolicySyncs(ctx context.Context) ([]itypes.PluginPolicySync, error)

func (*PostgresBackend) GetUserFees

func (p *PostgresBackend) GetUserFees(
	ctx context.Context,
	publicKey string,
) (*types.UserFeeStatus, error)

func (*PostgresBackend) GetVaultToken

func (p *PostgresBackend) GetVaultToken(ctx context.Context, tokenID string) (*types.VaultToken, error)

func (*PostgresBackend) InsertFee

func (p *PostgresBackend) InsertFee(ctx context.Context, dbTx pgx.Tx, fee *types.Fee) (uint64, error)

func (*PostgresBackend) InsertPluginInstallation

func (p *PostgresBackend) InsertPluginInstallation(ctx context.Context, dbTx pgx.Tx, pluginID types.PluginID, publicKey string) error

func (*PostgresBackend) InsertPluginPolicyTx

func (p *PostgresBackend) InsertPluginPolicyTx(ctx context.Context, dbTx pgx.Tx, policy types.PluginPolicy) (*types.PluginPolicy, error)

func (*PostgresBackend) MarkFeesCollected

func (p *PostgresBackend) MarkFeesCollected(ctx context.Context, dbTx pgx.Tx, feeIDs []uint64, txHash string, totalAmount uint64) error

func (*PostgresBackend) Migrate

func (p *PostgresBackend) Migrate(opts *MigrationOptions) error

func (*PostgresBackend) Pool

func (p *PostgresBackend) Pool() *pgxpool.Pool

func (*PostgresBackend) RevokeAllVaultTokens

func (p *PostgresBackend) RevokeAllVaultTokens(ctx context.Context, publicKey string) error

func (*PostgresBackend) RevokeVaultToken

func (p *PostgresBackend) RevokeVaultToken(ctx context.Context, tokenID string) error

func (*PostgresBackend) UpdateBatchStatus

func (p *PostgresBackend) UpdateBatchStatus(ctx context.Context, dbTx pgx.Tx, txHash string, status *rpc.TxOnChainStatus) error

func (*PostgresBackend) UpdatePluginPolicySync

func (p *PostgresBackend) UpdatePluginPolicySync(ctx context.Context, dbTx pgx.Tx, policy itypes.PluginPolicySync) error

func (*PostgresBackend) UpdatePluginPolicyTx

func (p *PostgresBackend) UpdatePluginPolicyTx(ctx context.Context, dbTx pgx.Tx, policy types.PluginPolicy) (*types.PluginPolicy, error)

func (*PostgresBackend) UpdateRatingForPlugin

func (p *PostgresBackend) UpdateRatingForPlugin(ctx context.Context, dbTx pgx.Tx, pluginId string, reviewRating int) error

func (*PostgresBackend) UpdateReview

func (p *PostgresBackend) UpdateReview(ctx context.Context, dbTx pgx.Tx, reviewId string, reviewDto itypes.ReviewCreateDto) error

func (*PostgresBackend) UpdateVaultTokenLastUsed

func (p *PostgresBackend) UpdateVaultTokenLastUsed(ctx context.Context, tokenID string) error

func (*PostgresBackend) WithTransaction

func (p *PostgresBackend) WithTransaction(ctx context.Context, fn func(ctx context.Context, tx pgx.Tx) error) error

type SystemMigrationManager

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

SystemMigrationManager handles system-level migrations (plugin_policies table)

func NewSystemMigrationManager

func NewSystemMigrationManager(pool *pgxpool.Pool) *SystemMigrationManager

func (*SystemMigrationManager) Migrate

func (s *SystemMigrationManager) Migrate() error

type VerifierMigrationManager

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

VerifierMigrationManager handles verifier-specific migrations

func NewVerifierMigrationManager

func NewVerifierMigrationManager(pool *pgxpool.Pool) *VerifierMigrationManager

func (*VerifierMigrationManager) Migrate

func (v *VerifierMigrationManager) Migrate() error

Jump to

Keyboard shortcuts

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