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.
34 lines
968 B
34 lines
968 B
package service |
|
|
|
import ( |
|
"context" |
|
"encoding/json" |
|
"errors" |
|
user "git.echinacities.com/mogfee/protoc-gen-kit/proto/v1" |
|
"git.echinacities.com/mogfee/protoc-gen-kit/xerrors" |
|
) |
|
|
|
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, xerrors.InternalServer("InternalServer", "B") |
|
|
|
//b, _ := json.Marshal(req) |
|
return &user.LoginResponse{Token: ""}, 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 |
|
}
|
|
|