CopyFrom copies all tags from src except "time" and "event_id". If a key already exists in dst, it will be overwritten.
(src *Event)
| 35 | // CopyFrom copies all tags from src except "time" and "event_id". If a key |
| 36 | // already exists in dst, it will be overwritten. |
| 37 | func (dst *Event) CopyFrom(src *Event) { |
| 38 | if src == nil { |
| 39 | return |
| 40 | } |
| 41 | |
| 42 | src.mu.RLock() |
| 43 | defer src.mu.RUnlock() |
| 44 | |
| 45 | dst.mu.Lock() |
| 46 | defer dst.mu.Unlock() |
| 47 | |
| 48 | for _, key := range src.keys { |
| 49 | switch key { |
| 50 | case "time": |
| 51 | case "event_id": |
| 52 | default: |
| 53 | dst.setLocked(key, src.vals[key]) |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | func (ev *Event) Set(key string, val string) { |
| 59 | ev.mu.Lock() |
no test coverage detected