-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: consolidate result handling and refactor fx module names
- Replace `ResponseResult` with `Result` and simplify result handling - Rename Fx modules for consistency (e.g., `Module` to `FxModule`) - Implement interface assertions for repository implementations - Change Result methods to return `ResultImpl` - Refactor middleware to use new `Result` type - Add and refactor result definition and related tests - Rename `Module` to `FxModule` in various packages for clarity
- Loading branch information
Showing
32 changed files
with
353 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package httpfx | ||
|
||
type ( | ||
Handler func(*Context) ResponseResult | ||
Handler func(*Context) Result | ||
HandlerChain []Handler | ||
Middleware func() Handler | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package httpfx | ||
|
||
import ( | ||
"github.com/eser/go-service/pkg/bliss/results" | ||
) | ||
|
||
type Result interface { | ||
results.Result | ||
|
||
StatusCode() int | ||
Body() []byte | ||
|
||
RedirectToUri() string | ||
} | ||
|
||
type ResultImpl struct { | ||
results.ResultImpl | ||
|
||
InnerStatusCode int | ||
InnerBody []byte | ||
|
||
InnerRedirectToUri string | ||
} | ||
|
||
var _ Result = (*ResultImpl)(nil) | ||
|
||
func (r ResultImpl) StatusCode() int { | ||
return r.InnerStatusCode | ||
} | ||
|
||
func (r ResultImpl) Body() []byte { | ||
return r.InnerBody | ||
} | ||
|
||
func (r ResultImpl) RedirectToUri() string { | ||
return r.InnerRedirectToUri | ||
} | ||
|
||
func (r ResultImpl) WithStatusCode(statusCode int) ResultImpl { | ||
r.InnerStatusCode = statusCode | ||
|
||
return r | ||
} | ||
|
||
func (r ResultImpl) WithBody(body string) ResultImpl { | ||
r.InnerBody = []byte(body) | ||
|
||
return r | ||
} |
Oops, something went wrong.