Skip to content

Commit

Permalink
fix: solved error method rpc not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
cukhoaimon committed Feb 15, 2024
1 parent 044f4d3 commit 1d01ff3
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 21 deletions.
6 changes: 4 additions & 2 deletions internal/delivery/grpc/pb/rpc_create_user.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions internal/delivery/grpc/pb/rpc_login_user.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions internal/delivery/grpc/pb/rpc_update_user.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions internal/delivery/grpc/pb/service_simple_bank.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions internal/delivery/grpc/pb/user.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/delivery/grpc/proto/rpc_create_user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package pb;

import "user.proto";

option go_package = "github.com/cukhoaimon/SimpleBank/pb";
option go_package = "github.com/cukhoaimon/SimpleBank/internal/delivery/grpc/pb";

message CreateUserRequest {
string username = 1;
Expand Down
2 changes: 1 addition & 1 deletion internal/delivery/grpc/proto/rpc_login_user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package pb;
import "user.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/cukhoaimon/SimpleBank/pb";
option go_package = "github.com/cukhoaimon/SimpleBank/internal/delivery/grpc/pb";

message LoginUserRequest {
string username = 1;
Expand Down
2 changes: 1 addition & 1 deletion internal/delivery/grpc/proto/rpc_update_user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package pb;

import "user.proto";

option go_package = "github.com/cukhoaimon/SimpleBank/pb";
option go_package = "github.com/cukhoaimon/SimpleBank/internal/delivery/grpc/pb";

message UpdateUserRequest {
string username = 1;
Expand Down
2 changes: 1 addition & 1 deletion internal/delivery/grpc/proto/service_simple_bank.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "rpc_login_user.proto";
import "rpc_update_user.proto";
import "protoc-gen-openapiv2/options/annotations.proto";

option go_package = "github.com/cukhoaimon/SimpleBank/pb";
option go_package = "github.com/cukhoaimon/SimpleBank/internal/delivery/grpc/pb";

option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
Expand Down
2 changes: 1 addition & 1 deletion internal/delivery/grpc/proto/user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package pb;

import "google/protobuf/timestamp.proto";

option go_package = "github.com/cukhoaimon/SimpleBank/pb";
option go_package = "github.com/cukhoaimon/SimpleBank/internal/delivery/grpc/pb";

message User {
string username = 1;
Expand Down
5 changes: 2 additions & 3 deletions pkg/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (

// Server serves gRPC request
type Server struct {
pb.UnimplementedSimpleBankServer
Handler *gapi.Handler
}

Expand Down Expand Up @@ -46,7 +45,7 @@ func Run(store db.Store, config utils.Config) {
}

gRPCServer := grpc.NewServer()
pb.RegisterSimpleBankServer(gRPCServer, server)
pb.RegisterSimpleBankServer(gRPCServer, server.Handler)
// allow client to know what RPCs currently available in server
reflection.Register(gRPCServer)

Expand Down Expand Up @@ -83,7 +82,7 @@ func RunGatewayServer(store db.Store, config utils.Config) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

if err = pb.RegisterSimpleBankHandlerServer(ctx, grpcMux, server); err != nil {
if err = pb.RegisterSimpleBankHandlerServer(ctx, grpcMux, server.Handler); err != nil {
log.Fatalf("Cannot register handler server: %s", err)
}

Expand Down

0 comments on commit 1d01ff3

Please sign in to comment.