Skip to content

Commit

Permalink
Add Data member to ResultsMetadata struct. (#1358)
Browse files Browse the repository at this point in the history
When a Result is emitted, it should include
the `chunk.Data []byte` so that we can utilize
the blob of data which caused the result.

This makes it so something catching the results
does not have to maintain a collection of chunks
to correlate the two together.
  • Loading branch information
strazzere authored May 24, 2023
1 parent 32a351f commit cbfbf53
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/detectors/detectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ type ResultWithMetadata struct {
// SourceName is the name of the Source.
SourceName string
Result
// Data from the sources.Chunk which this result was emitted for
Data []byte
}

// CopyMetadata returns a detector result with included metadata from the source chunk.
Expand All @@ -78,6 +80,7 @@ func CopyMetadata(chunk *sources.Chunk, result Result) ResultWithMetadata {
SourceType: chunk.SourceType,
SourceName: chunk.SourceName,
Result: result,
Data: chunk.Data,
}
}

Expand Down

0 comments on commit cbfbf53

Please sign in to comment.