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