I am making Task List using Go, gRPC-Web and Postgres.
How can I fetch the data with server streaming after updating exist data?
With the following data,
- Post data with
Task{ id: 1, name: 'abc1' }
- Post data with
Task{ id: 2, name: 'abc2' }
- Post data with
Task{ id: 3, name: 'abc3' }
when I call GetTasks
, I get the 3 data. However, if Task{ id: 2, name: 'abc2' }
is updated as Task{ id: 2, name: 'new abc2' }
by UpdateTask
, how can I get the new data?
Does GetTasks
fetch this automatically? or Do I need to do something to get the updated data?
syntax = "proto3";
package tasklist;
import "google/protobuf/empty.proto";
service TodoList {
rpc GetTasks(google.protobuf.Empty) returns (stream GetTasksResponse) {}
rpc PostTask(PostTaskRequest) returns (PostTaskRequest) {}
rpc UpdateTask(PostTaskmRequest) returns (PostTaskRequest) {}
}
message Task {
int64 id = 1;
string name = 2;
}
message GetTasksResponse {
Task task = 1;
}
message PostTaskRequest {
Task Task = 1;
}
message PostTaskResponse {
bool result = 1;
}
message UpdateTaskRequest {
Task Task = 1;
}
message UpdateTaskResponse {
bool result = 1;
}