1234567891011121314151617181920212223242526272829 |
- package user
- import (
- "context"
- "github.com/go-kit/kit/endpoint"
- )
- type LoginForm struct {
- Username string `json:"username"`
- Password string `json:"password"`
- }
- type LoginResult struct {
- Ret bool `json:"ret"`
- Err error `json:"err"`
- }
- type Endpoints struct {
- UserEndpoint endpoint.Endpoint
- }
- func MakeUserEndpoint(svc UserService) endpoint.Endpoint {
- return func(ctx context.Context, form interface{}) (result interface{}, err error) {
- req := form.(LoginForm)
- ret, err := svc.CheckPassword(ctx, req.Username, req.Password)
- return LoginResult{Ret: ret, Err: err}, nil
- }
- }
|