wp-go/middleware/searchlimit.go

16 lines
254 B
Go
Raw Normal View History

2022-10-14 09:15:43 +00:00
package middleware
import "github.com/gin-gonic/gin"
2022-11-16 03:09:25 +00:00
func SearchLimit(num int64) (func(ctx *gin.Context), func(int64)) {
fn, reFn := IpLimit(num)
2022-10-14 09:15:43 +00:00
return func(c *gin.Context) {
2022-10-17 12:04:29 +00:00
if c.Query("s") != "" {
2022-10-14 09:15:43 +00:00
fn(c)
} else {
c.Next()
}
2022-11-16 03:09:25 +00:00
}, reFn
2022-10-14 09:15:43 +00:00
}