Skip to content

Commit d0d9c4a

Browse files
committed
add go tils
1 parent 0d3ce80 commit d0d9c4a

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

go/custom-request-validation-with-ozoo-validation-go.md renamed to content/posts/custom-request-validation-with-ozoo-validation-go.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
author: "Saqib Razzaq"
3+
title: "Custom Request Validation with ozzo-validation in Go"
4+
date: "2025-04-06"
5+
tags: ["go"]
6+
---
7+
18
Custom validation in Echo using `ozzo-validation` makes input handling much cleaner and more structured. Instead of manually checking each field, you can define validation rules declaratively.
29

310
Let's say we need to validate a form submission where each field has attributes like label, type, and is_required.

go/group-similar-routes-in-go-echo.md renamed to content/posts/group-similar-routes-in-go-echo.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
## Group Similar Routes in Go Echo
1+
---
2+
author: "Saqib Razzaq"
3+
title: "Group Similar Routes in Go Echo"
4+
date: "2025-04-06"
5+
tags: ["go", "echo"]
6+
---
7+
28
Using Echo groups is a great way to organize routes, especially when dealing with versioning, middleware, or related endpoints. Instead of cluttering the main file with multiple routes, you can logically group them.
39

410
```go
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
## Parsing JSON into a Struct in Go
1+
---
2+
author: "Saqib Razzaq"
3+
title: "Parse JSON to Struct in Go"
4+
date: "2025-04-06"
5+
tags: ["go"]
6+
---
7+
28
Parsing JSON into a struct using json.Unmarshal is a fundamental task in Go when working with APIs or reading JSON files. The encoding/json package makes this process straightforward.
39

410
Let's say we receive the following JSON payload:

go/request-logger-middleware-go-echo.md renamed to content/posts/request-logger-middleware-go-echo.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
## Go Echo Request Logger Middleware
1+
---
2+
author: "Saqib Razzaq"
3+
title: "Request Logger Middleware in Go Echo"
4+
date: "2025-04-06"
5+
tags: ["go", "echo"]
6+
---
7+
28
Middleware in Echo allows us to intercept requests before they reach handlers, making it a great place to add logging. Echo provides a built-in logging middleware (middleware.Logger()) but for more control, we can create a custom middleware:
39

410

0 commit comments

Comments
 (0)