Documentation ¶
Index ¶
- type SvcConfig
- type SvcResponse
- func (s SvcResponse) ResCreated(ctx *iris.Context)
- func (s SvcResponse) ResCreatedWithData(data interface{}, ctx *iris.Context)
- func (s SvcResponse) ResDelete(ctx *iris.Context)
- func (s SvcResponse) ResErr(apiError *dto.Problem, ctx *iris.Context)
- func (s SvcResponse) ResOK(ctx *iris.Context)
- func (s SvcResponse) ResOKWithData(data interface{}, ctx *iris.Context)
- func (s SvcResponse) ResWithDataStatus(status int, data interface{}, ctx *iris.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SvcConfig ¶
type SvcConfig struct { Path string `string:"Path to the config YAML file"` // contains filtered or unexported fields }
SvcConfig exported configuration service struct
type SvcResponse ¶
type SvcResponse struct {
// contains filtered or unexported fields
}
func NewSvcResponse ¶
func NewSvcResponse(appConf *SvcConfig) *SvcResponse
NewSvcResponse create a response service instance. Depends on the app configuration instance
- appConf *SvcConfig ~ App conf instance pointer
func (SvcResponse) ResCreated ¶
func (s SvcResponse) ResCreated(ctx *iris.Context)
ResCreated create a response CREATED but with an empty content (201)
- ctx *iris.Context ~ Iris Request context
func (SvcResponse) ResCreatedWithData ¶
func (s SvcResponse) ResCreatedWithData(data interface{}, ctx *iris.Context)
ResCreatedWithData create response 201 (created) with specified data converted to json in to the context.
- data [interface] ~ "Object" to be marshalled in to the context.
- ctx *iris.Context ~ Iris Request context
func (SvcResponse) ResDelete ¶
func (s SvcResponse) ResDelete(ctx *iris.Context)
ResDelete create response 204. It's delete confirmation wit empty retrieving data. So, the client don't have to expect eny data and, we reduce some traffic.
- ctx *iris.Context ~ Iris Request context
func (SvcResponse) ResErr ¶
func (s SvcResponse) ResErr(apiError *dto.Problem, ctx *iris.Context)
ResErr create and log an 'Error GrantIntentResponse' to the stdout and setup the request context properly. Also set the response status = specific status code, so we can respond the request accordingly (application/problem+json). Ideally, this should be used for client error series (400s) or server error series (500)
- apiError *dto.Problem ~ Error struct
- ctx *iris.Context ~ Iris Request context
func (SvcResponse) ResOK ¶
func (s SvcResponse) ResOK(ctx *iris.Context)
ResOK create a response OK but with an empty content (204)
- ctx *iris.Context ~ Iris Request context
func (SvcResponse) ResOKWithData ¶
func (s SvcResponse) ResOKWithData(data interface{}, ctx *iris.Context)
ResOKWithData create response 200 with specified data converted to json in to the context. - data [interface] ~ "Object" to be marshalled in to the context. - ctx *iris.Context ~ Iris Request context
func (SvcResponse) ResWithDataStatus ¶
func (s SvcResponse) ResWithDataStatus(status int, data interface{}, ctx *iris.Context)
ResWithDataStatus create response with specified status and specified data converted to json in to the context.
- status [int] ~ Integer represent HTTP status for the response. iris.Status constants will be used
- data [interface] ~ "Object" to be marshalled in to the context.
- ctx *iris.Context ~ Iris Request context