querier

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package querier provides tools to interact with the Minder database

Package querier provides tools to interact with the Minder database

Package querier provides tools to interact with the Minder database

Package querier provides tools to interact with the Minder database

Package querier provides tools to interact with the Minder database

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrQuerierMissing is returned when the querier is not initialized
	ErrQuerierMissing = fmt.Errorf("querier is missing, possibly due to closed or committed transaction")
	// ErrProfileSvcMissing is returned when the profile service is not initialized
	ErrProfileSvcMissing = fmt.Errorf("profile service is missing")
	// ErrRuleSvcMissing is returned when the rule service is not initialized
	ErrRuleSvcMissing = fmt.Errorf("rule service is missing")
)

Functions

func New

func New(ctx context.Context, config *server.Config) (Store, Closer, error)

New creates a new instance of the querier

Types

type BundleHandlers

type BundleHandlers interface {
	GetSubscriptionByProjectBundle(
		ctx context.Context,
		projectID uuid.UUID,
		bundleNamespace, bundleName string,
	) (*BundleSubscription, error)
	SetCurrentVersion(ctx context.Context, projectID uuid.UUID, currentVersion string) error
}

BundleHandlers interface provides functions to interact with bundles and subscriptions

type BundleSubscription

type BundleSubscription struct {
	ID             uuid.UUID
	ProjectID      uuid.UUID
	BundleID       uuid.UUID
	CurrentVersion string
}

BundleSubscription represents a bundle subscription

type Closer

type Closer func()

Closer is a function that closes the database connection

type ProfileHandlers

type ProfileHandlers interface {
	CreateProfile(
		ctx context.Context,
		projectID uuid.UUID,
		subscriptionID uuid.UUID,
		profile *pb.Profile,
	) (*pb.Profile, error)
	UpdateProfile(
		ctx context.Context,
		projectID uuid.UUID,
		subscriptionID uuid.UUID,
		profile *pb.Profile,
	) (*pb.Profile, error)
	DeleteProfile(ctx context.Context, projectID uuid.UUID, profileID uuid.UUID) error
	ListProfilesInstantiatingRuleType(ctx context.Context, ruleTypeID uuid.UUID) ([]string, error)
	GetProfileByProjectAndName(ctx context.Context, projectID uuid.UUID, name string) (map[string]*pb.Profile, error)
	DeleteRuleInstanceOfProfileInProject(ctx context.Context, projectID, profileID, ruleTypeID uuid.UUID) error
}

ProfileHandlers interface provides functions to interact with profiles

type ProjectHandlers

type ProjectHandlers interface {
	GetRootProjectByID(ctx context.Context, id uuid.UUID) (*pb.Project, error)
	ListAllParentProjects(ctx context.Context) ([]*pb.Project, error)
}

ProjectHandlers interface provides functions to interact with projects

type Querier

type Querier interface {
	ProjectHandlers
	RuleTypeHandlers
	ProfileHandlers
	BundleHandlers
	Commit() error
	Cancel() error
}

Querier interface provides functions to interact with the Minder database using transactions Calling Commit() or Cancel() is necessary after using the querier. Note that they act as a destructor for the transaction so any further calls using the querier will result in an error.

type RuleTypeHandlers

type RuleTypeHandlers interface {
	ListRuleTypesByProject(ctx context.Context, projectID uuid.UUID) ([]*pb.RuleType, error)
	CreateRuleType(ctx context.Context, projectID uuid.UUID, subscriptionID uuid.UUID, ruleType *pb.RuleType) (*pb.RuleType, error)
	UpdateRuleType(ctx context.Context, projectID uuid.UUID, subscriptionID uuid.UUID, ruleType *pb.RuleType) (*pb.RuleType, error)
	DeleteRuleType(ctx context.Context, ruleTypeID uuid.UUID) error
	GetRuleTypeByName(ctx context.Context, projectIDs []uuid.UUID, name string) (*pb.RuleType, error)
}

RuleTypeHandlers interface provides functions to interact with ruletypes

type Store

Store interface provides functions to execute db queries and transactions

Jump to

Keyboard shortcuts

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