package domain import "time" type LogEntry struct { Seq uint64 Timestamp time.Time Level string Line string Fields map[string]string Redacted bool } type LogBatchIngest struct { RunEndpointID string SessionToken string LogStreamID string ServerInstanceID string StreamKey string Source LogStreamSource FirstSeq uint64 LastSeq uint64 Compression string Checksum string Entries []LogEntry } type LogBatchIngestResult struct { Accepted bool LogStreamID string AcceptedFrom uint64 AcceptedTo uint64 LatestSeq uint64 Duplicate bool ServerTime time.Time } type LogStreamCursorQuery struct { LogStreamID string AfterSeq uint64 Limit int } type LogStreamCursorResult struct { LogStreamID string Entries []LogEntry NextSeq uint64 LatestSeq uint64 } type LogBatchRecord struct { Checksum string FirstSeq uint64 LastSeq uint64 Entries []LogEntry } func CopyLogEntry(entry LogEntry) LogEntry { if entry.Fields != nil { fields := make(map[string]string, len(entry.Fields)) for key, value := range entry.Fields { fields[key] = value } entry.Fields = fields } return entry } func CopyLogEntries(entries []LogEntry) []LogEntry { if entries == nil { return nil } out := make([]LogEntry, len(entries)) for i, entry := range entries { out[i] = CopyLogEntry(entry) } return out } func CopyLogBatchIngest(batch LogBatchIngest) LogBatchIngest { batch.Entries = CopyLogEntries(batch.Entries) return batch } func CopyLogStreamCursorResult(result LogStreamCursorResult) LogStreamCursorResult { result.Entries = CopyLogEntries(result.Entries) return result } func CopyLogBatchRecord(record LogBatchRecord) LogBatchRecord { record.Entries = CopyLogEntries(record.Entries) return record }