• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mindersec / minder / 13651018762

04 Mar 2025 09:57AM UTC coverage: 56.743%. First build
13651018762

Pull #5480

github

web-flow
Merge bced55627 into 8ef21af57
Pull Request #5480: Add API for dealing directly with entity instances

1 of 420 new or added lines in 7 files covered. (0.24%)

18144 of 31976 relevant lines covered (56.74%)

37.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/engine/entities/entity_type_conversion.go
1
// SPDX-FileCopyrightText: Copyright 2024 The Minder Authors
2
// SPDX-License-Identifier: Apache-2.0
3

4
package entities
5

6
import (
7
        "fmt"
8

9
        "github.com/mindersec/minder/internal/db"
10
        pb "github.com/mindersec/minder/pkg/api/protobuf/go/minder/v1"
11
)
12

13
// EntityTypeToDBType converts a pb.Entity to a db.Entities
14
// Returns an error if the entity type is not recognized or if it's ENTITY_UNSPECIFIED
NEW
15
func EntityTypeToDBType(entityType pb.Entity) (db.Entities, error) {
×
NEW
16
        switch entityType {
×
NEW
17
        case pb.Entity_ENTITY_REPOSITORIES:
×
NEW
18
                return db.EntitiesRepository, nil
×
NEW
19
        case pb.Entity_ENTITY_BUILD_ENVIRONMENTS:
×
NEW
20
                return db.EntitiesBuildEnvironment, nil
×
NEW
21
        case pb.Entity_ENTITY_ARTIFACTS:
×
NEW
22
                return db.EntitiesArtifact, nil
×
NEW
23
        case pb.Entity_ENTITY_PULL_REQUESTS:
×
NEW
24
                return db.EntitiesPullRequest, nil
×
NEW
25
        case pb.Entity_ENTITY_RELEASE:
×
NEW
26
                return db.EntitiesRelease, nil
×
NEW
27
        case pb.Entity_ENTITY_PIPELINE_RUN:
×
NEW
28
                return db.EntitiesPipelineRun, nil
×
NEW
29
        case pb.Entity_ENTITY_TASK_RUN:
×
NEW
30
                return db.EntitiesTaskRun, nil
×
NEW
31
        case pb.Entity_ENTITY_BUILD:
×
NEW
32
                return db.EntitiesBuild, nil
×
NEW
33
        case pb.Entity_ENTITY_UNSPECIFIED:
×
NEW
34
                return db.Entities(""), fmt.Errorf("invalid entity type: ENTITY_UNSPECIFIED is not a valid entity type")
×
NEW
35
        default:
×
NEW
36
                return db.Entities(""), fmt.Errorf("invalid entity type: %s is not a recognized entity type", entityType.String())
×
37
        }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc