Use string for the timestamp, proto uses this under the hood anyway
https://github.com/grpc-ecosystem/grpc-gateway/issues/438
This commit is contained in:
parent
b748846c55
commit
30ca488890
4 changed files with 6 additions and 7 deletions
|
@ -94,7 +94,7 @@ func (s *Server) Status(ctx context.Context, req *rove.StatusRequest) (response
|
|||
for _, log := range rover.Logs {
|
||||
logs = append(logs, &rove.Log{
|
||||
Text: log.Text,
|
||||
Time: log.Time.Unix(),
|
||||
Time: fmt.Sprintf("%d", log.Time.Unix()), // proto uses strings under the hood for 64bit ints anyway
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ type Log struct {
|
|||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// The unix timestamp of the log
|
||||
Time int64 `protobuf:"varint,1,opt,name=time,proto3" json:"time,omitempty"`
|
||||
Time string `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
|
||||
// The text of the log
|
||||
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
|
||||
}
|
||||
|
@ -541,11 +541,11 @@ func (*Log) Descriptor() ([]byte, []int) {
|
|||
return file_rove_rove_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *Log) GetTime() int64 {
|
||||
func (x *Log) GetTime() string {
|
||||
if x != nil {
|
||||
return x.Time
|
||||
}
|
||||
return 0
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Log) GetText() string {
|
||||
|
@ -974,7 +974,7 @@ var file_rove_rove_proto_rawDesc = []byte{
|
|||
0x74, 0x12, 0x27, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x72, 0x6f, 0x76, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x03, 0x4c, 0x6f,
|
||||
0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0xb7, 0x03, 0x0a, 0x0e, 0x53, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04,
|
||||
|
|
|
@ -256,7 +256,6 @@
|
|||
"properties": {
|
||||
"time": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "The unix timestamp of the log"
|
||||
},
|
||||
"text": {
|
||||
|
|
|
@ -122,7 +122,7 @@ message StatusRequest {
|
|||
|
||||
message Log {
|
||||
// The unix timestamp of the log
|
||||
int64 time = 1;
|
||||
string time = 1;
|
||||
|
||||
// The text of the log
|
||||
string text = 2;
|
||||
|
|
Loading…
Add table
Reference in a new issue