Documentation ¶
Index ¶
- func EnvironmentSwitcher(env string, Localhost int, Development int, UAT int, Staging int, ...) interface{}
- func IsInterfaceIsNil(i interface{}) bool
- func MustError(err error, strList ...string)
- func SetDefaultStruct(variable interface{}) interface{}
- type APILifeCycle
- func (api *APILifeCycle) GetHandlerLogic() HandlerLogic
- func (api *APILifeCycle) GetMappingResponse() MappingResponse
- func (api *APILifeCycle) GetMappingResponseStandard() MappingResponseStandard
- func (api *APILifeCycle) GetOnPostAuth() HandlerCycle
- func (api *APILifeCycle) GetOnPostHandler() OnPostHandler
- func (api *APILifeCycle) GetOnPreAuth() HandlerCycle
- func (api *APILifeCycle) GetOnPreHandler() OnPreHandler
- func (api *APILifeCycle) GetOnPreResponse() OnPreResponse
- func (api *APILifeCycle) GetOnStart() HandlerCycle
- func (api *APILifeCycle) GetParseLanguage() HandlerCycle
- func (api *APILifeCycle) GetParseRequest() ParseRequest
- func (api *APILifeCycle) GetSendResponse() SendResponse
- func (api *APILifeCycle) GetValidateAuth() HandlerCycle
- func (api *APILifeCycle) GetValidateHeader() HandlerCycle
- func (api *APILifeCycle) GetValidateParam() ValidateParam
- func (api *APILifeCycle) GetValidateQuery() ValidateQuery
- func (api *APILifeCycle) GetValidateRequest() ValidateRequest
- func (api *APILifeCycle) GetValidateResponse() ValidateResponse
- func (api *APILifeCycle) HandlerLogic(handler HandlerLogic)
- func (api *APILifeCycle) MappingResponse(handler MappingResponse)
- func (api *APILifeCycle) MappingResponseStandard(handler MappingResponseStandard)
- func (api *APILifeCycle) OnPostAuth(handler HandlerCycle)
- func (api *APILifeCycle) OnPostHandler(handler OnPostHandler)
- func (api *APILifeCycle) OnPreAuth(handler HandlerCycle)
- func (api *APILifeCycle) OnPreHandler(handler OnPreHandler)
- func (api *APILifeCycle) OnPreResponse(handler OnPreResponse)
- func (api *APILifeCycle) OnStart(handler HandlerCycle)
- func (api *APILifeCycle) ParseLanguage(handler HandlerCycle)
- func (api *APILifeCycle) ParseRequest(handler ParseRequest)
- func (api *APILifeCycle) SendResponse(handler SendResponse)
- func (api *APILifeCycle) ValidateAuth(handler HandlerCycle)
- func (api *APILifeCycle) ValidateHeader(handler HandlerCycle)
- func (api *APILifeCycle) ValidateParam(handler ValidateParam)
- func (api *APILifeCycle) ValidateQuery(handler ValidateQuery)
- func (api *APILifeCycle) ValidateRequest(handler ValidateRequest)
- func (api *APILifeCycle) ValidateResponse(handler ValidateResponse)
- type Error
- type ErrorValidate
- type ErrorValidateReason
- type FrameWork
- type Handler
- type HandlerByPass
- type HandlerCycle
- type HandlerLogic
- type I18N
- type InterfaceApp
- type InterfaceClose
- type InterfaceContext
- type InterfaceRouter
- type Map
- type MappingResponse
- type MappingResponseStandard
- type OnPostHandler
- type OnPreHandler
- type OnPreResponse
- type ParseRequest
- type RequestFilter
- type RequestPagination
- type ResponseDataList
- type ResponseError
- type ResponsePagination
- type SendResponse
- type ValidateParam
- type ValidateQuery
- type ValidateRequest
- type ValidateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvironmentSwitcher ¶
func EnvironmentSwitcher(env string, Localhost int, Development int, UAT int, Staging int, Production int, i ...interface{}) interface{}
EnvironmentSwitcher func
func SetDefaultStruct ¶
func SetDefaultStruct(variable interface{}) interface{}
SetDefaultStruct func
Types ¶
type APILifeCycle ¶
type APILifeCycle struct {
// contains filtered or unexported fields
}
APILifeCycle Struct
func (*APILifeCycle) GetHandlerLogic ¶
func (api *APILifeCycle) GetHandlerLogic() HandlerLogic
GetHandlerLogic func
func (*APILifeCycle) GetMappingResponse ¶
func (api *APILifeCycle) GetMappingResponse() MappingResponse
GetMappingResponse func
func (*APILifeCycle) GetMappingResponseStandard ¶
func (api *APILifeCycle) GetMappingResponseStandard() MappingResponseStandard
GetMappingResponseStandard func
func (*APILifeCycle) GetOnPostAuth ¶
func (api *APILifeCycle) GetOnPostAuth() HandlerCycle
GetOnPostAuth func
func (*APILifeCycle) GetOnPostHandler ¶
func (api *APILifeCycle) GetOnPostHandler() OnPostHandler
GetOnPostHandler func
func (*APILifeCycle) GetOnPreAuth ¶
func (api *APILifeCycle) GetOnPreAuth() HandlerCycle
GetOnPreAuth func
func (*APILifeCycle) GetOnPreHandler ¶
func (api *APILifeCycle) GetOnPreHandler() OnPreHandler
GetOnPreHandler func
func (*APILifeCycle) GetOnPreResponse ¶
func (api *APILifeCycle) GetOnPreResponse() OnPreResponse
GetOnPreResponse func
func (*APILifeCycle) GetOnStart ¶
func (api *APILifeCycle) GetOnStart() HandlerCycle
GetOnStart func
func (*APILifeCycle) GetParseLanguage ¶
func (api *APILifeCycle) GetParseLanguage() HandlerCycle
GetParseLanguage func
func (*APILifeCycle) GetParseRequest ¶
func (api *APILifeCycle) GetParseRequest() ParseRequest
GetParseRequest func
func (*APILifeCycle) GetSendResponse ¶
func (api *APILifeCycle) GetSendResponse() SendResponse
GetSendResponse func
func (*APILifeCycle) GetValidateAuth ¶
func (api *APILifeCycle) GetValidateAuth() HandlerCycle
GetValidateAuth func
func (*APILifeCycle) GetValidateHeader ¶
func (api *APILifeCycle) GetValidateHeader() HandlerCycle
GetValidateHeader func
func (*APILifeCycle) GetValidateParam ¶
func (api *APILifeCycle) GetValidateParam() ValidateParam
GetValidateParam func
func (*APILifeCycle) GetValidateQuery ¶
func (api *APILifeCycle) GetValidateQuery() ValidateQuery
GetValidateQuery func
func (*APILifeCycle) GetValidateRequest ¶
func (api *APILifeCycle) GetValidateRequest() ValidateRequest
GetValidateRequest func
func (*APILifeCycle) GetValidateResponse ¶
func (api *APILifeCycle) GetValidateResponse() ValidateResponse
GetValidateResponse func
func (*APILifeCycle) HandlerLogic ¶
func (api *APILifeCycle) HandlerLogic(handler HandlerLogic)
HandlerLogic func
func (*APILifeCycle) MappingResponse ¶
func (api *APILifeCycle) MappingResponse(handler MappingResponse)
MappingResponse func
func (*APILifeCycle) MappingResponseStandard ¶
func (api *APILifeCycle) MappingResponseStandard(handler MappingResponseStandard)
MappingResponseStandard func
func (*APILifeCycle) OnPostAuth ¶
func (api *APILifeCycle) OnPostAuth(handler HandlerCycle)
OnPostAuth func
func (*APILifeCycle) OnPostHandler ¶
func (api *APILifeCycle) OnPostHandler(handler OnPostHandler)
OnPostHandler func
func (*APILifeCycle) OnPreAuth ¶
func (api *APILifeCycle) OnPreAuth(handler HandlerCycle)
OnPreAuth func
func (*APILifeCycle) OnPreHandler ¶
func (api *APILifeCycle) OnPreHandler(handler OnPreHandler)
OnPreHandler func
func (*APILifeCycle) OnPreResponse ¶
func (api *APILifeCycle) OnPreResponse(handler OnPreResponse)
OnPreResponse func
func (*APILifeCycle) ParseLanguage ¶
func (api *APILifeCycle) ParseLanguage(handler HandlerCycle)
ParseLanguage func
func (*APILifeCycle) ParseRequest ¶
func (api *APILifeCycle) ParseRequest(handler ParseRequest)
ParseRequest func
func (*APILifeCycle) SendResponse ¶
func (api *APILifeCycle) SendResponse(handler SendResponse)
SendResponse func
func (*APILifeCycle) ValidateAuth ¶
func (api *APILifeCycle) ValidateAuth(handler HandlerCycle)
ValidateAuth func
func (*APILifeCycle) ValidateHeader ¶
func (api *APILifeCycle) ValidateHeader(handler HandlerCycle)
ValidateHeader func
func (*APILifeCycle) ValidateParam ¶
func (api *APILifeCycle) ValidateParam(handler ValidateParam)
ValidateParam func
func (*APILifeCycle) ValidateQuery ¶
func (api *APILifeCycle) ValidateQuery(handler ValidateQuery)
ValidateQuery func
func (*APILifeCycle) ValidateRequest ¶
func (api *APILifeCycle) ValidateRequest(handler ValidateRequest)
ValidateRequest func
func (*APILifeCycle) ValidateResponse ¶
func (api *APILifeCycle) ValidateResponse(handler ValidateResponse)
ValidateResponse func
type Error ¶
type Error struct { Code int // Please Use http.Status Error error ErrorValidate *map[string]ErrorValidate }
Error Struct
func ValidateStruct ¶
func ValidateStruct(context InterfaceContext, i interface{}, iType map[string]interface{}) *Error
ValidateStruct func
type ErrorValidate ¶
type ErrorValidate struct { Reason string `json:"reason"` Message string `json:"message"` Param string `json:"param,omitempty"` }
ErrorValidate struct
type FrameWork ¶
type FrameWork string
FrameWork type
var ( // FrameWorkGofiber FrameWork FrameWorkGofiber FrameWork = "gofiber" )
type HandlerByPass ¶
HandlerByPass Type
type HandlerCycle ¶
type HandlerCycle = func(context InterfaceContext) (err *Error)
HandlerCycle Type
type HandlerLogic ¶
type HandlerLogic = func(context InterfaceContext, requestValidatedBody interface{}, requestValidatedParam interface{}, requestValidatedQuery interface{}) (code int, responseRaw interface{}, responsePagination *ResponsePagination, err *Error)
HandlerLogic Type
type I18N ¶
type I18N struct {
// contains filtered or unexported fields
}
I18N func
type InterfaceApp ¶
type InterfaceApp interface { GetFramework() FrameWork GetFrameworkApp() interface{} Listen(port string) error Shutdown() error Get(path string, handlers ...Handler) InterfaceRouter Group(path string, handlers ...Handler) InterfaceRouter }
InterfaceApp interface
type InterfaceClose ¶
type InterfaceClose interface {
Close() error
}
InterfaceClose for Manage Defer Close
type InterfaceContext ¶
type InterfaceContext interface { GetFramework() FrameWork GetFrameworkContext() interface{} Response(responseDataList interface{}, responseCode ...int) error Redirect(location string, responseCode ...int) error SetContext(service interface{}, serviceOptionList map[string]interface{}, i18n *I18N, state map[string]interface{}) GetService() interface{} GetServiceOptionList(name string) interface{} GetState(name string) interface{} SetState(name string, value interface{}) SetContentType(str string) SetHeader(key string, val string) GetHeader(key string, defaultValue ...string) string GetQuery(key string, defaultValue ...string) string QueryParser(out interface{}) error GetParam(key string, defaultValue ...string) string GetBody() []byte BodyParser(out interface{}) error GetCookie(key string, val string) SetCookie(cookie interface{}) ClearCookie(key ...string) Log(v ...interface{}) SetLang(lang string) GetLang() string MustLocalize(id string, data Map, count int, m ...interface{}) string ValidateStruct(i interface{}, iType map[string]interface{}) *Error SetDefaultStruct(i interface{}) interface{} }
InterfaceContext interface
type InterfaceRouter ¶
type InterfaceRouter interface { Add(method string, path string, handlers ...func(ctx InterfaceContext) error) Get(path string, handlers ...func(ctx InterfaceContext) error) Post(path string, handlers ...func(ctx InterfaceContext) error) Put(path string, handlers ...func(ctx InterfaceContext) error) Patch(path string, handlers ...func(ctx InterfaceContext) error) Delete(path string, handlers ...func(ctx InterfaceContext) error) }
InterfaceRouter interface
type MappingResponse ¶
type MappingResponse = func(context InterfaceContext, code int, responseRaw interface{}, responsePagination *ResponsePagination) (codeOut int, responseMapping interface{}, responsePaginationOut *ResponsePagination, err *Error)
MappingResponse Type
type MappingResponseStandard ¶
type MappingResponseStandard = func(context InterfaceContext, code int, responseRaw interface{}, responsePagination *ResponsePagination) (codeOut int, responseMapping interface{}, err *Error)
MappingResponseStandard Type
type OnPostHandler ¶
type OnPostHandler = func(context InterfaceContext, code int, responseRawIn interface{}, responsePagination *ResponsePagination) (codeOut int, responseRawOut interface{}, responsePaginationOut *ResponsePagination, err *Error)
OnPostHandler Type
type OnPreHandler ¶
type OnPreHandler = func(context InterfaceContext, requestValidatedBody interface{}, requestValidatedParam interface{}, requestValidatedQuery interface{}) (requestValidatedBodyOut interface{}, requestValidatedParamOut interface{}, requestValidatedQueryOut interface{}, err *Error)
OnPreHandler Type
type OnPreResponse ¶
type OnPreResponse = func(context InterfaceContext, code int, requestValidatedIn interface{}) (codeOut int, requestValidatedOut interface{}, err *Error)
OnPreResponse Type
type ParseRequest ¶
type ParseRequest = func(context InterfaceContext) (requestMappingBody interface{}, err *Error)
ParseRequest Type
type RequestPagination ¶
type RequestPagination struct { Page int `json:"page" default:"1" swaggertype:"integer"` PageSize int `json:"page_size" default:"10" swaggertype:"integer"` }
RequestPagination Struct
type ResponseDataList ¶
type ResponseDataList struct { Success bool `json:"success" swaggertype:"boolean"` Message string `json:"message" swaggertype:"string"` Data interface{} `json:"data,omitempty" swaggertype:"object"` ResponsePagination *ResponsePagination `json:"pagination,omitempty" swaggertype:"object"` ResponseError *ResponseError `json:"error,omitempty" swaggertype:"object"` // errors don't define JSON marshaling` }
ResponseDataList for Send Response Message to Encode Response
type ResponseError ¶
type ResponseError struct { Message string `json:"message" swaggertype:"string"` Validate *map[string]ErrorValidate `json:"validate,omitempty" swaggertype:"object"` }
ResponseError Struct
type ResponsePagination ¶
type ResponsePagination struct { Page int `json:"page" swaggertype:"integer"` PageSize int `json:"page_size" swaggertype:"integer"` PageCount int `json:"page_count" swaggertype:"integer"` ItemCount int `json:"item_count" swaggertype:"integer"` TotalCount int `json:"total_count" swaggertype:"integer"` }
ResponsePagination Struct
type SendResponse ¶
type SendResponse = func(context InterfaceContext, code int, requestValidated interface{}) (err *Error)
SendResponse Type
type ValidateParam ¶
type ValidateParam = func(context InterfaceContext) (requestValidatedParam interface{}, err *Error)
ValidateParam Type
type ValidateQuery ¶
type ValidateQuery = func(context InterfaceContext) (requestValidatedQuery interface{}, err *Error)
ValidateQuery Type
type ValidateRequest ¶
type ValidateRequest = func(context InterfaceContext, requestMappingBody interface{}) (requestValidatedBody interface{}, err *Error)
ValidateRequest Type
type ValidateResponse ¶
type ValidateResponse = func(context InterfaceContext, code int, responseMapping interface{}, responsePagination *ResponsePagination) (codeOut int, responseValidated interface{}, responsePaginationOut *ResponsePagination, err *Error)
ValidateResponse Type