2019-12-05 18:21:35 +00:00
|
|
|
package form
|
2019-06-09 02:37:02 +00:00
|
|
|
|
2021-11-26 13:28:50 +00:00
|
|
|
// SearchLabels represents search form fields for "/api/v1/labels".
|
|
|
|
type SearchLabels struct {
|
2020-05-14 17:03:12 +00:00
|
|
|
Query string `form:"q"`
|
2021-12-16 10:42:57 +00:00
|
|
|
UID string `form:"uid"`
|
2020-05-14 17:03:12 +00:00
|
|
|
Slug string `form:"slug"`
|
|
|
|
Name string `form:"name"`
|
|
|
|
All bool `form:"all"`
|
|
|
|
Favorite bool `form:"favorite"`
|
2020-05-23 18:58:58 +00:00
|
|
|
Count int `form:"count" binding:"required" serialize:"-"`
|
|
|
|
Offset int `form:"offset" serialize:"-"`
|
|
|
|
Order string `form:"order" serialize:"-"`
|
2019-06-09 02:37:02 +00:00
|
|
|
}
|
|
|
|
|
2021-11-26 13:28:50 +00:00
|
|
|
func (f *SearchLabels) GetQuery() string {
|
2020-01-15 03:04:33 +00:00
|
|
|
return f.Query
|
|
|
|
}
|
2019-06-09 02:37:02 +00:00
|
|
|
|
2021-11-26 13:28:50 +00:00
|
|
|
func (f *SearchLabels) SetQuery(q string) {
|
2020-01-15 03:04:33 +00:00
|
|
|
f.Query = q
|
|
|
|
}
|
2019-06-09 02:37:02 +00:00
|
|
|
|
2021-11-26 13:28:50 +00:00
|
|
|
func (f *SearchLabels) ParseQueryString() error {
|
2020-01-15 03:04:33 +00:00
|
|
|
return ParseQueryString(f)
|
2019-06-09 02:37:02 +00:00
|
|
|
}
|
2020-01-28 19:59:02 +00:00
|
|
|
|
2021-11-26 13:28:50 +00:00
|
|
|
func NewLabelSearch(query string) SearchLabels {
|
|
|
|
return SearchLabels{Query: query}
|
2020-01-28 19:59:02 +00:00
|
|
|
}
|