working commit

This commit is contained in:
2026-02-07 15:47:52 +02:00
parent 4565e18e36
commit 517c518df2
4 changed files with 330 additions and 7 deletions
+9 -3
View File
@@ -15,14 +15,20 @@ import (
"mstore/app/router"
)
type Response struct {
type xxxResponse struct {
Error bool `json:"error" yaml:"error"`
Message string `json:"message,omitempty" yaml:"message,omitempty"`
Result any `json:"result,omitempty" yaml:"result,result"`
}
type GenericResponse[T any] struct {
Error bool `json:"error" yaml:"error"`
Message string `json:"message,omitempty" yaml:"message,omitempty"`
Result T `json:"result,omitempty" yaml:"result,result"`
}
func (hand *Handler) SendResult(rctx *router.Context, result any) {
response := &Response{
response := &GenericResponse[any]{
Error: false,
Result: result,
}
@@ -30,7 +36,7 @@ func (hand *Handler) SendResult(rctx *router.Context, result any) {
}
func (hand *Handler) SendError(rctx *router.Context, err error) {
response := &Response{
response := &GenericResponse[any]{
Error: true,
Message: err.Error(),
}