diff --git a/TODO b/TODO index 7cb9a29eb..99c6ea359 100644 --- a/TODO +++ b/TODO @@ -17,6 +17,8 @@ gfsnotify增加对于目录的监控; orm增加sqlite对Save方法的支持(去掉触发器语句); ghttp.Server的Cookie及Session锁机制优化(去掉map锁机制); ghttp.Server增加Ip访问控制功能(DenyIps&AllowIps); +ghttp路由功能增加分组路由特性; + DONE: 1. gconv完善针对不同类型的判断,例如:尽量减少sprintf("%v", xxx)来执行string类型的转换; diff --git a/g/net/ghttp/ghttp_request.go b/g/net/ghttp/ghttp_request.go index b765345f8..9835bc7e4 100644 --- a/g/net/ghttp/ghttp_request.go +++ b/g/net/ghttp/ghttp_request.go @@ -95,6 +95,34 @@ func (r *Request) GetJson() *gjson.Json { return nil } +func (r *Request) GetString(k string) string { + return r.GetRequestString(k) +} + +func (r *Request) GetInt(k string) int { + return r.GetRequestInt(k) +} + +func (r *Request) GetUint(k string) uint { + return r.GetRequestUint(k) +} + +func (r *Request) GetFloat32(k string) float32 { + return r.GetRequestFloat32(k) +} + +func (r *Request) GetFloat64(k string) float64 { + return r.GetRequestFloat64(k) +} + +func (r *Request) GetArray(k string) []string { + return r.GetRequestArray(k) +} + +func (r *Request) GetMap(defaultMap...map[string]string) map[string]string { + return r.GetRequestMap(defaultMap...) +} + // 将所有的request参数映射到struct属性上,参数object应当为一个struct对象的指针, mapping为非必需参数,自定义参数与属性的映射关系 func (r *Request) GetToStruct(object interface{}, mapping...map[string]string) { r.GetRequestToStruct(object, mapping...)