69 lines
1.4 KiB
Protocol Buffer
69 lines
1.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package grpcserver;
|
|
|
|
option go_package = "grpcserver";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
import "google/protobuf/duration.proto";
|
|
import "google/protobuf/empty.proto";
|
|
|
|
|
|
service grpc {
|
|
rpc Create(CreateReq) returns (CreateRsp) {}
|
|
rpc Update(UpdateReq) returns (google.protobuf.Empty) {}
|
|
rpc Delete(DeleteReq) returns (google.protobuf.Empty) {}
|
|
rpc List(google.protobuf.Empty) returns (ListResp) {}
|
|
rpc GetByID(GetByIDReq) returns (GetByIDResp) {}
|
|
rpc GetByDate(GetByDateReq) returns (GetByDateResp) {}
|
|
}
|
|
|
|
enum QueryRange {
|
|
DAY = 0;
|
|
WEEK = 1;
|
|
MONTH = 2;
|
|
}
|
|
message Event {
|
|
int64 ID = 1;
|
|
string Title = 2;
|
|
google.protobuf.Timestamp Date = 3;
|
|
google.protobuf.Duration Latency = 4;
|
|
string Note = 5;
|
|
int64 UserID = 6;
|
|
google.protobuf.Duration NotifyTime = 7;
|
|
}
|
|
|
|
message CreateReq {
|
|
string Title = 2;
|
|
google.protobuf.Timestamp Date = 3;
|
|
google.protobuf.Duration Latency = 4;
|
|
string Note = 5;
|
|
int64 UserID = 6;
|
|
google.protobuf.Duration NotifyTime = 7;
|
|
}
|
|
message CreateRsp {
|
|
int64 ID = 1;
|
|
}
|
|
message UpdateReq {
|
|
int64 ID = 1;
|
|
Event Event = 2;
|
|
}
|
|
message DeleteReq {
|
|
int64 ID = 1;
|
|
}
|
|
message ListResp {
|
|
repeated Event Events = 1;
|
|
}
|
|
message GetByIDReq {
|
|
int64 ID = 1;
|
|
}
|
|
message GetByIDResp {
|
|
repeated Event Events = 1;
|
|
}
|
|
message GetByDateReq {
|
|
google.protobuf.Timestamp Date = 1;
|
|
QueryRange Range = 2;
|
|
}
|
|
message GetByDateResp {
|
|
repeated Event Events = 1;
|
|
} |