endpoint

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLoginReqType  = errors.New("RequestType has only one type: Login")
	ErrInvalidVerifyReqType = errors.New("RequestType has only one type: Verify")
	ErrInvalidLoginRequest  = errors.New("request has only one class: AuthRequest")
	ErrInvalidVerifyRequest = errors.New("request has only one class: VerifyRequest")
)

Functions

func MakeHealthCheckEndpoint

func MakeHealthCheckEndpoint(_ service.Service) endpoint.Endpoint

MakeHealthCheckEndpoint 创建健康检查Endpoint.

func MakeLoginEndpoint

func MakeLoginEndpoint(svc service.Service) endpoint.Endpoint

func MakeVerifyEndpoint

func MakeVerifyEndpoint(svc service.Service) endpoint.Endpoint

Types

type AuthEndpoints

type AuthEndpoints struct {
	LoginEndpoint       endpoint.Endpoint
	VerifyEndpoint      endpoint.Endpoint
	HealthCheckEndpoint endpoint.Endpoint
}

func MakeAuthEndpoints

func MakeAuthEndpoints(svc service.Service) AuthEndpoints

func NewAuthEndpoints

func NewAuthEndpoints(loginEP, verifyEP, healthCheckEP endpoint.Endpoint) AuthEndpoints

type AuthRequest

type AuthRequest struct {
	RequestType string `json:"request_type"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	Unexpired   bool   `json:"unexpired"`
}

type AuthResponse

type AuthResponse struct {
	Result string `json:"result"`
	Error  error  `json:"error"`
}

type HealthRequest

type HealthRequest struct{}

HealthRequest 健康检查请求结构.

type HealthResponse

type HealthResponse struct {
	Status bool `json:"status"`
}

HealthResponse 健康检查响应结构.

type VerifyRequest

type VerifyRequest struct {
	ResquesType string `json:"resques_type"`
	Token       string `json:"token"`
}

type VerifyResponse

type VerifyResponse struct {
	Result bool  `json:"result"`
	Error  error `json:"error"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL