diff options
Diffstat (limited to 'skate/map.go')
-rw-r--r-- | skate/map.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/skate/map.go b/skate/map.go index a06b5ae..1d21818 100644 --- a/skate/map.go +++ b/skate/map.go @@ -257,6 +257,23 @@ func MapperReleaseContainerName(p []byte) (fields [][]byte, err error) { return [][]byte{key, p}, nil } +// MapperReleaseResolvedContainerName extracts slug container name from +// resolved container names. +func MapperReleaseResolvedContainerName(p []byte) (fields [][]byte, err error) { + var ( + doc Release + key []byte + ) + if err := json.Unmarshal(p, &doc); err != nil { + return nil, err + } + if doc.Extra.Skate.ResolvedContainerName == "" { + return nil, nil + } + key = []byte(sandcrawlerSlugify(wsReplacer.Replace(strings.TrimSpace(doc.Extra.Skate.ResolvedContainerName)))) + return [][]byte{key, p}, nil +} + // MapperPartial works on partial documents. func MapperPartial(p []byte) (fields [][]byte, err error) { return nil, nil |