Documentation
¶
Index ¶
- Variables
- func NewMongoClient(url string) (*mongo.Client, error)
- type AnalysisDB
- type IdentifierDB
- func (idb *IdentifierDB) Add(ctx context.Context, analysis entity.AnalysisResults, ident entity.Identifier) error
- func (idb *IdentifierDB) DeleteAllByAnalysisID(ctx context.Context, analysisID uuid.UUID) error
- func (idb *IdentifierDB) FindAllByAnalysisID(ctx context.Context, analysisID uuid.UUID) ([]entity.Identifier, error)
- func (idb *IdentifierDB) FindAllByProjectAndFile(ctx context.Context, projectRef string, filename string) ([]entity.Identifier, error)
- type InsightDB
- type ProjectDB
- func (pdb *ProjectDB) Add(ctx context.Context, project entity.Project) error
- func (pdb *ProjectDB) Delete(ctx context.Context, projectID uuid.UUID) error
- func (pdb *ProjectDB) Get(ctx context.Context, ID uuid.UUID) (entity.Project, error)
- func (pdb *ProjectDB) GetByReference(ctx context.Context, projectRef string) (entity.Project, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMongoDBConnection represents an error while attempting to create a connection to the // given MongoDB server. ErrMongoDBConnection = errors.New("MongoDB connection error") // ErrMongoDBValidation represents an error while attempting to check the existing connection // to the given MongoDB server. ErrMongoDBValidation = errors.New("MongoDB connection validation error") )
Functions ¶
Types ¶
type AnalysisDB ¶
type AnalysisDB struct {
// contains filtered or unexported fields
}
AnalysisDB represents a MongoDB database, focused on the collection handling the analysis documents.
func NewMongoDBAnalysisRepository ¶
func NewMongoDBAnalysisRepository(client *mongo.Client, dbname string) *AnalysisDB
NewMongoDBAnalysisRepository creates a repository.AnalysisRepository backed up by a MongoDB database.
func (*AnalysisDB) Add ¶
func (adb *AnalysisDB) Add(ctx context.Context, analysis entity.AnalysisResults) error
Add transforms and stores an AnalysisResults entity into a document on the underlying MongoDB collection.
func (*AnalysisDB) Delete ¶
Delete removes an existing Analysis from the underlying MongoDB collection.
func (*AnalysisDB) GetByProjectID ¶
func (adb *AnalysisDB) GetByProjectID(ctx context.Context, projectID uuid.UUID) (entity.AnalysisResults, error)
GetByProjectID retrieves an existing analysis for the given Project, from the underlying MongoDB collection.
type IdentifierDB ¶
type IdentifierDB struct {
// contains filtered or unexported fields
}
IdentifierDB represents a MongoDB database, focused on the collection handling the identifiers documents.
func NewMongoDBIdentifierRepository ¶
func NewMongoDBIdentifierRepository(client *mongo.Client, dbname string) *IdentifierDB
NewMongoDBIdentifierRepository creates a repository.IdentifierRepository backed up by a MongoDB database.
func (*IdentifierDB) Add ¶
func (idb *IdentifierDB) Add(ctx context.Context, analysis entity.AnalysisResults, ident entity.Identifier) error
Add transforms and stores an Identifier entity into a document on the underlying MongoDB collection.
func (*IdentifierDB) DeleteAllByAnalysisID ¶
DeleteAllByAnalysisID removes a set of existing identifires from the underlying MongoDB collection.
func (*IdentifierDB) FindAllByAnalysisID ¶
func (idb *IdentifierDB) FindAllByAnalysisID(ctx context.Context, analysisID uuid.UUID) ([]entity.Identifier, error)
FindAllByAnalysisID retrieves all the identifiers related to a given analysis, from the underlying MongoDB collection.
func (*IdentifierDB) FindAllByProjectAndFile ¶
func (idb *IdentifierDB) FindAllByProjectAndFile(ctx context.Context, projectRef string, filename string) ([]entity.Identifier, error)
FindAllByProjectAndFile retrieves all the identifiers for a file related to a given project, from the underlying MongoDB collection.
type InsightDB ¶
type InsightDB struct {
// contains filtered or unexported fields
}
InsightDB represents a MongoDB database, focused on the collection handling the insights documents.
func NewMongoDBInsightRepository ¶
NewMongoDBInsightRepository creates a repository.InsightRepository backed up by a MongoDB database.
func (*InsightDB) AddAll ¶
AddAll transforms and stores a set of entity.Insight entities into documents on the underlying MongoDB collection.
func (*InsightDB) DeleteAllByAnalysisID ¶
DeleteAllByAnalysisID removes a set of existing insights from the underlying MongoDB collection.
type ProjectDB ¶
type ProjectDB struct {
// contains filtered or unexported fields
}
ProjectDB represents a MongoDB database, focused on the collection handling the project documents.
func NewMongoDBProjecRepository ¶
NewMongoDBProjecRepository creates a repository.ProjectRepository backed up by a MongoDB database.
func (*ProjectDB) Add ¶
Add transforms and stores a Project entity into a document on the underlying MongoDB collection.
func (*ProjectDB) Delete ¶
Delete removes an existing Project from the underlying MongoDB collection.