Skip to content

Commit dd8f4cd

Browse files
committed
chore: update readme
1 parent f071714 commit dd8f4cd

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

enum-compatibility/README.md

+34-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
1-
# Unary(Simple) gRPC sample
1+
# Enum compatibility check
2+
## Premise
3+
Old proto is following.
24

3-
## Compile
5+
```proto
6+
message HelloReply {
7+
string message = 1;
8+
enum Role {
9+
NONE = 0;
10+
STANDARD = 1;
11+
PREMIUM = 2;
12+
ULTIMATE = 3;
13+
}
14+
Role role = 2;
15+
}
416
```
5-
make proto
17+
18+
Then I update like this.
19+
```proto
20+
message HelloReply {
21+
string message = 1;
22+
RoleType role = 2;
23+
}
24+
25+
enum RoleType {
26+
NONE = 0;
27+
STANDARD = 1;
28+
PREMIUM = 2;
29+
ULTIMATE = 3;
30+
}
631
```
732

8-
## Run gRPC server
9-
Server depends on new enum proto.
33+
## Confirm behaviour
34+
### Run gRPC server
35+
Server depends on new enum proto ``RoleType``.
1036
```
1137
go run server/main.go
1238
```
1339

14-
## Run gRRC Client
15-
Client depends on old enum proto.
40+
### Run gRRC Client
41+
Client depends on old enum proto ``HelloReply.Role``.
1642
```
1743
go run client/main.go
1844
```
1945

46+
### Result
2047
Then it returns
2148
```
2249
2024/11/13 08:50:49 Reply: Hello alice

0 commit comments

Comments
 (0)