Skip to content
Snippets Groups Projects
Commit 02d1a95f authored by ko_oler's avatar ko_oler
Browse files

закомментирована функция convertInterfaceToAny

parent 7a20ca9f
Branches
Tags
No related merge requests found
package log package log
import ( import (
"encoding/json"
"time" "time"
pb "git.perx.ru/perxis/perxis-go/proto/log" pb "git.perx.ru/perxis/perxis-go/proto/log"
"github.com/golang/protobuf/ptypes/any"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/timestamppb"
wrappers "google.golang.org/protobuf/types/known/wrapperspb"
) )
type Level int type Level int
...@@ -44,15 +39,15 @@ type Entry struct { ...@@ -44,15 +39,15 @@ type Entry struct {
Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"`
} }
func convertInterfaceToAny(v interface{}) (*any.Any, error) { //func convertInterfaceToAny(v interface{}) (*any.Any, error) {
anyValue := &any.Any{} // anyValue := &any.Any{}
bytes, _ := json.Marshal(v) // bytes, _ := json.Marshal(v)
bytesValue := &wrappers.BytesValue{ // bytesValue := &wrappers.BytesValue{
Value: bytes, // Value: bytes,
} // }
err := anypb.MarshalFrom(anyValue, bytesValue, proto.MarshalOptions{}) // err := anypb.MarshalFrom(anyValue, bytesValue, proto.MarshalOptions{})
return anyValue, err // return anyValue, err
} //}
func EntryToPB(entry *Entry) *pb.LogEntry { func EntryToPB(entry *Entry) *pb.LogEntry {
logEntry := &pb.LogEntry{ logEntry := &pb.LogEntry{
...@@ -65,10 +60,9 @@ func EntryToPB(entry *Entry) *pb.LogEntry { ...@@ -65,10 +60,9 @@ func EntryToPB(entry *Entry) *pb.LogEntry {
Event: entry.Event, Event: entry.Event,
Object: entry.Object, Object: entry.Object,
Caller: entry.Caller, Caller: entry.Caller,
Attr: nil, //implement
Tags: entry.Tags, Tags: entry.Tags,
} }
logEntry.Attr, _ = convertInterfaceToAny(entry.Attr)
return logEntry return logEntry
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment