Resolve inheritance between identified records
This commit is contained in:
@@ -159,6 +159,25 @@ func preserveInheritanceIdentityFields(merged, child *document.Node, fields []st
|
||||
}
|
||||
}
|
||||
|
||||
func inheritanceParentPayload(parent *document.Node, identityFields []string) *document.Node {
|
||||
cloned := document.Clone(parent)
|
||||
if len(identityFields) == 0 || cloned == nil || cloned.Kind != document.Mapping {
|
||||
return cloned
|
||||
}
|
||||
excluded := make(map[string]struct{}, len(identityFields))
|
||||
for _, field := range identityFields {
|
||||
excluded[field] = struct{}{}
|
||||
}
|
||||
kept := cloned.Mapping[:0]
|
||||
for _, entry := range cloned.Mapping {
|
||||
if _, omit := excluded[entry.Key]; !omit {
|
||||
kept = append(kept, entry)
|
||||
}
|
||||
}
|
||||
cloned.Mapping = kept
|
||||
return cloned
|
||||
}
|
||||
|
||||
func applyIdentifiedInheritanceTemplates(
|
||||
graph *identifiedInheritanceGraph,
|
||||
limits projectionLimits,
|
||||
|
||||
Reference in New Issue
Block a user