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.

33 lines
967 B

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