Documentation ¶
Overview ¶
Package ruletypes contains logic relating to the management of rule types in minder
Index ¶
- Variables
- func GetDBReleaseStatusFromPBReleasePhase(in pb.RuleTypeReleasePhase) (*db.ReleaseStatus, error)
- func GetPBReleasePhaseFromDBReleaseStatus(s *db.ReleaseStatus) (pb.RuleTypeReleasePhase, error)
- func RuleDefFromDB(r *db.RuleType) (*minderv1.RuleType_Definition, error)
- func RuleTypePBFromDB(rt *db.RuleType) (*minderv1.RuleType, error)
- type RuleTypeService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRuleNotFound is returned by the update method if the rule does not // already exist ErrRuleNotFound = errors.New("rule type not found") // ErrRuleAlreadyExists is returned by the create method if the rule // already exists ErrRuleAlreadyExists = errors.New("rule type already exists") // ErrRuleTypeInvalid is returned by both create and update if validation // fails ErrRuleTypeInvalid = errors.New("rule type validation failed") )
Functions ¶
func GetDBReleaseStatusFromPBReleasePhase ¶
func GetDBReleaseStatusFromPBReleasePhase(in pb.RuleTypeReleasePhase) (*db.ReleaseStatus, error)
GetDBReleaseStatusFromPBReleasePhase converts a protobuf release phase to a database release status
func GetPBReleasePhaseFromDBReleaseStatus ¶
func GetPBReleasePhaseFromDBReleaseStatus(s *db.ReleaseStatus) (pb.RuleTypeReleasePhase, error)
GetPBReleasePhaseFromDBReleaseStatus converts a database release status to a protobuf release phase
func RuleDefFromDB ¶
func RuleDefFromDB(r *db.RuleType) (*minderv1.RuleType_Definition, error)
RuleDefFromDB converts a rule type definition from the database to a protobuf rule type definition
Types ¶
type RuleTypeService ¶
type RuleTypeService interface { // CreateRuleType creates rule types in the database // the new rule type is validated // if the rule type already exists - this will return an error // returns the pb definition of the new rule type on success CreateRuleType( ctx context.Context, projectID uuid.UUID, subscriptionID uuid.UUID, ruleType *pb.RuleType, qtx db.Querier, ) (*pb.RuleType, error) // UpdateRuleType updates rule types in the database // the new rule type is validated, and backwards compatibility verified // if the rule does not already exist - this will return an error // returns the pb definition of the updated rule type on success UpdateRuleType( ctx context.Context, projectID uuid.UUID, subscriptionID uuid.UUID, ruleType *pb.RuleType, qtx db.Querier, ) (*pb.RuleType, error) // UpsertRuleType creates the rule type if it does not exist // or updates it if it already exists. This is used in the subscription // logic. UpsertRuleType( ctx context.Context, projectID uuid.UUID, subscriptionID uuid.UUID, ruleType *pb.RuleType, qtx db.Querier, ) error }
RuleTypeService encapsulates the creation and update of rule types TODO: in future, other operations such as delete should be moved here
func NewRuleTypeService ¶
func NewRuleTypeService() RuleTypeService
NewRuleTypeService creates a new instance of RuleTypeService
Directories ¶
Path | Synopsis |
---|---|
Package mock_ruletypes is a generated GoMock package.
|
Package mock_ruletypes is a generated GoMock package. |
fixtures
Package fixtures contains code for creating ProfileService fixtures and is used in various parts of the code.
|
Package fixtures contains code for creating ProfileService fixtures and is used in various parts of the code. |
Click to show internal directories.
Click to hide internal directories.