helper

package
v0.0.0-...-019737a Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPHelper

type HTTPHelper struct{}

HTTPHelper struct of helper Gin

func NewServiceHTTPHelper

func NewServiceHTTPHelper() *HTTPHelper

NewServiceHTTPHelper for wrapping the http helper

func (*HTTPHelper) EchoResponse

func (helper *HTTPHelper) EchoResponse(
	c *gin.Context,
	code int,
	status bool,
	message string,
	err string,
	data interface{},
)

EchoResponse to echo the response http

func (*HTTPHelper) EchoResponseBadRequest

func (helper *HTTPHelper) EchoResponseBadRequest(c *gin.Context, message string, err string)

EchoResponseBadRequest for Response Failed

func (*HTTPHelper) EchoResponseCreated

func (helper *HTTPHelper) EchoResponseCreated(c *gin.Context, data interface{})

EchoResponseCreated for Response Success

func (*HTTPHelper) EchoResponseSuccess

func (helper *HTTPHelper) EchoResponseSuccess(c *gin.Context, data interface{})

EchoResponseSuccess for Response Success

func (*HTTPHelper) EchoResponseWithPagination

func (helper *HTTPHelper) EchoResponseWithPagination(c *gin.Context, data interface{}, page string, totalData string)

EchoResponseWithPagination for Response Success

func (*HTTPHelper) TestAPI

func (helper *HTTPHelper) TestAPI(
	r http.Handler, method, path string,
	params []byte,
	header map[string]string,
) *httptest.ResponseRecorder

TestAPI for wrapping manual and return httptest.ResponseRecorder

func (*HTTPHelper) TestHTTPResponse

func (helper *HTTPHelper) TestHTTPResponse(
	t *testing.T,
	r *gin.Engine,
	req *http.Request,
	f func(w *httptest.ResponseRecorder) (bool, error),
) error

TestHTTPResponse for wrapping a errro

type HTTPRepoHelper

type HTTPRepoHelper interface {
	TestHttpResponse(t *testing.T, r *gin.Engine, req *http.Request, f func(w *httptest.ResponseRecorder) (bool, error)) error
	TestAPI(r http.Handler, method, path string) *httptest.ResponseRecorder
}

HTTPRepoHelper repo for mock Helper

type ReadConfig

type ReadConfig struct {
	// contains filtered or unexported fields
}

ReadConfig for get config yaml file

func NewReadConfigService

func NewReadConfigService() *ReadConfig

NewReadConfigService for new service config

func (*ReadConfig) GetByName

func (cfg *ReadConfig) GetByName(params string) string

GetByName Find and read the config file

func (*ReadConfig) Init

func (cfg *ReadConfig) Init() error

Init initial function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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