Documentation ¶
Index ¶
- func ConvertToArray(dataList interface{}) []interface{}
- func EnvironmentSwitcher(env string, Localhost int, Development int, Testing int, Staging int, ...) interface{}
- func IsInterfaceIsNil(i interface{}) bool
- func MustError(err error, strList ...string)
- func SetDefaultStruct(variable interface{}) interface{}
- type Context
- func (context *Context) ClearState()
- func (context *Context) GetI18N() *I18N
- func (context *Context) GetLang() string
- func (context *Context) GetService() interface{}
- func (context *Context) GetServiceOptionList(name string) interface{}
- func (context *Context) GetState(name string) interface{}
- func (context *Context) SetLang(lang string)
- func (context *Context) SetState(name string, value interface{})
- type DeferClose
- type Env
- type Error
- func (e *Error) GetErrorValidate() *map[string]ResponseErrorValidate
- func (e *Error) GetMessage() string
- func (e *Error) IsContain(subString string) bool
- func (e *Error) IsContainSetError(subString string, errorString string)
- func (e *Error) SetError(str string)
- func (e *Error) SetErrorValidate(errorValidate *map[string]ResponseErrorValidate)
- func (e *Error) SetMessage(str string)
- type FrameWork
- type FuncEnvironment
- type Handler
- type I18N
- type InterfaceApp
- type InterfaceClose
- type InterfaceContext
- type InterfaceHTTP
- type Map
- type MapString
- type RequestFilter
- type RequestFilterType
- type RequestPagination
- type RequestSort
- type ResponseDataList
- type ResponseError
- type ResponseErrorValidate
- type ResponsePagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToArray ¶ added in v0.0.6
func ConvertToArray(dataList interface{}) []interface{}
ConvertToArray func
func EnvironmentSwitcher ¶
func EnvironmentSwitcher(env string, Localhost int, Development int, Testing int, Staging int, Production int, i ...interface{}) interface{}
EnvironmentSwitcher func
func SetDefaultStruct ¶
func SetDefaultStruct(variable interface{}) interface{}
SetDefaultStruct func
Types ¶
type Context ¶ added in v0.0.46
type Context struct { Service interface{} ServiceOptionList map[string]interface{} State map[string]interface{} I18n *I18N }
func NewContext ¶ added in v0.0.47
func (*Context) GetService ¶ added in v0.0.46
func (context *Context) GetService() interface{}
GetService func
func (*Context) GetServiceOptionList ¶ added in v0.0.46
GetServiceOptionList func
type DeferClose ¶ added in v0.0.8
type DeferClose struct { Name string I InterfaceClose }
DeferClose struct
type Error ¶
type Error struct { Code int // Please Use http.Status Error error // contains filtered or unexported fields }
Error Struct
func ValidateStruct ¶
ValidateStruct func
func (*Error) GetErrorValidate ¶ added in v0.0.35
func (e *Error) GetErrorValidate() *map[string]ResponseErrorValidate
func (*Error) GetMessage ¶ added in v0.0.35
func (*Error) IsContainSetError ¶ added in v0.0.35
func (*Error) SetErrorValidate ¶ added in v0.0.35
func (e *Error) SetErrorValidate(errorValidate *map[string]ResponseErrorValidate)
func (*Error) SetMessage ¶ added in v0.0.35
type FrameWork ¶
type FrameWork string
FrameWork type
const ( // FrameWorkGofiber FrameWork FrameWorkGofiberV2 FrameWork = "gofiber/v2" )
type FuncEnvironment ¶ added in v0.0.35
type FuncEnvironment = func(secret MapString) (*Map, *[]DeferClose)
type I18N ¶
type I18N struct {
// contains filtered or unexported fields
}
I18N func
func NewI18N ¶
func NewI18N(defaultLanguage language.Tag, formatUnmarshal string, unmarshalFunc i18n.UnmarshalFunc, fileLanguageList Map) *I18N
NewI18N func
func (*I18N) MustLocalize ¶
MustLocalize func
type InterfaceApp ¶
type InterfaceApp interface { GetFramework() FrameWork App() interface{} GetFrameworkApp() interface{} Listen(port string) error Shutdown() error Get(path string, handlers ...Handler) InterfaceHTTP Group(path string, handlers ...Handler) InterfaceHTTP IsSupportHTTP() bool }
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{}, contentType string, responseCode ...int) error Redirect(location string, responseCode ...int) error SetContext(context *Context) GetContext() *Context 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{}) ValidateStruct(i interface{}, iType map[string]interface{}) *Error SetDefaultStruct(i interface{}) interface{} }
InterfaceContext interface
type InterfaceHTTP ¶ added in v0.0.46
type InterfaceHTTP 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) }
InterfaceHTTP interface
type RequestFilter ¶
type RequestFilter struct { DateStart string `json:"date_start"` DateEnd string `json:"date_end"` FilterList []RequestFilterType `json:"filter"` SortList []RequestSort `json:"sort"` }
RequestFilter Struct
type RequestFilterType ¶ added in v0.0.3
type RequestFilterType struct { Field string `json:"field"` Operator string `json:"op"` Value string `json:"value"` }
RequestFilterType struct
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 RequestSort ¶ added in v0.0.3
RequestSort struct
type ResponseDataList ¶
type ResponseDataList struct { Code int `json:"code" swaggertype:"integer"` 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"` }
ResponseDataList for Send Response Message to Encode Response
type ResponseError ¶
type ResponseError struct { Message string `json:"message" swaggertype:"string"` Validate *map[string]ResponseErrorValidate `json:"validate,omitempty" swaggertype:"object"` }
ResponseError Struct
type ResponseErrorValidate ¶ added in v0.0.6
type ResponseErrorValidate struct { Reason string `json:"reason"` Message string `json:"message"` Param string `json:"param,omitempty"` }
ResponseErrorValidate 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
func GetResponsePagination ¶ added in v0.0.35
func GetResponsePagination(requestPagination RequestPagination, totalCount int, itemCount int) *ResponsePagination
Click to show internal directories.
Click to hide internal directories.