更新url

This commit is contained in:
2022-05-14 15:48:44 +08:00
parent cdf00b5c99
commit 096b1552f4
2 changed files with 18 additions and 7 deletions

22
url.go
View File

@@ -24,30 +24,38 @@ type URLParseResult struct {
Parameter map[string]string `json:"parameter"`
}
// URLEncode ...
// ownURL ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:38 2022/5/14
type ownURL struct {
}
// Encode ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2:39 下午 2021/11/4
func URLEncode(inputURL string) string {
func (ou *ownURL) Encode(inputURL string) string {
return url.QueryEscape(inputURL)
}
// URLDecode ...
// Decode ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2:39 下午 2021/11/4
func URLDecode(inputURL string) (string, error) {
func (ou *ownURL) Decode(inputURL string) (string, error) {
return url.QueryUnescape(inputURL)
}
// URLParse url解析
// Parse url解析
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2:39 下午 2021/11/4
func URLParse(inputURL string) (*URLParseResult, error) {
func (ou *ownURL) Parse(inputURL string) (*URLParseResult, error) {
var (
parseResult *url.URL
err error
@@ -76,7 +84,7 @@ func URLParse(inputURL string) (*URLParseResult, error) {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 2:43 下午 2021/11/4
func BuildQueryURL(apiURL string, parameter map[string]string) string {
func (ou *ownURL) BuildQueryURL(apiURL string, parameter map[string]string) string {
u := url.Values{}
for k, v := range parameter {
u.Set(k, v)