Add user-service
This commit is contained in:
21
examples/go-kit/services/user/service.go
Normal file
21
examples/go-kit/services/user/service.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package usersvc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
pb "github.com/moul/protoc-gen-gotemplate/examples/go-kit/services/user/gen/pb"
|
||||
)
|
||||
|
||||
type Service struct{}
|
||||
|
||||
func New() pb.UserServiceServer { return &Service{} }
|
||||
|
||||
func (svc *Service) CreateUser(ctx context.Context, in *pb.CreateUserRequest) (*pb.CreateUserResponse, error) {
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
func (svc *Service) GetUser(ctx context.Context, in *pb.GetUserRequest) (*pb.GetUserResponse, error) {
|
||||
return nil, fmt.Errorf("not implemented")
|
||||
}
|
29
examples/go-kit/services/user/user.proto
Normal file
29
examples/go-kit/services/user/user.proto
Normal file
@@ -0,0 +1,29 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package user;
|
||||
|
||||
service UserService {
|
||||
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) {}
|
||||
rpc GetUser(GetUserRequest) returns (GetUserResponse) {}
|
||||
}
|
||||
|
||||
message CreateUserRequest {
|
||||
string name = 1;
|
||||
}
|
||||
message CreateUserResponse {
|
||||
User user = 1;
|
||||
string err_msg = 2;
|
||||
}
|
||||
|
||||
message GetUserRequest {
|
||||
string id = 1;
|
||||
}
|
||||
message GetUserResponse {
|
||||
User user = 1;
|
||||
string err_msg = 2;
|
||||
}
|
||||
|
||||
message User {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
}
|
Reference in New Issue
Block a user