feat(go): reuse parsed fields across projections
This commit is contained in:
@@ -187,7 +187,10 @@ func (w *SnapshotWriter) snapshotFieldsForEnvelope(ctx context.Context, env enve
|
||||
if len(existing) > 0 {
|
||||
if isStructuredSnapshotParsed(env.Protocol, existing) {
|
||||
parsed = mergeParsedForProtocol(env.Protocol, existing, env.Parsed)
|
||||
return realtimeSnapshotFlatFields(env, parsed), nil
|
||||
mergedEnv := env
|
||||
mergedEnv.ParsedFields = nil
|
||||
mergedEnv.ParsedFieldTypes = nil
|
||||
return realtimeSnapshotFlatFields(mergedEnv, parsed), nil
|
||||
}
|
||||
return mergeRealtimeSnapshotFields(existing, incoming), nil
|
||||
}
|
||||
@@ -196,6 +199,12 @@ func (w *SnapshotWriter) snapshotFieldsForEnvelope(ctx context.Context, env enve
|
||||
}
|
||||
|
||||
func realtimeSnapshotFlatFields(env envelope.FrameEnvelope, parsed map[string]any) map[string]any {
|
||||
if len(env.ParsedFields) > 0 {
|
||||
fields := cloneMap(env.ParsedFields)
|
||||
if len(fields) > 0 {
|
||||
return fields
|
||||
}
|
||||
}
|
||||
rows := realtimeKVFields(env, parsed)
|
||||
if len(rows) == 0 {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user