Created
August 16, 2021 19:02
-
-
Save jasonsalas/c012d45ee708e27d37f57d063f974747 to your computer and use it in GitHub Desktop.
gRPC server-side streaming in Go - service definition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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