Documentation
¶
Index ¶
- func GetLimit(data map[string]interface{}) (map[string]interface{}, int, int)
- func Pagination(data map[string]interface{}) func(in *gorm.DB) *gorm.DB
- func TotalSize(in *gorm.DB) int
- type HttpTester
- func (h *HttpTester) DELETE(uri string, param interface{}) (int, *response.Response)
- func (h *HttpTester) GET(uri string) (int, *response.Response)
- func (h *HttpTester) PATCH(uri string, param interface{}) (int, *response.Response)
- func (h *HttpTester) POST(uri string, param interface{}) (int, *response.Response)
- func (h *HttpTester) POST_FORM(uri string, param interface{}) (int, *response.Response)
- func (h *HttpTester) PUT(uri string, param interface{}) (int, *response.Response)
- type HttpTesterInterface
- type PaginationData
- type RequestHandler
- type RequestHandlerInterface
- type Requester
- func (r *Requester) DELETE(uri string, param interface{}) (*response.Response, error)
- func (r *Requester) DeleteWithHeader(uri string, header map[string]string, param interface{}) (*response.Response, error)
- func (r *Requester) GET(uri string) (*response.Response, error)
- func (r *Requester) GetWithHeader(uri string, header map[string]string) (*response.Response, error)
- func (r *Requester) PATCH(uri string, param interface{}) (*response.Response, error)
- func (r *Requester) POST(uri string, param interface{}) (*response.Response, error)
- func (r *Requester) PUT(uri string, param interface{}) (*response.Response, error)
- func (r *Requester) PatchWithHeader(uri string, header map[string]string, param interface{}) (*response.Response, error)
- func (r *Requester) PostWithHeader(uri string, header map[string]string, param interface{}) (*response.Response, error)
- func (r *Requester) PutWithHeader(uri string, header map[string]string, param interface{}) (*response.Response, error)
- func (r *Requester) ReadJSONResponse(in *http.Response) (*response.Response, error)
- type RequesterInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HttpTester ¶
type HttpTester struct {
// contains filtered or unexported fields
}
func (*HttpTester) DELETE ¶
func (h *HttpTester) DELETE(uri string, param interface{}) (int, *response.Response)
DELETE 模擬 Delete Request的動作
func (*HttpTester) GET ¶
func (h *HttpTester) GET(uri string) (int, *response.Response)
Get 模擬Get Request的動作
func (*HttpTester) PATCH ¶
func (h *HttpTester) PATCH(uri string, param interface{}) (int, *response.Response)
PATCH 模擬 Patch Request的動作
func (*HttpTester) POST ¶
func (h *HttpTester) POST(uri string, param interface{}) (int, *response.Response)
POST 模擬Post Request的動作
type HttpTesterInterface ¶
type HttpTesterInterface interface {
GET(uri string) (int, *response.Response)
POST(uri string, param interface{}) (int, *response.Response)
POST_FORM(uri string, param interface{}) (int, *response.Response)
PUT(uri string, param interface{}) (int, *response.Response)
PATCH(uri string, param interface{}) (int, *response.Response)
DELETE(uri string, param interface{}) (int, *response.Response)
}
func NewHttpTester ¶
func NewHttpTester(router *gin.Engine) HttpTesterInterface
type PaginationData ¶
type PaginationData struct {
Total int `json:"total"`
Data interface{} `json:"data"`
}
func NewPaginationData ¶
func NewPaginationData(total int, data interface{}) *PaginationData
type RequestHandler ¶
type RequestHandler struct {
// contains filtered or unexported fields
}
func (*RequestHandler) ValidValidation ¶
func (r *RequestHandler) ValidValidation(c *gin.Context, v *validation.Validation) (int, *response.Response)
ValidValidation : 驗證表單資訊
type RequestHandlerInterface ¶
type RequestHandlerInterface interface {
//BindBody : 綁定 body
BindBody(c *gin.Context, body interface{}) (int, *response.Response)
//ValidValidation : 驗證表單資訊
ValidValidation(c *gin.Context, v *validation.Validation) (int, *response.Response)
}
func NewRequestHandler ¶
func NewRequestHandler() RequestHandlerInterface
type Requester ¶
type Requester struct {
// contains filtered or unexported fields
}
func (*Requester) DeleteWithHeader ¶
func (*Requester) GetWithHeader ¶
func (*Requester) PatchWithHeader ¶
func (*Requester) PostWithHeader ¶
func (*Requester) PutWithHeader ¶
type RequesterInterface ¶
type RequesterInterface interface {
GET(uri string) (*response.Response, error)
POST(uri string, param interface{}) (*response.Response, error)
PUT(uri string, param interface{}) (*response.Response, error)
PATCH(uri string, param interface{}) (*response.Response, error)
DELETE(uri string, param interface{}) (*response.Response, error)
GetWithHeader(uri string, header map[string]string) (*response.Response, error)
PostWithHeader(uri string, header map[string]string, param interface{}) (*response.Response, error)
PutWithHeader(uri string, header map[string]string, param interface{}) (*response.Response, error)
PatchWithHeader(uri string, header map[string]string, param interface{}) (*response.Response, error)
DeleteWithHeader(uri string, header map[string]string, param interface{}) (*response.Response, error)
}
func NewRequester ¶
func NewRequester(client *http.Client) RequesterInterface
Click to show internal directories.
Click to hide internal directories.