/
githubmirror
/
origin
Обзор
Документация
Войти
/
githubmirror
/
origin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/monitor/monitorapi/deep_copy.go
49 строк
878 B
Devan Goodwin
Rename temp Go fields to locator/message and serialize to match
19 апр 2024, 15:33
19 апр 2024, 15:33
12fe22e
Код
Авторство
О чём код?
package monitorapi func (o *Interval) DeepCopy() *Interval { ret := &Interval{ Condition: *o.Condition.DeepCopy(), Source: o.Source, Display: o.Display, From: o.From, To: o.To, } return ret } func (o *Condition) DeepCopy() *Condition { ret := &Condition{ Level: o.Level, Locator: *o.Locator.DeepCopy(), Message: *o.Message.DeepCopy(), } return ret } func (o *Locator) DeepCopy() *Locator { ret := &Locator{ Type: o.Type, Keys: make(map[LocatorKey]string, len(o.Keys)), } for k, v := range o.Keys { ret.Keys[k] = v } return ret } func (o *Message) DeepCopy() *Message { ret := &Message{ Reason: o.Reason, Cause: o.Cause, HumanMessage: o.HumanMessage, Annotations: make(map[AnnotationKey]string, len(o.Annotations)), } for k, v := range o.Annotations { ret.Annotations[k] = v } return ret }