feat:readme 添加 hertz 示例

This commit is contained in:
yuegc
2026-01-28 10:40:12 +08:00
parent 6d2e522561
commit 2ef3354192
2 changed files with 15 additions and 0 deletions
+8
View File
@@ -46,6 +46,9 @@ go get github.com/click33/sa-token-go/integrations/chi@latest # Chi framework
go get github.com/click33/sa-token-go/integrations/gf@latest # GoFrame framework
# or
go get github.com/click33/sa-token-go/integrations/kratos@latest # Kratos framework
# or
go get github.com/click33/sa-token-go/integrations/hertz@latest # Hertz framework
```
# Storage module (choose one)
go get github.com/click33/sa-token-go/storage/memory@latest # Memory storage (dev)
@@ -70,6 +73,7 @@ go get github.com/click33/sa-token-go/integrations/fiber@latest # Fiber framewor
go get github.com/click33/sa-token-go/integrations/chi@latest # Chi framework
go get github.com/click33/sa-token-go/integrations/gf@latest # GoFrame framework
go get github.com/click33/sa-token-go/integrations/kratos@latest# Kratos framework
go get github.com/click33/sa-token-go/integrations/hertz@latest # Hertz framework
```
### ⚡ Minimal Usage (One-line Initialization)
@@ -378,6 +382,10 @@ r.Get("/user", sachi.CheckLogin(), handler)
// Kratos
import sakratos "github.com/click33/sa-token-go/integrations/kratos"
// Use Plugin.Server() as middleware
// Hertz
import sahertz "github.com/click33/sa-token-go/integrations/hertz"
h.GET("/user", sahertz.CheckLogin(), handler)
```
## 🎨 Advanced Features
+7
View File
@@ -46,6 +46,8 @@ go get github.com/click33/sa-token-go/integrations/chi@latest # Chi框架
go get github.com/click33/sa-token-go/integrations/gf@latest # GoFrame框架
# 或
go get github.com/click33/sa-token-go/integrations/kratos@latest# Kratos框架
# 或
go get github.com/click33/sa-token-go/integrations/hertz@latest # Hertz框架
# 存储模块(选一个)
go get github.com/click33/sa-token-go/storage/memory@latest # 内存存储(开发)
@@ -70,6 +72,7 @@ go get github.com/click33/sa-token-go/integrations/fiber@latest # Fiber框架
go get github.com/click33/sa-token-go/integrations/chi@latest # Chi框架
go get github.com/click33/sa-token-go/integrations/gf@latest # GoFrame框架
go get github.com/click33/sa-token-go/integrations/kratos@latest# Kratos框架
go get github.com/click33/sa-token-go/integrations/hertz@latest # Hertz框架
```
### ⚡ 超简洁使用(一行初始化)
@@ -378,6 +381,10 @@ r.Get("/user", sachi.CheckLogin(), handler)
// Kratos
import sakratos "github.com/click33/sa-token-go/integrations/kratos"
// 使用 Plugin.Server() 作为中间件
// Hertz
import sahertz "github.com/click33/sa-token-go/integrations/hertz"
h.GET("/user", sahertz.CheckLogin(), handler)
```
## 🎨 高级特性