Skip to content

Instantly share code, notes, and snippets.

@bxcodec
Last active August 12, 2017 16:12
Show Gist options
  • Select an option

  • Save bxcodec/b46fbcff1fc01b1d22bff830e4e8bf1d to your computer and use it in GitHub Desktop.

Select an option

Save bxcodec/b46fbcff1fc01b1d22bff830e4e8bf1d to your computer and use it in GitHub Desktop.
Article Proto
syntax = "proto3";
package article ;
import "google/protobuf/timestamp.proto";
service ArticleHandler {
rpc GetArticle (SingleRequest) returns (Article);
rpc FetchArticle (FetchRequest) returns (stream Article);
rpc BatchInsert (stream Article) returns (BatchInsertResponse);
rpc BatchUpdate (stream Article) returns (stream Article);
rpc GetListArticle (FetchRequest) returns (ListArticle);
rpc UpdateArticle (Article) returns (Article);
rpc Delete (SingleRequest) returns (DeleteResponse);
rpc Store (Article) returns (Article);
}
message ErrorMessage{
string message =1;
}
message BatchInsertResponse{
int64 TotalSuccess = 1;
repeated ErrorMessage Errors =2;
}
message ListArticle{
repeated Article Artilces=1;
string Cursor = 2;
}
message DeleteResponse{
string status = 1;
int32 code = 2;
}
message FetchRequest{
int64 num=1;
string cursor =2;
}
message SingleRequest{
int64 id=1;
}
message Article{
int64 ID =1;
string Title =2;
string Content =3 ;
google.protobuf.Timestamp UpdatedAt=4;
google.protobuf.Timestamp CreatedAt=5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment