Documentation ¶
Index ¶
- func ConvertToArray(dataList interface{}) []interface{}
- func EnvironmentSwitcher(env string, Localhost int, Development int, Testing int, Staging int, ...) interface{}
- func GetOneFromArray(list ...interface{}) interface{}
- func IsInterfaceIsNil(i interface{}) bool
- func MustError(err error, strList ...string)
- func SetDefaultStruct(variable interface{}) interface{}
- type Context
- func (context *Context) App() InterfaceContext
- 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) SetApp(i InterfaceContext)
- func (context *Context) SetDefaultStruct(i interface{}) interface{}
- func (context *Context) SetLang(lang string)
- func (context *Context) SetState(name string, value interface{})
- func (context *Context) ValidateStruct(i interface{}, iType map[string]interface{}) *Error
- 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 InterfaceAMQP
- 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 GetOneFromArray ¶ added in v0.0.59
func GetOneFromArray(list ...interface{}) interface{}
func SetDefaultStruct ¶
func SetDefaultStruct(variable interface{}) interface{}
SetDefaultStruct func
Types ¶
type Context ¶ added in v0.0.46
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶ added in v0.0.47
func NewContext(i InterfaceContext, service interface{}, serviceOptionList map[string]interface{}, state map[string]interface{}, i18n *I18N) *Context
func NewContextDefault ¶ added in v0.0.55
func NewContextDefault() *Context
func (*Context) App ¶ added in v0.0.52
func (context *Context) App() InterfaceContext
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
func (*Context) SetApp ¶ added in v0.0.54
func (context *Context) SetApp(i InterfaceContext)
func (*Context) SetDefaultStruct ¶ added in v0.0.52
func (context *Context) SetDefaultStruct(i interface{}) interface{}
SetDefaultStruct func
func (*Context) ValidateStruct ¶ added in v0.0.52
ValidateStruct 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 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{} SetApp(interface{}) Listen(port string, extraList ...interface{}) error Shutdown() error Get(path string, context *Context, handleList ...Handler) InterfaceHTTP Group(path string, context *Context, handleList ...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 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{}) }
InterfaceContext interface
type InterfaceHTTP ¶ added in v0.0.46
type InterfaceHTTP interface { Add(method string, path string, context *Context, handleList ...func(context *Context) error) Get(path string, context *Context, handleList ...func(context *Context) error) Post(path string, context *Context, handleList ...func(context *Context) error) Put(path string, context *Context, handleList ...func(context *Context) error) Patch(path string, context *Context, handleList ...func(context *Context) error) Delete(path string, context *Context, handleList ...func(context *Context) 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.