Documentation
¶
Index ¶
- func ApiServiceToGinHandler[T any](engine IEngine, service func(ctx IContext[T])) gin.HandlerFunc
- func CRON(engine IEngine, spec string, job func())
- func DELETE[T any](engine IEngine, route string, handler Handler[T], ...)
- func DELETECached[T any](engine IEngine, route string, handler Handler[T], duration time.Duration, ...)
- func GET[T any](engine IEngine, route string, handler Handler[T], ...)
- func GETCached[T any](engine IEngine, route string, handler Handler[T], duration time.Duration, ...)
- func POST[T any](engine IEngine, route string, handler Handler[T], ...)
- func POSTCached[T any](engine IEngine, route string, handler Handler[T], duration time.Duration, ...)
- func PUT[T any](engine IEngine, route string, handler Handler[T], ...)
- func PUTCached[T any](engine IEngine, route string, handler Handler[T], duration time.Duration, ...)
- func RegisterError(code, message string, locale ...string)
- func WS[T any](engine IEngine, route string, handler Handler[T], ...)
- func WsServiceToGinHandler[T any](engine IEngine, service func(ctx IContext[T])) gin.HandlerFunc
- type Context
- func (ctx *Context[T]) BearerToken() string
- func (ctx *Context[T]) ClientIP() string
- func (ctx *Context[T]) Err(code string, locale ...string)
- func (ctx *Context[T]) Forbidden(msg ...string)
- func (c *Context[T]) GetEngine() IEngine
- func (c *Context[T]) GetGinCtx() *gin.Context
- func (c *Context[T]) GetHasResp() bool
- func (c *Context[T]) GetIsFile() bool
- func (c *Context[T]) GetPage() models.IPagination
- func (c *Context[T]) GetRequest() *T
- func (c *Context[T]) GetResponse() IResponse
- func (c *Context[T]) GetSort() models.ISorting
- func (c *Context[T]) GetStartAt() time.Time
- func (ctx *Context[T]) InternalServerError(msg ...string)
- func (ctx *Context[T]) OK(data any, page ...models.IPagination)
- func (ctx *Context[T]) OKDownload(bytes []byte, filename ...string)
- func (ctx *Context[T]) OKFile(bytes []byte, filename ...string)
- func (c *Context[T]) SetEngine(engine IEngine)
- func (c *Context[T]) SetGinCtx(ginCtx *gin.Context)
- func (c *Context[T]) SetHasResp(hasResp bool)
- func (c *Context[T]) SetIsFile(isFile bool)
- func (c *Context[T]) SetPage(page models.IPagination)
- func (c *Context[T]) SetRequest(request *T)
- func (c *Context[T]) SetResponse(response IResponse)
- func (c *Context[T]) SetSort(sort models.ISorting)
- func (c *Context[T]) SetStartAt(startAt time.Time)
- func (ctx *Context[T]) Unauthorized(msg ...string)
- func (ctx *Context[T]) UserAgent() string
- type Engine
- type Error
- type Handler
- type IContext
- type IEngine
- type IError
- type IResponse
- type Response
- func (r *Response) GetData() any
- func (r *Response) GetDuration() int64
- func (r *Response) GetError() IError
- func (r *Response) GetPagination() models.IPagination
- func (r *Response) GetSuccess() bool
- func (r *Response) SetData(data any)
- func (r *Response) SetDuration(duration int64)
- func (r *Response) SetError(err IError)
- func (r *Response) SetPagination(pagination models.IPagination)
- func (r *Response) SetSuccess(success bool)
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiServiceToGinHandler ¶
func ApiServiceToGinHandler[T any](engine IEngine, service func(ctx IContext[T])) gin.HandlerFunc
func DELETECached ¶
func POSTCached ¶
func RegisterError ¶
func WsServiceToGinHandler ¶
func WsServiceToGinHandler[T any](engine IEngine, service func(ctx IContext[T])) gin.HandlerFunc
Types ¶
type Context ¶
type Context[T any] struct { Engine IEngine GinCtx *gin.Context Page models.IPagination Sort models.ISorting Request *T Response IResponse StartAt time.Time HasResp bool IsFile bool }
func (*Context[T]) BearerToken ¶
func (*Context[T]) GetHasResp ¶
func (*Context[T]) GetPage ¶
func (c *Context[T]) GetPage() models.IPagination
func (*Context[T]) GetRequest ¶
func (c *Context[T]) GetRequest() *T
func (*Context[T]) GetResponse ¶
func (*Context[T]) GetStartAt ¶
func (*Context[T]) InternalServerError ¶ added in v1.2.0
func (*Context[T]) OKDownload ¶
func (*Context[T]) SetHasResp ¶
func (*Context[T]) SetPage ¶
func (c *Context[T]) SetPage(page models.IPagination)
func (*Context[T]) SetRequest ¶
func (c *Context[T]) SetRequest(request *T)
func (*Context[T]) SetResponse ¶
func (*Context[T]) SetStartAt ¶
func (*Context[T]) Unauthorized ¶ added in v1.2.0
type IContext ¶
type IContext[T any] interface { GetEngine() IEngine SetEngine(IEngine) GetGinCtx() *gin.Context SetGinCtx(*gin.Context) GetPage() models.IPagination SetPage(models.IPagination) GetSort() models.ISorting SetSort(models.ISorting) GetRequest() *T SetRequest(*T) GetResponse() IResponse SetResponse(IResponse) GetStartAt() time.Time SetStartAt(time.Time) GetHasResp() bool SetHasResp(bool) GetIsFile() bool SetIsFile(bool) BearerToken() string ClientIP() string UserAgent() string OK(data any, page ...models.IPagination) OKFile(bytes []byte, filename ...string) OKDownload(bytes []byte, filename ...string) Err(code string, locale ...string) InternalServerError(msg ...string) Forbidden(msg ...string) }
type Response ¶
type Response struct { Success bool `json:"success"` Duration int64 `json:"duration"` Pagination models.IPagination `json:"pagination,omitempty"` Error IError `json:"error,omitempty"` Data any `json:"data,omitempty"` }
func (*Response) GetDuration ¶
func (*Response) GetPagination ¶
func (r *Response) GetPagination() models.IPagination
func (*Response) GetSuccess ¶
func (*Response) SetDuration ¶
func (*Response) SetPagination ¶
func (r *Response) SetPagination(pagination models.IPagination)
func (*Response) SetSuccess ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.