refactor(go): remove duplicate raw fields json
This commit is contained in:
@@ -73,17 +73,15 @@ func (w *Writer) AppendRawFrame(ctx context.Context, env envelope.FrameEnvelope)
|
||||
rawHex, rawHexChunks := chunkPayload(env, "raw_hex", env.RawHex)
|
||||
rawText, rawTextChunks := chunkPayload(env, "raw_text", env.RawText)
|
||||
parsedJSON, parsedChunks := chunkPayload(env, "parsed_json", jsonString(env.Parsed))
|
||||
fieldsJSON, fieldsChunks := chunkPayload(env, "fields_json", jsonString(env.Fields))
|
||||
_, err := w.exec.ExecContext(ctx, fmt.Sprintf(`INSERT INTO %s
|
||||
(ts, frame_id, event_id, message_id, event_time, received_at, raw_size_bytes,
|
||||
raw_hex, raw_text, parsed_json, fields_json, parse_status, parse_error, source_endpoint)
|
||||
VALUES (%s)`, table, joinLiterals(rawValues(env, rawHex, rawText, parsedJSON, fieldsJSON))))
|
||||
raw_hex, raw_text, parsed_json, parse_status, parse_error, source_endpoint)
|
||||
VALUES (%s)`, table, joinLiterals(rawValues(env, rawHex, rawText, parsedJSON))))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
chunks := append(rawHexChunks, rawTextChunks...)
|
||||
chunks = append(chunks, parsedChunks...)
|
||||
chunks = append(chunks, fieldsChunks...)
|
||||
if len(chunks) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -147,7 +145,7 @@ func (w *Writer) ensureChild(ctx context.Context, table string, stable string, e
|
||||
return nil
|
||||
}
|
||||
|
||||
func rawValues(env envelope.FrameEnvelope, rawHex string, rawText string, parsedJSON string, fieldsJSON string) []any {
|
||||
func rawValues(env envelope.FrameEnvelope, rawHex string, rawText string, parsedJSON string) []any {
|
||||
received := millis(env.ReceivedAtMS)
|
||||
eventTime := millis(env.EventTimeMS)
|
||||
return []any{
|
||||
@@ -161,7 +159,6 @@ func rawValues(env envelope.FrameEnvelope, rawHex string, rawText string, parsed
|
||||
rawHex,
|
||||
rawText,
|
||||
parsedJSON,
|
||||
fieldsJSON,
|
||||
string(env.ParseStatus),
|
||||
env.ParseError,
|
||||
env.SourceEndpoint,
|
||||
|
||||
Reference in New Issue
Block a user