Skip to content

Commit 19d9c1e

Browse files
authored
Update for dynamic schema (#8)
1 parent c31a3b6 commit 19d9c1e

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

mappers/audit_log_mapper.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@ import (
66
"fmt"
77

88
"github.com/turbot/tailpipe-plugin-github/rows"
9-
"github.com/turbot/tailpipe-plugin-sdk/table"
109
)
1110

1211
type AuditLogMapper struct {
1312
}
1413

15-
func NewAuditLogMapper() table.Mapper[*rows.AuditLog] {
16-
return &AuditLogMapper{}
17-
}
18-
1914
func (c *AuditLogMapper) Identifier() string {
2015
return "audit_log_mapper"
2116
}

tables/audit_log_table.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,20 @@ func (c *AuditLogTable) Identifier() string {
3333
return AuditLogTableIdentifier
3434
}
3535

36-
func (c *AuditLogTable) SupportedSources(_ *AuditLogTableConfig) []*table.SourceMetadata[*rows.AuditLog] {
36+
func (c *AuditLogTable) GetSourceMetadata(_ *AuditLogTableConfig) []*table.SourceMetadata[*rows.AuditLog] {
3737
return []*table.SourceMetadata[*rows.AuditLog]{
3838
{
3939
SourceName: constants.ArtifactSourceIdentifier,
40-
MapperFunc: mappers.NewAuditLogMapper,
40+
Mapper: &mappers.AuditLogMapper{},
4141
Options: []row_source.RowSourceOption{
4242
artifact_source.WithRowPerLine(),
4343
},
4444
},
4545
}
4646
}
4747

48-
func (c *AuditLogTable) EnrichRow(row *rows.AuditLog, sourceEnrichmentFields *enrichment.CommonFields) (*rows.AuditLog, error) {
49-
if sourceEnrichmentFields != nil {
50-
row.CommonFields = *sourceEnrichmentFields
51-
}
48+
func (c *AuditLogTable) EnrichRow(row *rows.AuditLog, _ *AuditLogTableConfig, sourceEnrichmentFields enrichment.SourceEnrichment) (*rows.AuditLog, error) {
49+
row.CommonFields = sourceEnrichmentFields.CommonFields
5250

5351
// Record standardization
5452
row.TpID = xid.New().String()

0 commit comments

Comments
 (0)