From 908931bc01c0d1690723510d122b28b7b99e04ec Mon Sep 17 00:00:00 2001 From: Yavolte Date: Mon, 23 Jun 2025 17:00:36 +0800 Subject: [PATCH] add query --- transport/http/context.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/transport/http/context.go b/transport/http/context.go index ca51749..1617b68 100644 --- a/transport/http/context.go +++ b/transport/http/context.go @@ -38,6 +38,14 @@ func (c *Context) Param(key string) string { return c.ctx.Param(key) } +func (c *Context) Query(key string) string { + qs := c.ctx.Request.URL.Query() + if qs != nil { + return qs.Get(key) + } + return "" +} + func (c *Context) Bind(val any) (err error) { // if params exists, try bind params first if len(c.ctx.Params) > 0 {