You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simpleRequest/param.go

37 lines
644 B
Go

3 years ago
/*
* @FileName: param.go
* @Author: JJXu
3 years ago
* @CreateTime: 2022/3/1 9:07
* @Description:
*/
package simpleRequest
import (
"fmt"
"net/url"
)
type QueryParams struct {
simpleReq *SimpleRequest
}
//batch settings
func (s *QueryParams) Sets(data map[string]any) *QueryParams {
3 years ago
for k, v := range data {
s.simpleReq.queryParams.Set(k, fmt.Sprintf("%v", v))
}
return s
}
//single settings
func (s *QueryParams) Set(key string, value any) *QueryParams {
3 years ago
s.simpleReq.queryParams.Set(key, fmt.Sprintf("%v", value))
return s
}
//get all queryParams
func (s *QueryParams) Gets() *url.Values {
return &s.simpleReq.queryParams
}