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 ¶
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 ¶
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
UpsertBundle(ctx context.Context, namespace, name string) error
GetBundleID(ctx context.Context, namespace, name string) (uuid.UUID, error)
CreateSubscription(ctx context.Context, projectID, bundleID uuid.UUID, currentVersion string) (*BundleSubscription, 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 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 ¶
type Store interface {
ProjectHandlers
RuleTypeHandlers
ProfileHandlers
BundleHandlers
BeginTx() (Querier, error)
}
Store interface provides functions to execute db queries and transactions