Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Q ¶
func Q(nameValue ...string) QUERY
Generates a URL QUERY. nameValue's should be paired otherwise the last one is ignored.
Example ¶
fmt.Println(Q("q", "golang", "page", "1"))
Output: q=golang&page=1
func U ¶
Makes a URL. port is ignored if set to zero. fragment is optional. If specified as an empty string, a trailing '#' will be appended.
Example ¶
fmt.Println(FullURL("http", "www.example.com", 1234, "/main", Q("q", "\"hello world"), "abc")) fmt.Println(FullURL("http", "www.example.com", 1234, "main", Q("q&b", "hello+world"), "abc")) fmt.Println(FullURL("", "www.example.com", 1234, "main", Q("q&b", "hello+world"), "abc")) fmt.Println(U("", "main", Q("q&b", "hello+world"), "abc")) fmt.Println(U("", "", Q("q&b", "hello+world"), "abc")) fmt.Println(U("", "", "", "abc")) fmt.Println(U("www.example.com", "main", Q("q&b", "hello+world"), "abc")) fmt.Println(FullURL("http", "www.example.com", 0, "", Q("?", "?"), "")) fmt.Println(FullURL("http", "www.example.com", 0, "", Q("?", "?")))
Output: http://www.example.com:1234/main?q=%22hello+world#abc http://www.example.com:1234/main?q%26b=hello%2Bworld#abc //www.example.com:1234/main?q%26b=hello%2Bworld#abc main?q%26b=hello%2Bworld#abc ?q%26b=hello%2Bworld#abc #abc //www.example.com/main?q%26b=hello%2Bworld#abc http://www.example.com/?%3F=%3F# http://www.example.com/?%3F=%3F
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.