package utils import "errors" func GetEvent[T interface{}](eventObj []interface{}) (*T, error) { if len(eventObj) == 0 || eventObj[0] == nil { return nil, errors.New("cannot get event from eventObj") } if event, ok := eventObj[0].(*T); ok { return event, nil } else { return nil, errors.New("cannot get event from eventObj") } }