Skip to content

Instantly share code, notes, and snippets.

@jasonsalas
Created August 16, 2021 19:02
Show Gist options
  • Save jasonsalas/c012d45ee708e27d37f57d063f974747 to your computer and use it in GitHub Desktop.
Save jasonsalas/c012d45ee708e27d37f57d063f974747 to your computer and use it in GitHub Desktop.
gRPC server-side streaming in Go - service definition
syntax = "proto3";
package bank;
option go_package = "github.com/jasonsalas/protobank";
import "google/protobuf/timestamp.proto";
message Transaction {
enum Operation {
Credit = 0;
Debit = 1;
}
google.protobuf.Timestamp time = 1;
Operation operation = 2;
double amount = 3;
}
message FetchRequest {
string accountId = 1;
}
message FetchResponse {
// this could be repeated, as well
Transaction transaction = 1;
}
service TransactionService {
rpc Fetch(FetchRequest) returns (stream FetchResponse) {};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment