package service import ( "context" "encoding/json" "git.diulo.com/mogfee/protoc-gen-kit/pkg/xerrors" user "git.diulo.com/mogfee/protoc-gen-kit/proto/v1" ) type UserService struct { user.UnimplementedUserServer } func (*UserService) Login(ctx context.Context, req *user.LoginRequest) (*user.LoginResponse, error) { return nil, xerrors.BadRequest("BadRequest", "B") b, _ := json.Marshal(req) return &user.LoginResponse{Token: string(b)}, nil } func (*UserService) List(ctx context.Context, req *user.LoginRequest) (*user.LoginResponse, error) { //fmt.Println(ctx.Value("userId")) //return nil, errors.Wrap(xerrors.InternalServer("InternalServer", "B"), "") //b, _ := json.Marshal(req) return &user.LoginResponse{Token: "123123"}, nil } func (*UserService) Delete(ctx context.Context, req *user.LoginRequest) (*user.LoginResponse, error) { //return nil, errors.New("bad err") b, _ := json.Marshal(req) return &user.LoginResponse{Token: string(b)}, nil }