mirror of
https://github.com/rancher/steve.git
synced 2025-08-27 10:29:48 +00:00
* [v2.9] Backport PR 271: Index more sqlite cache fields. * go mod tidy Signed-off-by: Silvio Moioli <silvio@moioli.net> --------- Signed-off-by: Silvio Moioli <silvio@moioli.net> Co-authored-by: Silvio Moioli <silvio@moioli.net>
17 lines
540 B
Go
17 lines
540 B
Go
// Package common provides cache.TransformFunc's for /v1 Event objects
|
|
package events
|
|
|
|
import (
|
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
|
)
|
|
|
|
// TransformEventObject does special-case handling on event objects
|
|
// 1. (only one so far): replaces the _type field with the contents of the field named "type", if it exists
|
|
func TransformEventObject(obj *unstructured.Unstructured) (*unstructured.Unstructured, error) {
|
|
currentTypeValue, ok := obj.Object["type"]
|
|
if ok {
|
|
obj.Object["_type"] = currentTypeValue
|
|
}
|
|
return obj, nil
|
|
}
|