-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.go
More file actions
32 lines (27 loc) · 688 Bytes
/
query.go
File metadata and controls
32 lines (27 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package freeproxy
// QueryParams holds the query parameters for Query request
type QueryParams struct {
Country *string
Protocol *string
Page *int
}
// QueryOption is a function that modifies the query parameters
type QueryOption func(*QueryParams)
// WithCountry sets the country filter
func WithCountry(country string) QueryOption {
return func(qp *QueryParams) {
qp.Country = &country
}
}
// WithProtocol sets the protocol filter
func WithProtocol(protocol string) QueryOption {
return func(qp *QueryParams) {
qp.Protocol = &protocol
}
}
// WithPage sets the page number
func WithPage(page int) QueryOption {
return func(qp *QueryParams) {
qp.Page = &page
}
}