650817a9e0
Finding the right code is easier when the name matches related functionality in other packages.
30 lines
743 B
Go
30 lines
743 B
Go
package form
|
|
|
|
// SearchLabels represents search form fields for "/api/v1/labels".
|
|
type SearchLabels struct {
|
|
Query string `form:"q"`
|
|
ID string `form:"id"`
|
|
Slug string `form:"slug"`
|
|
Name string `form:"name"`
|
|
All bool `form:"all"`
|
|
Favorite bool `form:"favorite"`
|
|
Count int `form:"count" binding:"required" serialize:"-"`
|
|
Offset int `form:"offset" serialize:"-"`
|
|
Order string `form:"order" serialize:"-"`
|
|
}
|
|
|
|
func (f *SearchLabels) GetQuery() string {
|
|
return f.Query
|
|
}
|
|
|
|
func (f *SearchLabels) SetQuery(q string) {
|
|
f.Query = q
|
|
}
|
|
|
|
func (f *SearchLabels) ParseQueryString() error {
|
|
return ParseQueryString(f)
|
|
}
|
|
|
|
func NewLabelSearch(query string) SearchLabels {
|
|
return SearchLabels{Query: query}
|
|
}
|