You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
972 B

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
}