Documentation
¶
Index ¶
- func BindToDynamicEntity(echoCtx echo.Context, entitySchema *dmodel.ModelSchema) (dmodel.DynamicFields, error)
- func CustomHttpErrorHandler(defaultHandler echo.HTTPErrorHandler) echo.HTTPErrorHandler
- func InitSubModule() error
- func JsonBadRequest(echoCtx echo.Context, err any) error
- func JsonCreated(echoCtx echo.Context, data any) error
- func JsonOk(echoCtx echo.Context, data any) error
- func ServeRequest[THttpReq any, THttpResp any, TSvcCommand any, TSvcResult CmdResult](echoCtx echo.Context, ...) error
- func ServeRequest2[THttpReq any, THttpResp any, TSvcCommand any, TSvcResultData any](echoCtx echo.Context, ...) error
- func ServeRequestDynamic[THttpResp any, TSvcCommand any, TSvcResultData any](echoCtx echo.Context, ...) error
- type CmdResult
- type HttpServer
- type RestBase
- type RestCreateResponse
- type RestDeleteResponse
- type RestDeleteResponse2
- type RestMutateResponse
- type RestSearchResponse
- type RestUpdateResponse
- type RestUpdateResponse2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindToDynamicEntity ¶
func BindToDynamicEntity(echoCtx echo.Context, entitySchema *dmodel.ModelSchema) (dmodel.DynamicFields, error)
BindToDynamicEntity parses the echo request body and returns a DynamicEntity containing only the fields defined in the given ModelSchema. Minimal type correction is applied via each field's TryConvert; on conversion failure the raw parsed value is kept as-is. No validation is performed.
func CustomHttpErrorHandler ¶
func CustomHttpErrorHandler(defaultHandler echo.HTTPErrorHandler) echo.HTTPErrorHandler
func InitSubModule ¶
func InitSubModule() error
func ServeRequest ¶
func ServeRequest[THttpReq any, THttpResp any, TSvcCommand any, TSvcResult CmdResult]( echoCtx echo.Context, serviceFn func(ctx corecrud.Context, cmd TSvcCommand) (*TSvcResult, error), requestToCommandFn func(request THttpReq) TSvcCommand, resultToResponseFn func(result TSvcResult) THttpResp, jsonSuccessFn func(echo.Context, any) error, ) error
func ServeRequest2 ¶
func ServeRequest2[THttpReq any, THttpResp any, TSvcCommand any, TSvcResultData any]( echoCtx echo.Context, serviceFn func(ctx corectx.Context, cmd TSvcCommand) (*dyn.OpResult[TSvcResultData], error), requestToCommandFn func(request THttpReq) TSvcCommand, resultToResponseFn func(resultData TSvcResultData) THttpResp, jsonSuccessFn func(echo.Context, any) error, skipNotFoundError ...bool, ) error
func ServeRequestDynamic ¶
func ServeRequestDynamic[THttpResp any, TSvcCommand any, TSvcResultData any]( echoCtx echo.Context, serviceFn func(ctx corectx.Context, cmd TSvcCommand) (*dyn.OpResult[TSvcResultData], error), requestToCommandFn func(requestFields dmodel.DynamicFields) TSvcCommand, resultToResponseFn func(data TSvcResultData) THttpResp, jsonSuccessFn func(echo.Context, any) error, ) error
Types ¶
type CmdResult ¶
type CmdResult interface {
GetClientError() *ft.ClientError
GetHasData() bool
}
type HttpServer ¶
type HttpServer struct {
Name string
EchoServer *echo.Echo
Logger logging.LoggerService
Host string
Port int32
}
func (HttpServer) Shutdown ¶
func (this HttpServer) Shutdown()
func (HttpServer) Start ¶
func (this HttpServer) Start() error
func (HttpServer) Use ¶
func (this HttpServer) Use(middlewares ...echo.MiddlewareFunc)
type RestBase ¶
type RestBase struct {
ConfigSvc config.ConfigService
Logger logging.LoggerService
CqrsBus cqrs.CqrsBus
}
type RestCreateResponse ¶
type RestCreateResponse struct {
Id model.Id `json:"id"`
// For backward compatibility. Will be removed.
CreatedAtMs int64 `json:"createdAt,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
Etag model.Etag `json:"etag"`
}
func NewRestCreateResponseDyn ¶
func NewRestCreateResponseDyn(fields dmodel.DynamicFields) *RestCreateResponse
func (*RestCreateResponse) FromEntity ¶
func (this *RestCreateResponse) FromEntity(src createdEntity)
func (*RestCreateResponse) FromNonEntity ¶
func (this *RestCreateResponse) FromNonEntity(src any)
type RestDeleteResponse ¶
func (*RestDeleteResponse) FromEntity ¶
func (this *RestDeleteResponse) FromEntity(src deletedEntity)
func (*RestDeleteResponse) FromNonEntity ¶
func (this *RestDeleteResponse) FromNonEntity(src any)
type RestDeleteResponse2 ¶
type RestDeleteResponse2 struct {
AffectedCount int `json:"affected_count"`
AffectedAt string `json:"affected_at"`
}
func NewRestDeleteResponse2 ¶
func NewRestDeleteResponse2(src dyn.MutateResultData) RestDeleteResponse2
type RestMutateResponse ¶
type RestMutateResponse struct {
AffectedCount int `json:"affected_count"`
AffectedAt string `json:"affected_at"`
}
RestMutateResponse is a mutation payload without etag (e.g. junction-only updates).
func NewRestMutateResponse ¶
func NewRestMutateResponse(src dyn.MutateResultData) RestMutateResponse
type RestSearchResponse ¶
type RestSearchResponse[TItem any] struct { Items []TItem `json:"items"` Total int `json:"total"` Page int `json:"page"` Size int `json:"size"` }
func NewSearchUsersResponseDyn ¶
func NewSearchUsersResponseDyn[TItem dmodel.DynamicModelGetter]( data dyn.PagedResultData[TItem], ) RestSearchResponse[dmodel.DynamicFields]
type RestUpdateResponse ¶
type RestUpdateResponse struct {
Id model.Id `json:"id"`
UpdatedAtMs int64 `json:"updatedAt,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
Etag model.Etag `json:"etag"`
}
func (*RestUpdateResponse) FromEntity ¶
func (this *RestUpdateResponse) FromEntity(src updatedEntity)
func (*RestUpdateResponse) FromNonEntity ¶
func (this *RestUpdateResponse) FromNonEntity(src any)
type RestUpdateResponse2 ¶
type RestUpdateResponse2 struct {
AffectedCount int `json:"affected_count"`
AffectedAt string `json:"affected_at"`
Etag model.Etag `json:"etag"`
}
func NewRestUpdateResponse2 ¶
func NewRestUpdateResponse2(src dyn.MutateResultData) RestUpdateResponse2
Click to show internal directories.
Click to hide internal directories.